/* ============================================================
   STEMacademy — Auth Pages Stylesheet
   login.html & signup.html
   Matches: Nunito + Plus Jakarta Sans · Blue/Orange/Purple/Green
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900;1000&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg-primary);
  color: var(--text-secondary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button { font-family: 'Plus Jakarta Sans', sans-serif; cursor: pointer; }
h1,h2,h3,h4,h5,h6 { line-height: 1.2; color: var(--text-primary); font-family: 'Nunito', sans-serif; }

/* ===== CSS VARIABLES — LIGHT ===== */
:root,
[data-theme="light"] {
  --bg-primary:      #FAFBFF;
  --bg-secondary:    #EFF3FF;
  --bg-card:         #FFFFFF;
  --bg-elevated:     #E4EAFF;

  --blue:            #2563EB;
  --blue-light:      rgba(37,99,235,0.10);
  --blue-mid:        rgba(37,99,235,0.20);
  --orange:          #F97316;
  --orange-light:    rgba(249,115,22,0.10);
  --green:           #16A34A;
  --green-light:     rgba(22,163,74,0.10);
  --purple:          #7C3AED;
  --purple-light:    rgba(124,58,237,0.10);

  --primary:         #2563EB;
  --primary-light:   rgba(37,99,235,0.10);
  --secondary:       #F97316;
  --secondary-light: rgba(249,115,22,0.10);
  --accent:          #7C3AED;
  --accent-light:    rgba(124,58,237,0.10);

  --text-primary:    #0D1B3E;
  --text-secondary:  #4B5677;
  --text-muted:      #8E9BBB;

  --border:          #DDE3F5;
  --border-hover:    #2563EB;

  --shadow-sm:       0 1px 4px rgba(37,99,235,0.06);
  --shadow-md:       0 6px 24px rgba(37,99,235,0.10);
  --shadow-lg:       0 16px 48px rgba(37,99,235,0.14);
  --shadow-glow:     0 0 32px rgba(37,99,235,0.25);

  --gradient-primary:   linear-gradient(135deg, #2563EB, #7C3AED);
  --gradient-secondary: linear-gradient(135deg, #F97316, #FB923C);
  --gradient-green:     linear-gradient(135deg, #16A34A, #22C55E);
  --gradient-warm:      linear-gradient(135deg, #F97316, #7C3AED);
  --gradient-hero:      linear-gradient(150deg, #EEF2FF 0%, #F0FDF4 50%, #FFF7ED 100%);

  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --radius-2xl: 40px;
  --radius-full: 9999px;

  --panel-bg: linear-gradient(150deg, #EEF2FF 0%, #F0FDF4 50%, #FFF7ED 100%);
  --input-bg: #F4F7FF;
  --input-border: #DDE3F5;
}

/* ===== CSS VARIABLES — DARK ===== */
[data-theme="dark"] {
  --bg-primary:      #060D1F;
  --bg-secondary:    #0C1529;
  --bg-card:         #111E35;
  --bg-elevated:     #172240;

  --blue:            #3B82F6;
  --blue-light:      rgba(59,130,246,0.12);
  --blue-mid:        rgba(59,130,246,0.22);
  --orange:          #FB923C;
  --orange-light:    rgba(251,146,60,0.12);
  --green:           #22C55E;
  --green-light:     rgba(34,197,94,0.12);
  --purple:          #A78BFA;
  --purple-light:    rgba(167,139,250,0.12);

  --primary:         #3B82F6;
  --primary-light:   rgba(59,130,246,0.12);
  --secondary:       #FB923C;
  --secondary-light: rgba(251,146,60,0.12);
  --accent:          #A78BFA;
  --accent-light:    rgba(167,139,250,0.12);

  --text-primary:    #E8F0FF;
  --text-secondary:  #8E9BBB;
  --text-muted:      #4B5677;

  --border:          rgba(255,255,255,0.08);
  --border-hover:    #3B82F6;

  --shadow-sm:       0 1px 4px rgba(0,0,0,0.3);
  --shadow-md:       0 6px 24px rgba(0,0,0,0.4);
  --shadow-lg:       0 16px 48px rgba(0,0,0,0.5);
  --shadow-glow:     0 0 32px rgba(59,130,246,0.28);

  --gradient-primary:   linear-gradient(135deg, #3B82F6, #A78BFA);
  --gradient-secondary: linear-gradient(135deg, #FB923C, #FCD34D);
  --gradient-green:     linear-gradient(135deg, #22C55E, #4ADE80);
  --gradient-warm:      linear-gradient(135deg, #FB923C, #A78BFA);
  --gradient-hero:      linear-gradient(150deg, #060D1F 0%, #0C1529 100%);

  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --radius-2xl: 40px;
  --radius-full: 9999px;

  --panel-bg: linear-gradient(150deg, rgba(37,99,235,0.08) 0%, rgba(22,163,74,0.05) 50%, rgba(249,115,22,0.05) 100%);
  --input-bg: rgba(255,255,255,0.04);
  --input-border: rgba(255,255,255,0.10);
}

/* ===== RTL ===== */
[dir="rtl"] { text-align: right; }
[dir="rtl"] .auth-split { flex-direction: row-reverse; }
[dir="rtl"] .auth-panel-brand { direction: rtl; }
[dir="rtl"] .form-group input,
[dir="rtl"] .form-group select { direction: rtl; }
[dir="rtl"] .password-toggle { left: 14px; right: auto; }
[dir="rtl"] .check-label { flex-direction: row-reverse; }
[dir="rtl"] .social-btn-row { flex-direction: row-reverse; }
[dir="rtl"] .auth-header { flex-direction: row-reverse; }
[dir="rtl"] .logo { flex-direction: row-reverse; }

/* ============================================================
   LAYOUT — FULL PAGE SPLIT
   ============================================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.auth-split {
  flex: 1;
  display: flex;
  min-height: 100vh;
  justify-content: center; /* Center the form panel */
  align-items: center; /* Vertically center */
  padding: 40px 20px;
}

/* LEFT PANEL — decorative brand side (currently hidden in HTML) */
.auth-panel-brand {
  display: none; /* Forced hide since HTML comments it out */
}

/* FLOATING BADGE DECORATION */
.brand-badge-float {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  z-index: 3;
  pointer-events: none;
  animation: float 4s ease-in-out infinite;
}
.brand-badge-float.badge-top    { top: 38%; right: 24px; animation-delay: 0s; }
.brand-badge-float.badge-bottom { bottom: 22%; left: 24px; animation-delay: 1.5s; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}
.badge-icon-circle {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.badge-icon-circle.green  { background: var(--green-light);  color: var(--green); }
.badge-icon-circle.orange { background: var(--orange-light); color: var(--orange); }
.badge-text strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}
.badge-text span {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* RIGHT PANEL — form */
.auth-panel-form {
  width: 100%;
  max-width: 520px; /* Limit width */
  min-width: 320px;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 40px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-shrink: 0;
  background: var(--bg-primary);
}

.auth-header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.auth-header-logo .logo-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--gradient-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}
.auth-header-logo .logo-main {
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem; font-weight: 900;
  color: var(--text-primary);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.control-btn {
  height: 34px;
  padding: 0 12px;
  min-width: 34px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.73rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.control-btn:hover,
.control-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.auth-form-body {
  display: flex;
  flex-direction: column;
  padding: 40px;
  gap: 0;
}

/* ===== FORM TITLES ===== */
.auth-title {
  font-family: 'Nunito', sans-serif;
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.auth-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.auth-subtitle a {
  color: var(--primary);
  font-weight: 700;
}
.auth-subtitle a:hover { text-decoration: underline; }

/* ===== SOCIAL BUTTONS ===== */
.social-btn-row {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}
.social-btn {
  flex: 1;
  height: 44px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}
.social-btn:hover {
  border-color: var(--border-hover);
  background: var(--primary-light);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.social-btn svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
}

/* ===== DIVIDER ===== */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ===== FORM GROUPS ===== */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}
.form-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  inset-inline-start: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
  z-index: 1;
}
.input-icon svg { width: 16px; height: 16px; }

.form-group input,
.form-group select {
  width: 100%;
  height: 46px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0 14px;
  padding-inline-start: 42px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  outline: none;
  appearance: none;
}
.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.form-group input::placeholder { color: var(--text-muted); }
.form-group input.error { border-color: #EF4444; box-shadow: 0 0 0 3px rgba(239,68,68,0.12); }

.password-toggle {
  position: absolute;
  inset-inline-end: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 0;
  transition: color 0.2s;
  z-index: 1;
}
.password-toggle:hover { color: var(--primary); }
.password-toggle svg { width: 17px; height: 17px; }

/* password has icon on both sides */
.form-group input[type="password"],
.form-group input.password-input {
  padding-inline-end: 44px;
}

/* ===== PASSWORD STRENGTH ===== */
.strength-bar {
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--border);
  overflow: hidden;
  margin-top: 4px;
}
.strength-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.4s ease, background 0.4s ease;
  width: 0%;
}
.strength-label {
  font-size: 0.72rem;
  font-weight: 700;
  margin-top: 4px;
  color: var(--text-muted);
}

/* ===== CHECKBOX ===== */
.check-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
}
.check-group input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--primary);
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
}
.check-group label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1.5;
}
.check-group label a {
  color: var(--primary);
  font-weight: 700;
}
.check-group label a:hover { text-decoration: underline; }

/* ===== FORGOT LINK ===== */
.forgot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.forgot-link {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
}
.forgot-link:hover { text-decoration: underline; }

/* ===== SUBMIT BUTTON ===== */
.btn-auth {
  width: 100%;
  height: 50px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--gradient-primary);
  color: #fff;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s;
  box-shadow: 0 4px 16px rgba(37,99,235,0.28);
  margin-bottom: 20px;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
}
.btn-auth::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.2s;
}
.btn-auth:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(37,99,235,0.38);
}
.btn-auth:hover::after { background: rgba(255,255,255,0.06); }
.btn-auth:active { transform: translateY(0); }

.btn-auth svg { width: 18px; height: 18px; }

/* ===== ALTERNATE LINK ===== */
.auth-alt {
  text-align: center;
  font-size: 0.84rem;
  color: var(--text-muted);
}
.auth-alt a {
  color: var(--primary);
  font-weight: 700;
}
.auth-alt a:hover { text-decoration: underline; }

/* ===== FORM NOTICE ===== */
.form-notice {
  background: var(--blue-light);
  border: 1px solid var(--blue-mid);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.8rem;
  color: var(--primary);
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}
.form-notice svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }

/* ===== ERROR / SUCCESS MESSAGES ===== */
.field-error {
  font-size: 0.75rem;
  font-weight: 600;
  color: #EF4444;
  margin-top: 3px;
  display: none;
}
.field-error.visible { display: block; }

.form-success {
  background: var(--green-light);
  border: 1px solid rgba(22,163,74,0.25);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 0.85rem;
  color: var(--green);
  font-weight: 600;
  text-align: center;
  display: none;
}
.form-success.visible { display: block; }

/* ===== STEP INDICATOR (signup) ===== */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
}
.step-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  transition: all 0.3s;
  flex-shrink: 0;
}
.step-dot.active {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37,99,235,0.28);
}
.step-dot.done {
  background: var(--green-light);
  color: var(--green);
  border: 1.5px solid rgba(22,163,74,0.3);
}
.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  transition: background 0.3s;
}
.step-line.done { background: var(--green); }

.step-panel { display: none; }
.step-panel.active { display: block; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet: hide brand panel */
@media (max-width: 900px) {
  .auth-panel-brand { display: none; }
  .auth-panel-form {
    width: 100%;
    min-width: 0;
  }
  .auth-form-body { padding: 32px 32px; }
}

/* Mobile (Full Width approach with sticky header) */
@media (max-width: 600px) {
  .auth-split { 
    padding: 0; 
    align-items: stretch; /* stretch to full height */
  }
  
  .auth-panel-form { 
    border-radius: 0; /* flat edges on mobile */
    border: none;
    box-shadow: none;
    max-width: 100%;
    height: 100vh;
  }
  
  /* Make Header Sticky */
  .auth-header { 
    padding: 16px 20px; 
    position: sticky;
    top: 0;
    z-index: 100;
  }
  
  .auth-form-body { 
    padding: 24px 20px; 
    justify-content: flex-start; /* Let it scroll naturally */
  }
  
  .auth-title { font-size: 1.55rem; }
  .auth-subtitle { margin-bottom: 20px; font-size: 0.85rem; }
  
  /* Ensure social buttons are neat and uniform */
  .social-btn-row { 
    flex-direction: column; 
    gap: 12px; 
    margin-bottom: 24px; 
  }
  .social-btn { height: 48px; } /* Slightly taller for mobile touch targets */
  
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .form-group input, .form-group select { height: 48px; }
  .btn-auth { height: 50px; font-size: 0.95rem; margin-bottom: 16px; margin-top: 10px; }
}

@media (max-width: 380px) {
  .auth-form-body { padding: 20px 16px; }
  .auth-header { padding: 14px 16px; flex-wrap: wrap; justify-content: center; gap: 12px; }
  .header-controls { width: 100%; justify-content: center; }
  .auth-title { font-size: 1.45rem; text-align: center; }
  .auth-subtitle { text-align: center; }
}
