/* --------------------------------------------------------------------------
   Random Password Generator — High-Craft Minimalist Design System
   Inspired by Raycast, Apple, & Vercel. Zero AI Slop.
   -------------------------------------------------------------------------- */

:root {
  /* Default: Dark Theme (Zinc / Obsidian) */
  --bg-body: #09090b;
  --bg-card: #18181b;
  --bg-card-hover: #27272a;
  --border-color: #27272a;
  --border-focus: #3f3f46;
  
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;

  --pw-bg: #09090b;
  --pw-border: #27272a;
  --pw-text: #fafafa;

  --accent-color: #3b82f6;
  --accent-hover: #2563eb;
  --accent-text: #ffffff;

  --strength-weak: #ef4444;
  --strength-medium: #f59e0b;
  --strength-strong: #10b981;
  --strength-very-strong: #3b82f6;

  --switch-bg: #27272a;
  --switch-bg-active: #3b82f6;

  --shadow-subtle: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
  --bg-body: #f4f4f5;
  --bg-card: #ffffff;
  --bg-card-hover: #fafafa;
  --border-color: #e4e4e7;
  --border-focus: #d4d4d8;

  --text-primary: #09090b;
  --text-secondary: #71717a;
  --text-muted: #a1a1aa;

  --pw-bg: #fafafa;
  --pw-border: #e4e4e7;
  --pw-text: #09090b;

  --switch-bg: #e4e4e7;
  --switch-bg-active: #2563eb;

  --shadow-subtle: 0 4px 12px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

*:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', Roboto, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 1rem;
  flex: 1;
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.theme-toggle-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

/* Main Utility Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-subtle);
  margin-bottom: 1.5rem;
}

/* Hero Password Box */
.pw-box {
  background: var(--pw-bg);
  border: 1px solid var(--pw-border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
}

.pw-box:hover {
  border-color: var(--border-focus);
}

.pw-output {
  font-family: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--pw-text);
  word-break: break-all;
  letter-spacing: 1px;
  user-select: all;
  font-variant-numeric: tabular-nums;
}

.copy-btn {
  background: var(--text-primary);
  color: var(--bg-body);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  min-height: 36px;
}

.copy-btn:hover {
  opacity: 0.9;
}

.copy-btn:active {
  transform: scale(0.97);
}

.copy-btn.copied {
  background: var(--strength-strong);
  color: #ffffff;
}

/* Minimalist Strength Line */
.strength-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

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

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

/* Control Grid */
.controls-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.slider-value {
  font-family: ui-monospace, monospace;
  font-weight: 600;
  color: var(--accent-color);
}

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

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-primary);
  cursor: pointer;
  border: 2px solid var(--bg-card);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.presets-row {
  display: flex;
  gap: 0.4rem;
}

.preset-pill {
  background: var(--pw-bg);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
}

.preset-pill:hover {
  border-color: var(--border-focus);
  color: var(--text-primary);
}

/* Toggle Pills Grid */
.toggles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  background: var(--pw-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 500;
}

.toggle-row:hover {
  border-color: var(--border-focus);
}

@media (min-width: 520px) {
  .toggles-grid {
    grid-template-columns: 1fr 1fr;
  }

  .toggle-row-full {
    grid-column: span 2;
    white-space: nowrap;
  }
}

/* Switch UI */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-toggle {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--switch-bg);
  transition: .2s;
  border-radius: 20px;
}

.slider-toggle:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}

input:checked + .slider-toggle {
  background-color: var(--switch-bg-active);
}

input:checked + .slider-toggle:before {
  transform: translateX(16px);
}

/* Primary Action Button */
.generate-btn {
  width: 100%;
  margin-top: 1.25rem;
  background: var(--accent-color);
  color: var(--accent-text);
  border: none;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

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

.generate-btn:active {
  transform: scale(0.98);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--text-primary);
  color: var(--bg-body);
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateY(60px);
  opacity: 0;
  transition: all 0.2s ease;
  z-index: 1000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Footer & Links */
.cross-promo {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.cross-promo a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 500;
}

.cross-promo a:hover {
  text-decoration: underline;
}

footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.footer-nav a {
  color: var(--text-secondary);
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--text-primary);
}

.copyright a {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

.copyright a:hover {
  text-decoration: underline;
}

@media (max-width: 500px) {
  .pw-output {
    font-size: 1.15rem;
  }
}
