/* ============================================================
   AUTH.CSS — Shared styles for all 12 auth pages
   Login, Register, Forgot Password, Verify, Reset Password
   Responsive: Desktop | Tablet (≤1024px) | Mobile (≤768px)
   ============================================================ */

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

/* --- CSS Variables --- */
:root {
  --primary:        #6366f1;
  --primary-dark:   #4f46e5;
  --primary-light:  #e0e7ff;
  --primary-glow:   rgba(99, 102, 241, 0.18);
  --success:        #10b981;
  --danger:         #ef4444;
  --warning:        #f59e0b;
  --text-primary:   #0f172a;
  --text-secondary: #64748b;
  --text-muted:     #94a3b8;
  --surface:        #ffffff;
  --bg:             #f8fafc;
  --border:         #e2e8f0;
  --border-focus:   #a5b4fc;
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.12);
  --radius-sm:      8px;
  --radius-md:      12px;
  --radius-lg:      20px;
  --left-bg:        linear-gradient(145deg, #4f46e5 0%, #7c3aed 50%, #6366f1 100%);
}

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

html { font-size: 16px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   TWO-COLUMN LAYOUT
   ============================================================ */
.auth-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

/* --- LEFT PANEL (Branding) --- */
.auth-left {
  background: var(--left-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 50px;
  position: relative;
  overflow: hidden;
}

/* Decorative blobs on left panel */
.auth-left::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
  top: -100px; right: -100px;
}
.auth-left::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
  bottom: -80px; left: -80px;
}

.auth-left-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 380px;
}

.auth-brand-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 20px;
  margin-bottom: 24px;
  background: rgba(255,255,255,0.15);
  padding: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

/* --- Illustration (SVG from new ui/svg/) --- */
.auth-illustration {
  width: 220px;
  height: 220px;
  margin: 0 auto 32px;
  display: block;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.20));
}

.auth-brand-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.25;
  margin-bottom: 14px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.auth-brand-subtitle {
  font-size: 1rem;
  color: rgba(255,255,255,0.80);
  line-height: 1.6;
  margin-bottom: 36px;
}

.auth-brand-features {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

.auth-brand-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,0.90);
  font-size: 0.95rem;
  font-weight: 500;
}

.auth-brand-feature-icon {
  width: 38px; height: 38px;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.auth-brand-feature-icon svg {
  width: 18px; height: 18px;
  stroke: rgba(255,255,255,0.95);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- RIGHT PANEL (Form) --- */
.auth-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  background: var(--bg);
  overflow-y: auto;
}

/* --- AUTH CARD --- */
.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 48px 44px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  position: relative;
}

.auth-header {
  margin-bottom: 32px;
}

.auth-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.2;
}

.auth-header p {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* --- BACK LINK --- */
.auth-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 28px;
  transition: color 0.2s;
}

.auth-back-link:hover { color: var(--primary); }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 7px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
  -webkit-appearance: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Select arrow */
.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 42px;
  cursor: pointer;
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

/* Password wrapper */
.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.password-toggle:hover { color: var(--primary); }

/* Remember & Forgot row */
.remember-forgot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.remember-forgot label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 500;
}

.remember-forgot input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.forgot-link {
  font-size: 0.875rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.forgot-link:hover { color: var(--primary-dark); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-auth {
  width: 100%;
  padding: 13px 20px;
  background: var(--primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 14px rgba(99,102,241,0.35);
  letter-spacing: 0.01em;
}

.btn-auth:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99,102,241,0.45);
}

.btn-auth:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(99,102,241,0.25);
}

/* ============================================================
   FOOTER TEXT / LINKS
   ============================================================ */
.auth-footer-text {
  text-align: center;
  margin-top: 24px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.auth-footer-text a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

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

/* ============================================================
   VERIFICATION CODE INPUT
   ============================================================ */
.code-input {
  text-align: center;
  font-size: 2rem !important;
  font-weight: 700;
  letter-spacing: 0.5em;
  padding: 16px !important;
  border-radius: var(--radius-md) !important;
  background: var(--primary-light) !important;
  border-color: var(--border-focus) !important;
  color: var(--primary-dark) !important;
}

.code-input:focus {
  box-shadow: 0 0 0 3px var(--primary-glow) !important;
}

/* Code hint text */
.code-hint {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 10px;
}

/* Resend link */
.resend-link {
  display: block;
  text-align: center;
  margin-top: 18px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.resend-link a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

/* ============================================================
   ALERTS / FLASH MESSAGES (fallback if toasts fail)
   ============================================================ */
.auth-alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.auth-alert-success {
  background: #ecfdf5; border-color: #6ee7b7; color: #065f46;
}

.auth-alert-error {
  background: #fef2f2; border-color: #fca5a5; color: #991b1b;
}

.auth-alert-warning {
  background: #fffbeb; border-color: #fcd34d; color: #92400e;
}

/* ============================================================
   SECTION DIVIDER (used in register pages)
   ============================================================ */
.section-divider {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--primary);
  margin: 28px 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--primary-light);
}

/* ============================================================
   TABLET  (≤ 1024px)
   ============================================================ */
@media (max-width: 1024px) {
  .auth-layout {
    grid-template-columns: 1fr 1.2fr;
  }

  .auth-left {
    padding: 48px 36px;
  }

  .auth-brand-title { font-size: 1.5rem; }

  .auth-card {
    padding: 40px 36px;
    max-width: 420px;
  }
}

/* ============================================================
   MOBILE  (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
  .auth-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  /* Collapse left panel to a compact header strip */
  .auth-left {
    padding: 32px 24px 28px;
    min-height: unset;
  }

  .auth-left::before,
  .auth-left::after { display: none; }

  .auth-left-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    max-width: 100%;
  }

  .auth-brand-logo {
    width: 52px; height: 52px;
    margin-bottom: 0;
    padding: 8px;
    border-radius: 14px;
    flex-shrink: 0;
  }

  .auth-brand-title {
    font-size: 1.15rem;
    margin-bottom: 4px;
  }

  .auth-brand-subtitle {
    font-size: 0.82rem;
    margin-bottom: 0;
  }

  .auth-brand-features { display: none; }

  .auth-right {
    padding: 28px 16px 40px;
    align-items: flex-start;
  }

  .auth-card {
    padding: 32px 24px;
    border-radius: var(--radius-md);
    max-width: 100%;
    box-shadow: var(--shadow-sm);
  }

  .auth-header { margin-bottom: 24px; }
  .auth-header h1 { font-size: 1.4rem; }

  .form-group input,
  .form-group select {
    font-size: 16px; /* prevents iOS zoom */
  }

  .code-input { font-size: 1.6rem !important; letter-spacing: 0.4em; }
}

/* ============================================================
   SMALL MOBILE  (≤ 480px)
   ============================================================ */
@media (max-width: 480px) {
  .auth-card { padding: 28px 18px; }
  .auth-header h1 { font-size: 1.25rem; }
  .btn-auth { padding: 13px; font-size: 0.95rem; }
  .remember-forgot { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* ── Alert / Flash Messages ─────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert-success, .alert-info {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}
.alert-error, .alert-danger, .alert-warning {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}
.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border-color: #fde68a;
}
