/* ========================================
   🎨 Auth Page - 2025 Modern Design
   Mobile-First | Neomorphism + Glass
   ======================================== */

/* Google Fonts - Modern 2025 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Space+Grotesk:wght@500;700&display=swap');

/* ========================================
   🎨 CSS RESET & BASE
   ======================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:root {
  /* 🎨 2025 Color Palette - Modern & Accessible */
  --primary-indigo: #6366f1;
  --primary-purple: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --gold-primary: #f59e0b;
  --gold-light: #fbbf24;

  /* Gradients */
  --gradient-mesh: linear-gradient(135deg,
    rgba(99, 102, 241, 0.15) 0%,
    rgba(139, 92, 246, 0.15) 25%,
    rgba(6, 182, 212, 0.15) 50%,
    rgba(16, 185, 129, 0.15) 75%,
    rgba(99, 102, 241, 0.15) 100%);

  --gradient-primary: linear-gradient(135deg, #6366f1, #8b5cf6);
  --gradient-accent: linear-gradient(135deg, #06b6d4, #10b981);

  /* Glass Effects */
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-bg-strong: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.15);
  --glass-hover: rgba(255, 255, 255, 0.18);

  /* Text Colors */
  --text-primary: rgba(255, 255, 255, 0.95);
  --text-secondary: rgba(255, 255, 255, 0.75);
  --text-tertiary: rgba(255, 255, 255, 0.55);

  /* Shadows - Soft & Modern */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.2);
  --glow-primary: 0 0 24px rgba(99, 102, 241, 0.4);
  --glow-accent: 0 0 24px rgba(6, 182, 212, 0.4);
  --glow-gold: 0 0 20px rgba(245, 158, 11, 0.5);

  /* Spacing System - 4px Grid */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.5rem;   /* 24px */
  --space-6: 2rem;     /* 32px */
  --space-8: 3rem;     /* 48px */
  --space-10: 4rem;    /* 64px */

  /* Border Radius - Soft Corners */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;

  /* Typography */
  --font-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;

  /* Transitions */
  --transition-fast: 150ms ease-out;
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   🌐 GLOBAL STYLES
   ======================================== */

body {
  background: linear-gradient(to right bottom,
    #1e293b, #334155, #475569, #64748b);
  background-attachment: fixed;
  min-height: 100vh;
  margin: 0;
  font-family: var(--font-base);
  font-size: clamp(0.875rem, 0.8rem + 0.4vw, 1rem);
  color: var(--text-primary);
  overflow-x: hidden;
  line-height: 1.6;
}

/* 🎥 Background Video */
#myVideo {
  position: fixed;
  object-fit: cover;
  right: 0;
  bottom: 0;
  min-width: 100%;
  min-height: 100%;
  z-index: -2;
  filter: grayscale(50%) sepia(10%) brightness(0.7);
}

.video-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(30, 41, 59, 0.5);
  z-index: -1;
  backdrop-filter: blur(4px);
}

.continent {
  max-width: 1400px;
  min-height: 100vh;
  margin: 0 auto;
  padding: var(--space-4);
}

.all-content {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  min-height: 95vh;
  padding: var(--space-5) var(--space-4);
  gap: var(--space-6);
  position: relative;
  z-index: 1;
}

/* ========================================
   📱 PAGE HEADER - SEO H1
   ======================================== */

.page-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto var(--space-6);
  padding: var(--space-5) var(--space-4);
  background: linear-gradient(135deg,
    rgba(99, 102, 241, 0.1),
    rgba(139, 92, 246, 0.1)
  );
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg), var(--glow-primary);
  animation: fadeInDown 0.6s var(--transition-base);
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg,
    var(--primary-indigo),
    var(--primary-purple),
    var(--accent-cyan)
  );
  opacity: 0.8;
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  background: linear-gradient(135deg,
    var(--primary-indigo),
    var(--primary-purple),
    var(--accent-cyan)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-4);
  letter-spacing: -0.03em;
  line-height: 1.2;
  text-shadow: none;
  filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.3));
}

.page-subtitle {
  font-family: var(--font-display); /* Space Grotesk font */
  font-style: italic;
  font-size: clamp(0.875rem, 2vw, 1.125rem); /* Smaller on mobile */
  color: var(--text-secondary);
  font-weight: 400; /* Lighter weight for italic */
  line-height: 1.5; /* Tighter for mobile */
  letter-spacing: 0.01em; /* Subtle spacing for elegance */
  max-width: 85%; /* Slightly narrower for better line length */
  margin: 0 auto;
  opacity: 0.92; /* Subtle transparency */
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); /* Deeper shadow */
}

/* ========================================
   🔘 BUTTONS - Modern & Accessible
   ======================================== */

button {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(16px);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-lg);
  font-family: var(--font-base);
  font-weight: 600;
  font-size: clamp(0.875rem, 1.5vw, 0.9375rem);
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all var(--transition-base);
  min-width: 140px;
  min-height: 48px; /* Touch target */
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left var(--transition-slow);
}

button:hover::before {
  left: 100%;
}

button:hover {
  background: var(--glass-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--glow-primary);
  border-color: rgba(99, 102, 241, 0.4);
}

button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-md);
}

button:focus-visible {
  outline: 3px solid var(--primary-indigo);
  outline-offset: 2px;
}

button.ghost {
  background: transparent;
  border: 2px solid var(--glass-border);
  backdrop-filter: blur(8px);
}

button.ghost:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--primary-purple);
  box-shadow: var(--shadow-md), var(--glow-primary);
}

/* ========================================
   🎲 GENERATOR BUTTONS - Mobile Optimized
   ======================================== */

   
/* In-form generator (Mobile & Desktop) */
.container-generator-in-form {
  display: flex;
  flex-direction: row;
  gap: var(--space-3);
  width: 100%;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.generate-btn {
  background: linear-gradient(135deg,
    rgba(139, 92, 246, 0.3),
    rgba(245, 158, 11, 0.3)
  );
  border: 2px solid rgba(139, 92, 246, 0.5);
  color: #fbbf24;
  font-size: clamp(0.75rem, 1.8vw, 0.875rem);
  padding: var(--space-3) var(--space-4);
  flex: 1 1 calc(50% - var(--space-2));
  min-width: 140px;
  white-space: normal;
  line-height: 1.3;
  text-align: center;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
}

.generate-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.generate-btn:hover::before {
  left: 100%;
}

.generate-btn:hover {
  background: linear-gradient(135deg,
    rgba(139, 92, 246, 0.5),
    rgba(245, 158, 11, 0.5)
  );
  border-color: var(--gold-light);
  box-shadow:
    var(--shadow-lg),
    0 0 20px rgba(139, 92, 246, 0.5),
    0 0 30px rgba(245, 158, 11, 0.4);
  transform: translateY(-2px) scale(1.02);
  color: #ffffff;
}

.generate-btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow: var(--shadow-sm);
}

/* Highlighted Generated Text */
.randomized-highlighted {
  text-align: center;
  margin: var(--space-2) 0;
  letter-spacing: 0.02em;
  color: var(--gold-light);
  font-weight: 600;
  font-size: clamp(0.875rem, 2vw, 1rem);
  text-shadow: var(--glow-gold);
  min-height: 1.5rem;
  animation: fadeIn 0.3s var(--transition-base);
}

/* ========================================
   📦 MAIN CONTAINER - Mobile First
   ======================================== */

.container {
  width: 100%;
  max-width: 440px;
  position: relative;
  isolation: isolate;
  contain: layout style paint;
}

/* MOBILE LAYOUT (Default - 320px+) */
.form-container {
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-indigo) transparent;
}

/* Mobile-only visual styles (< 768px) */
@media (max-width: 767px) {
  .form-container {
    background: var(--glass-bg-strong);
    backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-2xl);
    padding: var(--space-5) var(--space-4);
    box-shadow: var(--shadow-xl);
    max-height: 90vh;
    margin-bottom: var(--space-4);
    animation: fadeInUp 0.5s var(--transition-base);
    contain: layout style;
  }
}

/* Custom scrollbar for form containers */
.form-container::-webkit-scrollbar {
  width: 6px;
}

.form-container::-webkit-scrollbar-track {
  background: transparent;
}

.form-container::-webkit-scrollbar-thumb {
  background: var(--primary-indigo);
  border-radius: 10px;
}

.form-container::-webkit-scrollbar-thumb:hover {
  background: var(--primary-purple);
}

/* Default: Show LOGIN, Hide REGISTRATION */
.sign-in-container {
  display: block;
  opacity: 1;
  visibility: visible;
}

.sign-up-container {
  display: none;
  opacity: 0;
  visibility: hidden;
  position: absolute;
  pointer-events: none;
}

/* When toggled to registration */
.container.right-panel-active .sign-in-container {
  display: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.container.right-panel-active .sign-up-container {
  display: block;
  opacity: 1;
  visibility: visible;
  position: relative;
  pointer-events: auto;
}

/* Hide overlay completely on mobile */
.overlay-container {
  display: none;
}

/* Mobile toggle buttons */
.mobile-toggle-btn {
  display: block;
  margin-top: var(--space-5);
  background: transparent;
  border: 2px solid var(--accent-cyan);
  color: var(--accent-cyan);
  font-size: 0.9375rem;
  padding: var(--space-3) var(--space-5);
  min-width: auto;
  width: 100%;
}

.mobile-toggle-btn:hover {
  background: rgba(6, 182, 212, 0.15);
  box-shadow: var(--shadow-md), var(--glow-accent);
  transform: none;
}

/* ========================================
   📝 FORM STYLES
   ======================================== */

form {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  width: 100%;
  gap: var(--space-2);
  padding: 0;
  max-width: 100%;
}

.form-group {
  width: 100%;
  margin-bottom: var(--space-1);
}

/* Main Form Heading */
.main-title {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3.5vw, 1.75rem);
  font-weight: 700;
  color: var(--primary-indigo);
  margin-bottom: var(--space-4);
  margin-top: var(--space-2);
  text-shadow: var(--glow-primary);
  letter-spacing: -0.01em;
  align-self: center;
}

/* Logo */
.logo {
  width: clamp(80px, 20vw, 120px);
  height: auto;
  cursor: pointer;
  transition: transform var(--transition-slow);
  filter: drop-shadow(0 0 16px rgba(245, 158, 11, 0.4));
  margin-bottom: var(--space-4);
}

.logo:hover {
  transform: scale(1.1) rotate(3deg);
  filter: drop-shadow(0 0 24px rgba(245, 158, 11, 0.6));
}

/* Input Fields */
input,
select {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  margin: var(--space-1) 0;
  width: 100%;
  color: var(--text-primary);
  font-family: var(--font-base);
  font-size: clamp(0.875rem, 2vw, 0.9375rem);
  transition: all var(--transition-base);
  min-height: 44px;
}

input::placeholder {
  color: var(--text-tertiary);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary-indigo);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15), var(--glow-primary);
  background: rgba(255, 255, 255, 0.12);
}

input:hover,
select:hover {
  border-color: rgba(99, 102, 241, 0.3);
}

/* Gender Select */
#gender-select {
  cursor: pointer;
}

#gender-select option {
  background-color: #1e293b;
  color: var(--text-primary);
  padding: var(--space-3);
}

/* Submit Buttons */
#submitButtonReg,
#submitButtonLog {
  margin-top: var(--space-3);
  background: var(--gradient-primary);
  border: none;
  font-size: clamp(0.875rem, 2vw, 0.9375rem);
  font-weight: 700;
  padding: var(--space-3) var(--space-5);
  width: 100%;
  box-shadow: var(--shadow-lg);
  min-height: 44px;
}

#submitButtonReg:hover,
#submitButtonLog:hover {
  background: linear-gradient(135deg, #7c7df7, #9f84f8);
  box-shadow: var(--shadow-xl), var(--glow-primary);
}

/* Forgot Password Link */
a.forgot-password {
  color: var(--gold-light);
  font-size: 0.9375rem;
  text-decoration: none;
  margin: var(--space-4) 0;
  transition: all var(--transition-base);
  display: inline-block;
}

a.forgot-password:hover {
  color: var(--gold-primary);
  text-shadow: var(--glow-gold);
  text-decoration: underline;
}

/* Error Messages */
span[id$="-error"] {
  color: #f87171;
  font-size: 0.875rem;
  display: block;
  margin-top: var(--space-1);
  font-weight: 500;
}

/* Password input with eye icon toggle (login/register) */
.password-input-reglog {
  position: relative;
  width: 100%;
}

.password-input-reglog input {
  padding-right: 3rem;
}

.password-input-reglog .eye-icon {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  cursor: pointer;
  font-size: 1.25rem;
  user-select: none;
  transition: all var(--transition-fast);
  /* Larger touch target for mobile */
  padding: 0 var(--space-4);
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.85);
  /* Nice touch feedback */
  -webkit-tap-highlight-color: transparent;
  border-radius: var(--radius-lg);
}

/* Touch feedback only for touch devices */
@media (hover: none) {
  .password-input-reglog .eye-icon:active {
    background: rgba(99, 102, 241, 0.15);
  }
}

/* Hover glow effect for desktop */
@media (hover: hover) {
  .password-input-reglog .eye-icon:hover {
    background: rgba(99, 102, 241, 0.1);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
  }
}

.password-input-reglog .eye-icon.visible {
  transform: scale(1.2);
}

/* Password input with eye icon toggle (password reset modal) */
.password-input-wrapper {
  position: relative;
  width: 100%;
  margin: var(--space-3) 0;
}

.password-input-wrapper input {
  width: 97%;
  padding-right: 3rem;
}

.password-input-wrapper .eye-icon {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  cursor: pointer;
  font-size: 1.25rem;
  user-select: none;
  transition: all var(--transition-fast);
  /* Larger touch target for mobile */
  padding: 0 var(--space-4);
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.85);
  /* Nice touch feedback */
  -webkit-tap-highlight-color: transparent;
  border-radius: var(--radius-lg);
}

/* Touch feedback only for touch devices */
@media (hover: none) {
  .password-input-wrapper .eye-icon:active {
    background: rgba(99, 102, 241, 0.15);
  }
}

/* Hover glow effect for desktop */
@media (hover: hover) {
  .password-input-wrapper .eye-icon:hover {
    background: rgba(99, 102, 241, 0.1);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
  }
}

.password-input-wrapper .eye-icon.visible {
  transform: scale(1.2);
}

/* ========================================
   💻 TABLET & DESKTOP (768px+)
   ======================================== */

@media (min-width: 768px) {
  .container {
    max-width: 900px;
    display: flex;
    min-height: 600px;
    border-radius: var(--radius-2xl);
    overflow: hidden;
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-xl);
  }

  /* Desktop form containers */
  .form-container {
    position: absolute;
    top: 0;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease 0.1s;
    display: flex !important;
    will-change: transform, opacity;
  }

  /* Remove backdrop-filter from nested elements to prevent blur stacking */
  .sign-in-container input,
  .sign-in-container select,
  .sign-in-container button,
  .sign-up-container input,
  .sign-up-container select,
  .sign-up-container button {
    backdrop-filter: none;
  }

  /* Sign-In Container */
  .sign-in-container {
    left: 0;
    width: 50%;
    height: 100%;
    padding: var(--space-5) var(--space-4);
    box-sizing: border-box;
    z-index: 2;
    opacity: 1;
    transform: translateX(0);
  }

  .container.right-panel-active .sign-in-container {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s ease;
  }

  /* Sign-Up Container */
  .sign-up-container {
    left: 0;
    width: 50%;
    height: 100%;
    padding: var(--space-5) var(--space-4);
    box-sizing: border-box;
    opacity: 0;
    z-index: 1;
    pointer-events: none;
    transform: translateX(0);
  }

  .container.right-panel-active .sign-up-container {
    transform: translateX(100%);
    opacity: 1;
    z-index: 5;
    pointer-events: auto;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease 0.2s;
  }

  /* Hide mobile toggle buttons */
  .mobile-toggle-btn {
    display: none !important;
  }

  /* Show overlay on desktop */
  .overlay-container {
    display: block;
    position: absolute;
    top: 0;
    left: 50%;
    width: 50%;
    height: 100%;
    overflow: hidden;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 3;
  }

  .container.right-panel-active .overlay-container {
    transform: translateX(-100%);
  }

  /* Overlay */
  .overlay {
    background: var(--gradient-primary);
    position: relative;
    left: -100%;
    height: 100%;
    width: 200%;
    transform: translateX(0);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .container.right-panel-active .overlay {
    transform: translateX(50%);
  }

  /* Overlay Panels */
  .overlay-panel {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: var(--space-6);
    text-align: center;
    top: 0;
    height: 100%;
    width: 50%;
    transform: translateX(0);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Overlay Left */
  .overlay-left {
    left: 0;
    transform: translateX(-20%);
    opacity: 0;
    pointer-events: none;
  }

  .container.right-panel-active .overlay-left {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  /* Overlay Right */
  .overlay-right {
    right: 0;
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .container.right-panel-active .overlay-right {
    transform: translateX(20%);
    opacity: 0;
    pointer-events: none;
  }

  /* Overlay Text */
  .overlay-h2 {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    font-weight: 700;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.3);
    margin-bottom: var(--space-4);
  }

  .overlay-p {
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
    margin: var(--space-4) 0;
    color: rgba(255, 255, 255, 0.9);
  }

  .randomized {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    margin: var(--space-2) 0;
  }

  /* Wider inputs on desktop */
  input,
  select {
    width: 85%;
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
  }

  .password-input-reglog {
    width: 85%;
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
  }

  .password-input-reglog input {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  /* Keep modal inputs at their base width */
  dialog.modal .password-input-wrapper input {
    width: 97%;
  }

  .form-group {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
}

/* ========================================
   🖥️ LARGE DESKTOP (1024px+)
   ======================================== */

@media (min-width: 1024px) {
  .all-content {
    padding: var(--space-8) var(--space-6);
  }

  input,
  select {
    width: 80%;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
  }

  .password-input-reglog {
    width: 80%;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
  }

  .password-input-reglog input {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  /* Keep modal inputs at their base width */
  dialog.modal .password-input-wrapper input {
    width: 97%;
  }

  .form-group {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
}

/* ========================================
   🎨 MODAL STYLES
   ======================================== */

/* Native dialog styling - don't use display:none, let browser handle it */
dialog.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  padding: 0;
  background: transparent;
  max-width: 100%;
  max-height: 100%;
}

/* Backdrop for modal dialogs */
dialog.modal::backdrop {
  background-color: rgba(0, 0, 0, 0.7);
   backdrop-filter: blur(12px); 
}

dialog.modal .modal-content {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(32px);
  border: 1px solid var(--glass-border);
  position: relative;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(300px, 90vw, 500px);
  max-width: 95vw;
  max-height: 90vh;
  padding: var(--space-8) var(--space-6);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  /* Animation conflicts with var(--transition-base) */
   animation: slideIn 0.4s;
  overflow-y: auto;
}

.modal-content h2,
.modal-content h3 {
  font-family: var(--font-display);
  color: var(--primary-indigo);
  margin-bottom: var(--space-4);
  text-shadow: var(--glow-primary);
  font-size: clamp(1.25rem, 3vw, 1.75rem);
}

.modal-content p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-4);
}

/* Close Modal Button */
#close-modal,
.modal-close-btn {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  color: var(--gold-light);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  width: auto;
  min-width: auto;
  min-height: auto;
  padding: var(--space-2);
  transition: all var(--transition-base);
  border-radius: var(--radius-md);
}

#close-modal:hover,
.modal-close-btn:hover {
  transform: scale(1.2) rotate(90deg);
  color: var(--gold-primary);
  background: rgba(245, 158, 11, 0.1);
}

/* Centered Input */
.centered-input {
  text-align: center;
  width: 100% !important;
}

.button-container {
  margin-top: var(--space-5);
}

/* Feedback Modal */
.feedback-modal .modal-content {
  text-align: center;
  padding: var(--space-8);
}

.feedback-icon-container {
  font-size: clamp(3rem, 10vw, 5rem);
  margin-bottom: var(--space-5);
  animation: bounceIn 0.6s var(--transition-base);
}

.feedback-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin-bottom: var(--space-4);
  background: linear-gradient(135deg,
    var(--primary-indigo),
    var(--primary-purple)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.feedback-message {
  font-size: clamp(1rem, 2.5vw, 1.125rem);
  line-height: 1.6;
  margin-bottom: var(--space-5);
}

.feedback-countdown {
  margin-top: var(--space-5);
  padding: var(--space-3);
  background: linear-gradient(135deg,
    rgba(139, 92, 246, 0.15),
    rgba(99, 102, 241, 0.15)
  );
  border-radius: var(--radius-lg);
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.feedback-countdown p {
  color: var(--text-primary);
  margin: 0;
  font-size: clamp(0.9rem, 2vw, 1rem);
}

.feedback-countdown #countdown-seconds {
  font-weight: 800;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  color: var(--gold-primary);
  display: inline-block;
  animation: pulse 1s ease-in-out infinite;
}

.feedback-btn {
  background: var(--gradient-primary);
  border: none;
  padding: var(--space-4) var(--space-6);
  font-weight: 700;
}

/* Mobile/Tablet Modal Optimizations */
@media (max-width: 1023px) {
  .feedback-modal .modal-content {
    padding: var(--space-6) var(--space-5);
  }

  .feedback-icon-container {
    font-size: clamp(2.5rem, 12vw, 4rem);
    margin-bottom: var(--space-4);
  }

  .feedback-title {
    font-size: clamp(1.25rem, 5vw, 1.75rem);
    margin-bottom: var(--space-3);
  }

  .feedback-message {
    font-size: clamp(0.9rem, 3vw, 1rem);
    margin-bottom: var(--space-4);
  }

  .feedback-countdown {
    padding: var(--space-2);
    margin-top: var(--space-4);
  }

  .feedback-countdown p {
    font-size: 0.875rem;
  }

  .feedback-countdown #countdown-seconds {
    font-size: 2rem;
  }
}

.password-strength-container {
  width: 100%;
  margin: var(--space-4) 0;
  min-height: 40px;
}

.strength-bar {
  height: 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-base);
  margin-bottom: var(--space-2);
  box-shadow: var(--shadow-sm);
}

.strength-text {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.error-message {
  color: #f87171;
  margin-top: var(--space-4);
  padding: var(--space-4);
  background: rgba(248, 113, 113, 0.15);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
  border: 1px solid rgba(248, 113, 113, 0.3);
  font-size: 0.9375rem;
}

/* ========================================
   🎬 LOADING OVERLAY WITH LOTTIE
   ======================================== */

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg,
    rgba(20, 20, 30, 0.98),
    rgba(30, 30, 50, 0.98)
  );
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease-out;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-4);
}

.loading-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  background: linear-gradient(135deg,
    var(--primary-indigo),
    var(--primary-purple),
    var(--accent-cyan)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
  animation: pulse 2s ease-in-out infinite;
}

.loading-message {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--text-secondary);
  margin: 0;
  opacity: 0.9;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* ========================================
   ✨ ANIMATIONS
   ======================================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    transform: translate(-50%, -60%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%);
    opacity: 1;
  }
}

@keyframes bounceIn {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ========================================
   ♿ ACCESSIBILITY
   ======================================== */

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 3px solid var(--primary-indigo);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.3);
  }

  button,
  input,
  select {
    border-width: 2px;
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-indigo);
  border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-purple);
}

/* ========================================
   📱 LANDSCAPE MODE - Mobile & Tablet
   Smooth, Non-Overlapping Breakpoints
   ======================================== */

/* CSS Custom Properties for Landscape Scaling */
:root {
  --landscape-scale: 1;
  --landscape-input-height: 44px;
  --landscape-button-height: 48px;
  --landscape-title-size: clamp(1.25rem, 3.5vw, 1.75rem);
  --landscape-input-font: clamp(0.875rem, 2vw, 0.9375rem);
}

/* TIER 1: Moderate Landscape (501px - 600px height) - MOBILE ONLY */
@media (max-width: 767px) and (min-height: 501px) and (max-height: 600px) and (orientation: landscape) {
  :root {
    --landscape-scale: 0.9;
    --landscape-input-height: 40px;
    --landscape-button-height: 44px;
  }

  .all-content {
    padding: var(--space-3) var(--space-4);
    gap: var(--space-3);
    min-height: auto;
  }

  .page-header {
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-3);
  }

  .page-title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: var(--space-2);
  }

  .page-subtitle {
    font-size: clamp(0.75rem, 1.8vw, 0.9375rem);
  }

  .form-container {
    max-height: none;
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    overflow-y: auto;
    scrollbar-width: thin;
  }

  form { gap: var(--space-1); }
  .form-group { margin-bottom: 0; }

  input, select {
    padding: var(--space-2);
    margin: var(--space-1) 0;
    min-height: var(--landscape-input-height);
    font-size: 0.875rem;
  }

  button {
    padding: var(--space-2) var(--space-4);
    min-height: var(--landscape-button-height);
    font-size: 0.875rem;
  }

  .generate-btn {
    padding: var(--space-2) var(--space-3);
    font-size: 0.75rem;
  }

  .mobile-toggle-btn {
    margin-top: var(--space-3);
    padding: var(--space-2) var(--space-4);
  }

  .main-title {
    font-size: clamp(1.125rem, 3vw, 1.5rem);
    margin-bottom: var(--space-3);
    margin-top: 0;
  }

  .logo {
    width: clamp(60px, 15vw, 90px);
    margin-bottom: var(--space-3);
  }

  a.forgot-password {
    margin: var(--space-2) 0;
    font-size: 0.875rem;
  }

  .container-generator-in-form {
    margin-bottom: var(--space-3);
    gap: var(--space-2);
  }

  #submitButtonReg,
  #submitButtonLog {
    margin-top: var(--space-2);
    padding: var(--space-2) var(--space-4);
    min-height: var(--landscape-button-height);
    font-size: 0.875rem;
  }
}

/* TIER 2: Compact Landscape (351px - 500px height) - MOBILE ONLY */
@media (max-width: 767px) and (min-height: 351px) and (max-height: 500px) and (orientation: landscape) {
  :root {
    --landscape-scale: 0.8;
    --landscape-input-height: 36px;
    --landscape-button-height: 38px;
  }

  .page-subtitle { display: none; }

  .all-content {
    padding: var(--space-2) var(--space-3);
    gap: var(--space-2);
  }

  .page-header {
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-2);
  }

  .page-title {
    font-size: 1.25rem;
    margin-bottom: 0;
  }

  .form-container {
    padding: var(--space-3) var(--space-4);
    max-height: 82vh;
    overflow-y: auto;
  }

  form { gap: var(--space-1); }
  .form-group { margin-bottom: 0; }

  input, select {
    min-height: var(--landscape-input-height);
    padding: var(--space-2) var(--space-3);
    font-size: 0.8125rem;
    margin: var(--space-1) 0;
  }

  button {
    min-height: var(--landscape-button-height);
    padding: var(--space-2) var(--space-3);
    font-size: 0.8125rem;
  }

  .generate-btn {
    padding: var(--space-1) var(--space-2);
    font-size: 0.7rem;
    flex: 1 1 100%;
  }

  .mobile-toggle-btn {
    margin-top: var(--space-2);
    padding: var(--space-2) var(--space-3);
  }

  .main-title {
    font-size: 1rem;
    margin-bottom: var(--space-2);
    margin-top: 0;
  }

  .logo {
    width: 60px;
    margin-bottom: var(--space-2);
  }

  a.forgot-password {
    margin: var(--space-1) 0;
    font-size: 0.75rem;
  }

  .container-generator-in-form {
    margin-bottom: var(--space-2);
    gap: var(--space-1);
  }

  #submitButtonReg,
  #submitButtonLog {
    margin-top: var(--space-2);
    padding: var(--space-2) var(--space-3);
    min-height: var(--landscape-button-height);
    font-size: 0.8125rem;
  }
}

/* TIER 3: Ultra-Compact Landscape (≤350px height) - MOBILE ONLY */
@media (max-width: 767px) and (max-height: 350px) and (orientation: landscape) {
  :root {
    --landscape-scale: 0.7;
    --landscape-input-height: 32px;
    --landscape-button-height: 32px;
  }

  .page-subtitle { display: none; }

  .all-content {
    padding: var(--space-1) var(--space-2);
    gap: var(--space-1);
  }

  .page-header {
    padding: var(--space-1) var(--space-2);
    margin-bottom: var(--space-1);
  }

  .page-title {
    font-size: 1rem;
    margin-bottom: 0;
  }

  .form-container {
    padding: var(--space-2) var(--space-3);
    max-height: 80vh;
    overflow-y: auto;
  }

  form { gap: 0; }
  .form-group { margin-bottom: 0; }

  input, select, button {
    min-height: var(--landscape-input-height);
    padding: var(--space-1) var(--space-2);
    font-size: 0.75rem;
    margin: var(--space-1) 0;
  }

  .generate-btn {
    padding: var(--space-1);
    font-size: 0.65rem;
    flex: 1 1 100%;
  }

  .mobile-toggle-btn {
    margin-top: var(--space-1);
    padding: var(--space-1) var(--space-2);
  }

  .main-title {
    font-size: 0.9rem;
    margin-bottom: var(--space-1);
    margin-top: 0;
  }

  .logo {
    width: 50px;
    margin-bottom: var(--space-1);
  }

  a.forgot-password {
    margin: var(--space-1) 0;
    font-size: 0.7rem;
  }

  .container-generator-in-form {
    margin-bottom: var(--space-1);
    gap: var(--space-1);
  }

  #submitButtonReg,
  #submitButtonLog {
    margin-top: var(--space-1);
    padding: var(--space-1) var(--space-2);
    min-height: var(--landscape-button-height);
    font-size: 0.75rem;
  }
}

/* ========================================
   💻 DESKTOP LANDSCAPE MODE (≥768px width)
   Fixes backdrop-filter conflicts
   ======================================== */

/* Desktop Landscape: Moderate Height (451px - 600px) */
@media (min-width: 768px) and (min-height: 451px) and (max-height: 600px) and (orientation: landscape) {
  .container {
    min-height: 500px;
  }

  /* Ensure no blur conflicts - desktop uses .container blur, not .form-container */
  .form-container {
    backdrop-filter: none !important;
    background: transparent;
  }

  .all-content {
    padding: var(--space-4) var(--space-5);
    gap: var(--space-4);
  }

  .page-header {
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
  }

  .page-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
  }

  .overlay-panel {
    padding: var(--space-4);
  }

  .overlay-h2 {
    font-size: clamp(1.25rem, 2vw, 1.5rem);
    margin-bottom: var(--space-3);
  }

  .overlay-p {
    font-size: 0.9375rem;
    margin: var(--space-3) 0;
  }

  input, select {
    min-height: 40px;
    font-size: 0.875rem;
    padding: var(--space-2) var(--space-3);
  }

  button {
    min-height: 42px;
    padding: var(--space-2) var(--space-4);
    font-size: 0.875rem;
  }
}

/* Desktop Landscape: Compact Height (≤450px) */
@media (min-width: 768px) and (max-height: 450px) and (orientation: landscape) {
  .page-subtitle { display: none; }

  .container {
    min-height: 400px;
  }

  /* Ensure no blur conflicts */
  .form-container {
    backdrop-filter: none !important;
    background: transparent;
  }

  .all-content {
    padding: var(--space-3) var(--space-4);
    gap: var(--space-3);
  }

  .page-header {
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-3);
  }

  .page-title {
    font-size: 1.25rem;
    margin-bottom: 0;
  }

  .overlay-panel {
    padding: var(--space-3);
  }

  .overlay-h2 {
    font-size: 1.125rem;
    margin-bottom: var(--space-2);
  }

  .overlay-p {
    font-size: 0.875rem;
    margin: var(--space-2) 0;
  }

  .randomized {
    font-size: 0.75rem;
  }

  input, select {
    min-height: 36px;
    font-size: 0.8125rem;
    padding: var(--space-2);
  }

  button {
    min-height: 38px;
    padding: var(--space-2) var(--space-3);
    font-size: 0.8125rem;
  }

  .main-title {
    font-size: 1rem;
    margin-bottom: var(--space-2);
  }

  .logo {
    width: 70px;
    margin-bottom: var(--space-2);
  }

  .generate-btn {
    padding: var(--space-1) var(--space-2);
    font-size: 0.7rem;
  }

  #submitButtonReg,
  #submitButtonLog {
    margin-top: var(--space-2);
    min-height: 38px;
  }
}

/* ========================================
   📱 EXTRA SMALL DEVICES (320px-479px)
   ======================================== */

@media (max-width: 479px) {
  .continent {
    padding: var(--space-2);
  }

  .all-content {
    padding: var(--space-4) var(--space-2);
  }

  .form-container {
    padding: var(--space-5) var(--space-4);
    border-radius: var(--radius-xl);
  }

  .page-title {
    font-size: 1.5rem;
  }

  .container-generator-in-form {
    flex-direction: column;
    gap: var(--space-2);
  }

  .generate-btn {
    flex: 1 1 100%;
    min-width: 100%;
    font-size: 0.75rem;
    padding: var(--space-2) var(--space-3);
  }
}
