@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --accent: #10b981;
  --accent-dark: #059669;
  --accent-light: #d1fae5;
  --accent-lighter: #ecfdf5;
  --bg: #f9fafb;
  --surface: #ffffff;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] {
  --bg: #111827;
  --surface: #1f2937;
  --text: #f9fafb;
  --text-muted: #9ca3af;
  --border: #374151;
  --accent-light: #064e3b;
  --accent-lighter: #022c22;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.3);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.theme-btn {
  position: fixed;
  top: 16px;
  right: 70px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, border-color 0.15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.theme-btn:hover {
  background: var(--accent-lighter);
  border-color: var(--accent);
}

/* ── Lang Button (fixed corner) ── */

.lang-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.lang-btn:hover {
  background: var(--accent-lighter);
  border-color: var(--accent);
  color: var(--accent-dark);
}

/* ── Main ── */

main {
  flex: 1;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 20px 40px;
}

/* ── Hero ── */

.hero {
  text-align: center;
  margin-bottom: 32px;
}

.hero h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 8px;
}

.subtitle {
  font-size: 16px;
  color: var(--text-muted);
}

/* ── Card ── */

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px;
}

/* ── Mode Tabs ── */

.mode-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 24px;
}

.mode-tab {
  flex: 1;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.mode-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* ── Password Display ── */

.password-display {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 220px 18px 18px;
  min-height: 72px;
  position: relative;
  display: flex;
  align-items: center;
  transition: border-color 0.2s;
  margin-top: 16px;
  margin-bottom: 24px;
}

.password-display.copied {
  border-color: var(--accent);
  background: var(--accent-lighter);
}

#password-output {
  font-family: 'Courier New', Courier, monospace;
  font-size: 17px;
  letter-spacing: 1px;
  word-break: break-all;
  line-height: 1.5;
  color: var(--text);
  flex: 1;
}

#password-output.pw-placeholder {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  letter-spacing: 0;
  color: var(--text-muted);
}

.example-badge {
  display: inline-block;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--accent-dark);
  background: var(--accent-lighter);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 2px 7px;
  vertical-align: middle;
  margin-right: 6px;
}

.display-actions {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 6px;
}

.copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.copy-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.copy-btn.success {
  color: var(--accent-dark);
  border-color: var(--accent);
  background: var(--accent-lighter);
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--accent-light);
  color: var(--accent-dark);
}

/* ── Strength ── */

/* ── Settings ── */

.settings {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 24px;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setting-group > label,
.setting-group .setting-label-row label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.setting-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.length-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-dark);
  background: var(--accent-lighter);
  border-radius: 6px;
  padding: 2px 8px;
}

/* ── Slider ── */

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 99px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 0 3px var(--accent-light);
  transition: box-shadow 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 5px var(--accent-light);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ── Checkboxes ── */

.checkboxes-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.checkbox-item {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  user-select: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.checkbox-item:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.checkbox-item input[type="checkbox"] {
  display: none;
}

.cb-box {
  display: none;
}

.checkbox-item input[type="checkbox"]:checked ~ span:last-child,
.checkbox-item:has(input:checked) {
  color: var(--accent-dark);
}

.checkbox-item:has(input:checked) {
  background: var(--accent-lighter);
  border-color: var(--accent);
  color: var(--accent-dark);
}

/* ── Count Buttons ── */

.count-btns {
  display: flex;
  gap: 8px;
}

.count-btn, .word-btn, .sep-btn {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  flex: 1;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.count-btn.active, .word-btn.active, .sep-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.count-btn:not(.active):hover, .word-btn:not(.active):hover, .sep-btn:not(.active):hover {
  background: var(--accent-lighter);
  border-color: var(--accent);
  color: var(--accent-dark);
}

/* ── Generate Button ── */

.btn-generate {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.35);
  color: white;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.1s, filter 0.2s;
  letter-spacing: 0.3px;
}

.btn-generate:hover {
  filter: brightness(1.07);
  box-shadow: 0 6px 28px rgba(34, 197, 94, 0.55);
}

.btn-generate:active {
  transform: scale(0.99);
  box-shadow: 0 2px 10px rgba(34, 197, 94, 0.3);
}

/* ── Passwords List (multi) ── */

.passwords-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pwd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color 0.15s;
}

.pwd-item:hover {
  border-color: var(--accent);
}

.pwd-item span {
  flex: 1;
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  letter-spacing: 0.5px;
  word-break: break-all;
  color: var(--text);
}

.pwd-item .icon-btn {
  flex-shrink: 0;
}

/* ── History ── */

.history-section {
  margin-top: 28px;
}

.history-section details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.history-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  list-style: none;
  user-select: none;
}

.history-section summary::-webkit-details-marker {
  display: none;
}

.history-section summary::after {
  content: '›';
  font-size: 18px;
  color: var(--text-muted);
  transform: rotate(90deg);
  display: inline-block;
  transition: transform 0.2s;
  order: 2;
  margin-left: 4px;
}

.history-section details[open] summary::after {
  transform: rotate(-90deg);
}

.btn-clear {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  cursor: pointer;
  order: 1;
  margin-left: auto;
  margin-right: 8px;
  transition: color 0.15s, border-color 0.15s;
}

.btn-clear:hover {
  color: #ef4444;
  border-color: #ef4444;
}

.history-list {
  list-style: none;
  padding: 0 0 8px;
  border-top: 1px solid var(--border);
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
}

.history-item:last-child {
  border-bottom: none;
}

.history-item span {
  flex: 1;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  color: var(--text-muted);
  word-break: break-all;
}

.history-item .icon-btn {
  opacity: 0;
  transition: opacity 0.15s;
}

.history-item:hover .icon-btn {
  opacity: 1;
}

.history-empty {
  padding: 16px 18px;
  font-size: 14px;
  color: var(--text-muted);
}

/* ── Footer ── */

footer {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: auto;
}

.footer-faq {
  padding: 48px 20px 32px;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.footer-desc {
  max-width: 640px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
  text-align: center;
  opacity: 0.7;
}

footer > p {
  font-size: 13px;
  color: var(--text-muted);
}

.footer-made {
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.6;
}

.footer-made a {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.footer-made a:hover {
  opacity: 1;
  color: var(--text);
}

.donate-btn {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 100;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.donate-btn:hover {
  background: var(--accent-lighter);
  border-color: var(--accent);
  color: var(--accent-dark);
}

/* ── Responsive ── */

@media (max-width: 600px) {
  main {
    padding: 64px 16px 32px;
  }

  .hero {
    padding-top: 0;
  }

  .hero h1 {
    font-size: 26px;
  }

  .card {
    padding: 22px 18px;
  }

  .checkboxes-row {
    gap: 8px;
  }

  .checkbox-item {
    font-size: 13px;
  }

  #password-output {
    font-size: 14px;
    letter-spacing: 0.5px;
  }

}

/* ── FAQ ── */

.faq-section {
  margin: 0;
  padding: 0;
}

.faq-section h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 20px;
  text-align: center;
}

.faq-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  counter-reset: faq;
}

.faq-item {
  background: var(--surface);
  padding: 28px 28px 24px;
  counter-increment: faq;
  position: relative;
  text-align: left;
}

.faq-item:first-child { border-radius: var(--radius) 0 0 0; }
.faq-item:nth-child(2) { border-radius: 0 var(--radius) 0 0; }
.faq-item:nth-child(5) { border-radius: 0 0 0 var(--radius); }
.faq-item:last-child { border-radius: 0 0 var(--radius) 0; }

.faq-item::before {
  content: counter(faq, decimal-leading-zero);
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  opacity: 0.4;
  margin-bottom: 12px;
}

.faq-item h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px;
  text-align: left;
}

.faq-item p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
  margin: 0;
  text-align: left;
}

/* ── QR Modal ── */

.qr-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.qr-modal.open {
  display: flex;
}

.qr-modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
}

.qr-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 16px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.qr-close:hover {
  color: var(--text);
}

.qr-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

@media (max-width: 600px) {
  .faq-list {
    display: block;
  }

  .faq-item {
    border-radius: 0 !important;
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
    background: none;
  }

  .faq-item:first-child {
    border-top: 1px solid var(--border);
  }

  .password-display {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
  }

  .display-actions {
    position: static;
    transform: none;
    margin-top: 12px;
    width: 100%;
  }

  .display-actions .copy-btn {
    flex: 1;
    justify-content: center;
  }
}
