/* Password & Passphrase Generator Styles */

/* ============================================
   CSS Variables (Theme)
   ============================================ */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --bg-card: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --border-color: #e0e0e0;
  --accent-color: #0066cc;
  --accent-hover: #0052a3;
  --success-color: #28a745;
  --error-color: #dc3545;
  --output-bg: #f8f9fa;
}

[data-theme="dark"] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-card: #252525;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0a0;
  --border-color: #404040;
  --accent-color: #4d9fff;
  --accent-hover: #3d8cf0;
  --output-bg: #2d2d2d;
}

/* ============================================
   Reset & Base
   ============================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color 0.2s, color 0.2s;
}

/* ============================================
   Layout
   ============================================ */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

header p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ============================================
   Theme Dropdown
   ============================================ */
.theme-dropdown {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 1000;
}

.theme-toggle {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  cursor: pointer;
  color: var(--text-primary);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .theme-toggle {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
}

.theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-icon svg {
  display: block;
}

.theme-menu {
  position: absolute;
  bottom: 56px;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 4px;
  min-width: 140px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 100;
}

[data-theme="dark"] .theme-menu {
  background: rgba(31, 41, 55, 0.95);
}

.theme-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background-color 0.15s;
}

.theme-option:hover {
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .theme-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.theme-option.active {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}

[data-theme="dark"] .theme-option.active {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.theme-option svg {
  flex-shrink: 0;
}

/* ============================================
   Mode Toggle
   ============================================ */
.mode-toggle {
  display: flex;
  background-color: var(--bg-secondary);
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 1.5rem;
}

.mode-toggle button {
  flex: 1;
  padding: 0.625rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}

.mode-toggle button.active {
  background-color: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ============================================
   Cards
   ============================================ */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.options-card {
  display: none;
}

.options-card.active {
  display: block;
}

/* ============================================
   Form Elements
   ============================================ */
.form-group {
  margin-bottom: 1rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: var(--text-primary);
}

input[type="number"],
select {
  width: 100%;
  padding: 0.625rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: border-color 0.2s;
}

input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent-color);
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent-color);
  cursor: pointer;
}

.hint {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* ============================================
   Extras (Passphrase Options)
   ============================================ */
.extras-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.extra-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.extra-select {
  width: auto;
  min-width: 120px;
  padding: 0.375rem 0.5rem;
  font-size: 0.8125rem;
}

.extra-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.extra-selects {
  display: flex;
  gap: 0.5rem;
}

.extra-selects .extra-select {
  min-width: 100px;
}

/* ============================================
   Buttons
   ============================================ */
.actions {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.btn {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background-color: var(--accent-color);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
}

.btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--accent-color);
}

.btn-icon {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.375rem;
  cursor: pointer;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background-color 0.2s;
}

.btn-icon:hover {
  border-color: var(--accent-color);
  background-color: var(--bg-primary);
}

/* ============================================
   Output
   ============================================ */
.output-card {
  background-color: var(--output-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
}

.output-value {
  font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace;
  font-size: 1.125rem;
  word-break: break-all;
  min-height: 1.75rem;
  color: var(--text-primary);
  outline: none;
  padding: 0.5rem;
  margin: -0.5rem;
  border-radius: 6px;
  transition: background-color 0.15s;
}

.output-value:focus {
  background-color: var(--bg-primary);
}

.output-value:empty::before {
  content: "Click Generate";
  color: var(--text-secondary);
}

/* ============================================
   Strength Indicator
   ============================================ */
.strength-container {
  margin-top: 0.75rem;
}

.feedback {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.feedback.success {
  color: var(--success-color);
}

.feedback.error {
  color: var(--error-color);
}

.strength-bar {
  height: 4px;
  background-color: var(--border-color);
  border-radius: 2px;
  overflow: hidden;
}

.strength-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width 0.3s, background-color 0.3s;
}

.strength-bar-fill.weak {
  width: 33%;
  background-color: var(--error-color);
}

.strength-bar-fill.okay {
  width: 66%;
  background-color: #f0ad4e;
}

.strength-bar-fill.strong {
  width: 100%;
  background-color: var(--success-color);
}

.strength-info {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.75rem;
  line-height: 1.5;
}

.strength-info a {
  color: var(--accent-color);
  text-decoration: none;
}

.strength-info a:hover {
  text-decoration: underline;
}

/* ============================================
   API Section
   ============================================ */
.api-section {
  margin-top: 1.5rem;
  padding: 1rem;
  background-color: var(--bg-secondary);
  border-radius: 8px;
}

.api-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.api-header label {
  margin-bottom: 0;
}

.api-url {
  font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace;
  font-size: 0.75rem;
  word-break: break-all;
  padding: 0.5rem;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.api-section .hint code {
  background-color: var(--bg-primary);
  padding: 0.125rem 0.25rem;
  border-radius: 3px;
  font-size: 0.75rem;
}

/* ============================================
   Bare Mode
   ============================================ */
.bare-mode .container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.bare-mode header,
.bare-mode .mode-toggle,
.bare-mode .options-card,
.bare-mode .actions,
.bare-mode .strength-container,
.bare-mode .api-section,
.bare-mode .theme-dropdown {
  display: none !important;
}

.bare-mode .output-card {
  background: transparent;
  border: none;
  padding: 0;
}

.bare-mode .output-value {
  font-size: 1.5rem;
  text-align: center;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 480px) {
  .container {
    padding: 1.5rem 1rem;
  }

  header h1 {
    font-size: 1.25rem;
  }

  .checkbox-group {
    flex-direction: column;
    gap: 0.5rem;
  }
}
