/* Smart Password Maker - Modern Light Theme */

:root {
  --bg-primary: #f5f7fa;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f0f2f5;
  --bg-input-hover: #e8eaed;
  --border-color: #d1d5db;
  --border-focus: rgba(14, 165, 233, 0.5);
  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  --accent-primary: #0ea5e9;
  --accent-secondary: #0284c7;
  --accent-gradient: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  --success: #10b981;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 40px rgba(14, 165, 233, 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: all 0.2s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#main {
  width: 100%;
  max-width: 360px;
}

#codewriter {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

/* Header */
.app-header {
  text-align: center;
  margin-bottom: 20px;
  position: relative;
}

.help-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.help-btn:hover {
  color: var(--accent-primary);
  background: var(--bg-input);
}

h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* Secret Phrase Group */
.secret-group {
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 12px;
  border: 1px solid var(--border-color);
}

.secret-group .input-wrapper {
  background: var(--bg-secondary);
}

.secret-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

#secretverification {
  background: var(--accent-gradient);
  color: white;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  font-family: 'SF Mono', 'Fira Code', monospace;
  letter-spacing: 0.05em;
}

#checktext {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Toggle Switch */
.save-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.save-toggle input {
  display: none;
}

.toggle-slider {
  width: 32px;
  height: 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 9px;
  position: relative;
  transition: var(--transition);
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: var(--transition);
}

.save-toggle input:checked + .toggle-slider {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.save-toggle input:checked + .toggle-slider::after {
  transform: translateX(14px);
  background: white;
}

/* Input Section */
.input-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  overflow: hidden;
}

.input-wrapper:hover {
  background: var(--bg-input-hover);
}

.input-wrapper:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.inputField {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
}

.inputField::placeholder {
  color: var(--text-muted);
}

.input-action {
  flex-shrink: 0;
  background: transparent;
  border: none;
  padding: 10px 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-action:hover {
  color: var(--text-secondary);
}

/* Saved Sites Chips */
.saved-sites {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  max-height: 120px;
  overflow-y: auto;
  padding: 2px;
}

.site-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 4px 8px 4px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.site-chip:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.site-chip-name {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-chip-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  opacity: 0.6;
  transition: var(--transition);
  padding: 0;
}

.site-chip-remove:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

.site-chip:hover .site-chip-remove:hover {
  background: rgba(255, 255, 255, 0.2);
}

.saved-sites:empty::before {
  content: "No saved sites yet";
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
}

/* Save button highlight when website can be saved */
.input-action.can-save {
  color: var(--accent-primary);
}

.input-action.can-save:hover {
  color: var(--accent-secondary);
}

/* Result Section */
.result-section {
  margin-bottom: 20px;
}

.result-display {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

#result {
  flex: 1;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  text-align: center;
  user-select: none;
}

.show-btn {
  background: transparent;
  border: none;
  padding: 10px 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
}

.show-btn:hover {
  background: var(--bg-input-hover);
  color: var(--accent-primary);
}

/* Button Group */
.button-group {
  display: flex;
  gap: 10px;
}

.copy-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.copy-btn.primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.3);
}

.copy-btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
}

.copy-btn.primary:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
  filter: brightness(0.9);
}

.copy-btn.secondary {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.copy-btn.secondary:hover {
  background: var(--bg-input-hover);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.copy-btn.secondary:active {
  transform: translateY(1px) scale(0.98);
  background: var(--border-color);
}

/* Divider - kept for compatibility */
.dividerLine {
  display: none;
}

/* Legacy icon class - hidden since we use SVG now */
.icon {
  display: none;
}

/* Confirmation Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease;
}

.modal-overlay.show {
  display: flex;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 280px;
  text-align: center;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.2s ease;
}

.modal-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fef2f2;
  border-radius: 50%;
  color: #ef4444;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.modal-message {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 20px;
  line-height: 1.5;
}

.modal-message strong {
  color: var(--text-primary);
}

.modal-buttons {
  display: flex;
  gap: 10px;
}

.modal-btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  border: none;
}

.modal-btn.cancel {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.modal-btn.cancel:hover {
  background: var(--bg-input-hover);
  color: var(--text-primary);
}

.modal-btn.confirm {
  background: #ef4444;
  color: white;
}

.modal-btn.confirm:hover {
  background: #dc2626;
}

/* Help Modal Styles */
.help-dialog {
  width: 340px;
  text-align: left;
  padding: 20px;
}

.help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.help-header .modal-title {
  margin: 0;
}

.help-close-btn {
  background: transparent;
  border: none;
  padding: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.help-close-btn:hover {
  color: var(--text-secondary);
}

.help-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.help-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.help-item-icon {
  width: 24px;
  flex-shrink: 0;
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-item-text {
  flex: 1;
}

.help-item-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.help-item-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.help-tip {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
  padding-top: 4px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Selection */
::selection {
  background: var(--accent-primary);
  color: white;
}

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: none;
}

/* Narrow devices (phones): full-width, no frame, top-aligned */
@media (max-width: 500px) {
  body {
    align-items: flex-start;
    padding: 0;
    background: var(--bg-card);
  }

  #main {
    max-width: none;
  }

  #codewriter {
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
}
