/* =====================================================
   1. CSS VARIABLES / ROOT CONFIG
===================================================== */
:root {
  --color-bg: #05070a;
  --color-glass: rgba(0, 255, 157, 0.03);
  --color-glass-border: rgba(0, 255, 157, 0.18);
  --color-text-primary: #eafff5;
  --color-text-muted: #6b8a7d;

  --color-accent: #00ff9d;
  --color-accent-2: #22d3ee;
  --gradient-accent: linear-gradient(135deg, #00ff9d 0%, #22d3ee 100%);

  --color-weak: #ef4444;
  --color-medium: #f59e0b;
  --color-strong: #00ff9d;

  --shadow-soft: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 70px rgba(0, 255, 157, 0.12);

  --radius-lg: 24px;
  --radius-md: 14px;
  --radius-sm: 8px;

  --transition-fast: 0.2s ease;
  --transition-med: 0.4s cubic-bezier(0.22, 1, 0.36, 1);

  --font-main: 'Poppins', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

/* =====================================================
   2. RESET
===================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  font-family: var(--font-main);
  background: var(--color-bg);
  color: var(--color-text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: inherit;
  border: none;
  outline: none;
  cursor: pointer;
  background: none;
}

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

/* =====================================================
   3. ANIMATED GRID BACKGROUND
===================================================== */
.grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 255, 157, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 157, 0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black 40%, transparent 90%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black 40%, transparent 90%);
  animation: gridDrift 30s linear infinite;
}

@keyframes gridDrift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 42px 42px, 42px 42px; }
}

/* =====================================================
   4. HEADER (logo only, no navigation)
===================================================== */
.site-header {
  position: relative;
  z-index: 10;
  width: 100%;
  padding: 1.6rem 0;
  animation: fadeDown 0.7s var(--transition-med);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.logo-bracket {
  color: var(--color-accent-2);
  opacity: 0.7;
}

.logo-accent {
  color: var(--color-accent);
}

/* =====================================================
   5. MAIN / GENERATOR CARD
===================================================== */
.main-content {
  position: relative;
  z-index: 10;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.25rem;
}

.generator-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  padding: 2.4rem 2rem;
  background: var(--color-glass);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-soft), var(--shadow-glow);
  animation: cardEntrance 0.8s var(--transition-med) both;
  transition: box-shadow var(--transition-fast);
}

.generator-card:hover {
  box-shadow: var(--shadow-soft), 0 0 100px rgba(0, 255, 157, 0.2);
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin-bottom: 1.6rem;
}

.status-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 10px var(--color-accent);
  animation: pulseDot 2s ease-in-out infinite;
}

.card-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

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

/* =====================================================
   6. TERMINAL-STYLE PASSWORD CONSOLE
===================================================== */
.console {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-glass-border);
  background: #060a08;
  margin-bottom: 1rem;
}

.console-topbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.9rem;
  background: rgba(0, 255, 157, 0.04);
  border-bottom: 1px solid var(--color-glass-border);
}

.console-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  opacity: 0.7;
}

.console-dot.red { background: #ef4444; }
.console-dot.yellow { background: #f59e0b; }
.console-dot.green { background: #00ff9d; }

.console-title {
  margin-left: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.console-body {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1.1rem 1.1rem;
}

.console-prompt {
  font-family: var(--font-mono);
  color: var(--color-accent);
  font-weight: 700;
  flex-shrink: 0;
}

.password-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 1rem;
  letter-spacing: 0.5px;
}

.console-cursor {
  flex-shrink: 0;
  width: 8px;
  height: 18px;
  background: var(--color-accent);
  animation: blinkCursor 1s steps(1) infinite;
}

/* =====================================================
   7. ACTION BUTTONS ROW
===================================================== */
.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin-bottom: 1.6rem;
}

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-primary);
  background: rgba(0, 255, 157, 0.05);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast), transform var(--transition-fast), border-color var(--transition-fast);
}

.action-btn:hover {
  background: rgba(0, 255, 157, 0.12);
  border-color: var(--color-accent);
  transform: translateY(-2px);
}

.action-btn:active {
  transform: translateY(0);
}

.action-btn.copied {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

#refreshBtn:active svg {
  transform: rotate(180deg);
}

#refreshBtn svg {
  transition: transform var(--transition-med);
}

/* =====================================================
   8. STRENGTH METER
===================================================== */
.strength-section {
  margin-bottom: 1.6rem;
}

.strength-bar-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.strength-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--color-weak);
  box-shadow: 0 0 10px currentColor;
  transition: width var(--transition-med), background var(--transition-med);
}

.strength-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 1px;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* =====================================================
   9. LENGTH SLIDER
===================================================== */
.control-group {
  margin-bottom: 1.5rem;
}

.control-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.control-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.length-value {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-accent);
  min-width: 28px;
  text-align: center;
  background: rgba(0, 255, 157, 0.08);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

.length-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.length-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gradient-accent);
  box-shadow: 0 0 12px rgba(0, 255, 157, 0.7);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.length-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.length-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: var(--gradient-accent);
  box-shadow: 0 0 12px rgba(0, 255, 157, 0.7);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.length-slider::-moz-range-thumb:hover {
  transform: scale(1.15);
}

/* =====================================================
   10. CHIP-STYLE TOGGLE OPTIONS
===================================================== */
.options-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-bottom: 1.8rem;
}

.option-chip {
  padding: 0.65rem 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.option-chip:hover {
  border-color: var(--color-accent);
}

.option-chip.active {
  color: #04140d;
  background: var(--gradient-accent);
  border-color: transparent;
  box-shadow: 0 0 16px rgba(0, 255, 157, 0.35);
}

/* =====================================================
   11. GENERATE BUTTON
===================================================== */
.generate-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1rem;
  font-size: 0.98rem;
  font-weight: 600;
  color: #04140d;
  background: var(--gradient-accent);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 28px rgba(0, 255, 157, 0.3);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.generate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 36px rgba(0, 255, 157, 0.45);
}

.generate-btn:active {
  transform: translateY(0);
}

/* =====================================================
   12. TOAST NOTIFICATION
===================================================== */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.4rem;
  background: rgba(6, 10, 8, 0.95);
  border: 1px solid var(--color-glass-border);
  border-radius: var(--radius-md);
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 200;
  transition: transform var(--transition-med);
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* =====================================================
   13. FOOTER
===================================================== */
.site-footer {
  position: relative;
  z-index: 10;
  border-top: 1px solid var(--color-glass-border);
  background: rgba(5, 7, 10, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 2.5rem 1.5rem 1.5rem;
  animation: fadeIn 0.9s var(--transition-med) both;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.footer-logo {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.footer-tagline {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.2rem;
}

.footer-contact p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 0.4rem;
}

.footer-contact a {
  color: var(--color-accent);
  transition: color var(--transition-fast);
}

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

.challenge-tag {
  color: var(--color-accent-2) !important;
}

.footer-bottom {
  margin-top: 1.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--color-glass-border);
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* =====================================================
   14. ANIMATIONS
===================================================== */
@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeDown {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes blinkCursor {
  50% { opacity: 0; }
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* =====================================================
   15. RESPONSIVE
===================================================== */

/* Tablet */
@media (max-width: 768px) {
  .generator-card {
    padding: 2rem 1.6rem;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .generator-card {
    padding: 1.8rem 1.2rem;
    border-radius: var(--radius-md);
  }

  .options-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .password-input {
    font-size: 0.85rem;
  }

  .action-row {
    grid-template-columns: 1fr 1fr;
  }
}