/* =====================================================
   EduFlow — auth.css
   Split layout · Brand left · Forms right
   ===================================================== */

:root {
  /* Brand */
  --teal:          #0abfbc;
  --teal-dark:     #089a97;
  --teal-light:    #e0f8f8;
  --teal-mid:      #0d9e9b;

  /* Green CTA */
  --green:         #b8eac4;
  --green-text:    #2e7d52;
  --green-dark:    #a0d9ae;

  /* Greys */
  --grey-50:       #f9fafb;
  --grey-100:      #f3f4f6;
  --grey-200:      #e5e7eb;
  --grey-300:      #d1d5db;
  --grey-400:      #9ca3af;
  --grey-500:      #6b7280;
  --grey-700:      #374151;
  --grey-900:      #111827;

  /* Brand panel gradient */
  --brand-bg-start: #0d9e9b;
  --brand-bg-end:   #065f5e;

  /* Radii */
  --r-sm:   10px;
  --r-md:   14px;
  --r-lg:   20px;
  --r-xl:   26px;
  --r-full: 100px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.06);
  --shadow-teal:0 4px 20px rgba(10,191,188,0.25);

  /* Typography */
  --font-body:    'DM Sans', sans-serif;
  --font-display: 'Fraunces', serif;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t:    0.2s;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--grey-900);
  min-height: 100vh;
  display: flex;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ══════════════════════════════════════
   BRAND PANEL (left)
══════════════════════════════════════ */
.brand-panel {
  position: relative;
  width: 46%;
  min-height: 100vh;
  background: linear-gradient(145deg, var(--brand-bg-start) 0%, var(--brand-bg-end) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 40px 52px 52px;
  overflow: hidden;
  flex-shrink: 0;
}

/* Subtle noise texture overlay */
.brand-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

/* Soft radial glow top-right */
.brand-panel::after {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 440px; height: 440px;
  background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.brand-panel > * { position: relative; z-index: 1; }

/* Language selector — top left of brand panel */
.lang-selector {
  position: absolute;
  top: 28px; left: 44px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 2;
}

.lang-opt {
  background: transparent;
  border: none;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  padding: 4px 2px;
  transition: color var(--t) var(--ease);
}
.lang-opt:hover { color: rgba(255,255,255,0.9); }
.lang-opt.active { color: #fff; }

.lang-divider {
  color: rgba(255,255,255,0.25);
  font-size: 0.75rem;
  user-select: none;
}

/* ── Art SVG ── */
.brand-art {
  position: absolute;
  top: 50%;  left: 50%;
  transform: translate(-50%, -56%);
  width: min(420px, 90%);
  pointer-events: none;
  animation: floatArt 7s ease-in-out infinite;
}

.art-svg { width: 100%; height: auto; }

@keyframes floatArt {
  0%, 100% { transform: translate(-50%, -56%) translateY(0); }
  50%       { transform: translate(-50%, -56%) translateY(-12px); }
}

/* ── Brand copy ── */
.brand-copy { margin-top: auto; }

.brand-logo {
  /*display: flex;*/
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.brand-logo-mark {
  width: 150px; height: 150px;
  flex-shrink: 0;
}

.brand-logo-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 400;
  color: rgba(255,255,255,0.95);
  letter-spacing: -0.02em;
}
.brand-logo-name.dark { color: var(--grey-900); }

.brand-headline {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 2.8vw, 2.6rem);
  font-weight: 300;
  line-height: 1.18;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.brand-headline em {
  font-style: italic;
  color: rgba(255,255,255,0.7);
}

.brand-sub {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.6);
  line-height: 1.6;
  max-width: 340px;
  margin-bottom: 36px;
}

/* Trust row */
.trust-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

.trust-item { text-align: left; }
.trust-val {
  display: block;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 400;
  color: #fff;
  line-height: 1;
}
.trust-label {
  display: block;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.5);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.trust-sep {
  width: 1px;
  height: 32px;
  background: rgba(255,255,255,0.18);
}

/* ══════════════════════════════════════
   FORM PANEL (right)
══════════════════════════════════════ */
.form-panel {
  flex: 1;
  min-height: 100vh;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 48px 40px;
  overflow-y: auto;
}

/* Mobile header (hidden on desktop) */
.mobile-header {
  display: none;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

/* ── Auth views ── */
.auth-view {
  width: 100%;
  max-width: 400px;
  display: none;
  flex-direction: column;
  gap: 0;
  animation: viewIn 0.3s var(--ease) both;
}
.auth-view.active { display: flex; }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Form header */
.form-header { margin-bottom: 28px; }
.form-title {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 400;
  color: var(--grey-900);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 6px;
}
.form-sub { font-size: 0.875rem; color: var(--grey-400); line-height: 1.5; }

/* Back button */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none; border: none;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--grey-500);
  cursor: pointer;
  padding: 0;
  margin-bottom: 28px;
  transition: color var(--t) var(--ease);
}
.back-btn:hover { color: var(--teal); }

/* ── Fields ── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 20px;
}

.field-group { display: flex; flex-direction: column; gap: 6px; }

.field-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--grey-700);
  letter-spacing: 0.01em;
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.field-icon {
  position: absolute;
  left: 14px;
  color: var(--grey-400);
  font-size: 0.9rem;
  pointer-events: none;
  transition: color var(--t) var(--ease);
}

.field-input {
  width: 100%;
  height: 46px;
  padding: 0 44px 0 40px;
  border: 1.5px solid var(--grey-200);
  border-radius: var(--r-md);
  background: var(--grey-50);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--grey-900);
  outline: none;
  transition: all var(--t) var(--ease);
  appearance: none;
}

.field-input::placeholder { color: var(--grey-400); }

.field-input:focus {
  border-color: var(--teal);
  background: #fff;
  box-shadow: 0 0 0 3px var(--teal-light);
}
.field-input:focus ~ .field-icon,
.field-wrap:focus-within .field-icon { color: var(--teal); }

/* No left icon variants */
.field-wrap .field-input:only-child,
.field-wrap .field-input:not(:has(~ .field-icon)):first-child {
  padding-left: 14px;
}
/* Second input in a row (no icon) */
#reg-last { padding-left: 14px; }

/* Select */
.select-wrap .field-input { padding-right: 40px; cursor: pointer; }
.select-chevron {
  position: absolute;
  right: 14px;
  color: var(--grey-400);
  font-size: 0.75rem;
  pointer-events: none;
}

/* Eye toggle */
.field-eye {
  position: absolute;
  right: 12px;
  background: none; border: none;
  color: var(--grey-400);
  cursor: pointer;
  padding: 4px;
  font-size: 0.9rem;
  display: flex; align-items: center;
  transition: color var(--t) var(--ease);
}
.field-eye:hover { color: var(--grey-700); }

/* Two-col row */
.field-row { display: flex; align-items: center; }
.field-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Password strength ── */
.pw-strength { margin-top: 8px; display: flex; align-items: center; gap: 10px; }
.pw-strength-bar {
  flex: 1; height: 4px; background: var(--grey-200); border-radius: 100px; overflow: hidden;
}
.pw-strength-fill {
  height: 100%; border-radius: 100px; width: 0%;
  transition: width 0.4s var(--ease), background 0.4s var(--ease);
  background: var(--grey-300);
}
.pw-strength-fill.weak   { background: #ef4444; }
.pw-strength-fill.fair   { background: #f59e0b; }
.pw-strength-fill.good   { background: var(--teal); }
.pw-strength-fill.strong { background: #22c55e; }
.pw-strength-label { font-size: 0.7rem; color: var(--grey-400); white-space: nowrap; }

/* ── Checkbox ── */
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 0.83rem;
  color: var(--grey-600);
  line-height: 1.5;
}
.terms-label { margin-bottom: 2px; }
.checkbox-input { display: none; }
.checkbox-custom {
  width: 17px; height: 17px; min-width: 17px;
  border: 1.5px solid var(--grey-300);
  border-radius: 5px;
  background: var(--grey-50);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t) var(--ease);
  margin-top: 1px;
}
.checkbox-input:checked + .checkbox-custom {
  background: var(--teal);
  border-color: var(--teal);
}
.checkbox-input:checked + .checkbox-custom::after {
  content: '';
  width: 9px; height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}
.link-inline {
  color: var(--teal);
  text-decoration: none;
  font-weight: 500;
}
.link-inline:hover { text-decoration: underline; }

/* ── Buttons ── */
.btn-primary {
  width: 100%;
  height: 48px;
  border-radius: var(--r-md);
  border: none;
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dark) 100%);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all var(--t) var(--ease);
  box-shadow: var(--shadow-teal);
  letter-spacing: 0.01em;
  margin-top: 4px;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(10,191,188,0.35);
}
.btn-primary:active { transform: translateY(0); }

.btn-primary.outline {
  background: var(--green);
  color: var(--green-text);
  box-shadow: none;
}
.btn-primary.outline:hover {
  background: var(--green-dark);
  box-shadow: 0 4px 16px rgba(184,234,196,0.5);
}

.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--grey-200);
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--grey-700);
  cursor: pointer;
  transition: all var(--t) var(--ease);
}
.btn-ghost:hover { border-color: var(--teal); color: var(--teal); background: var(--teal-light); }

.link-btn {
  background: none; border: none;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--teal);
  cursor: pointer;
  padding: 0;
  transition: color var(--t) var(--ease);
}
.link-btn:hover { color: var(--teal-dark); }

/* ── Misc form elements ── */
.form-note {
  font-size: 0.76rem;
  color: var(--grey-400);
  text-align: center;
  line-height: 1.55;
  margin-top: -4px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
  color: var(--grey-400);
  font-size: 0.76rem;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--grey-200);
}

.auth-switch {
  margin-top: 24px;
  text-align: center;
  font-size: 0.84rem;
  color: var(--grey-500);
}

.error-msg {
  font-size: 0.78rem;
  color: #ef4444;
  text-align: center;
  min-height: 18px;
  margin-top: -8px;
}

/* ── Magic link sent state ── */
.magic-sent {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 0 8px;
  gap: 12px;
  animation: viewIn 0.35s var(--ease) both;
}
.magic-sent.visible { display: flex; }

.magic-sent-icon {
  width: 64px; height: 64px;
  border-radius: 20px;
  background: var(--teal-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  color: var(--teal-dark);
  margin-bottom: 4px;
}

.magic-sent-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--grey-900);
}

.magic-sent-body {
  font-size: 0.875rem;
  color: var(--grey-500);
  line-height: 1.6;
}
.magic-sent-body strong { color: var(--grey-900); }

/* ── Loading state on buttons ── */
.btn-primary.loading {
  pointer-events: none;
  opacity: 0.8;
}
.btn-primary.loading::after {
  content: '';
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════
   MOBILE LANG (dark variant)
══════════════════════════════════════ */
.lang-opt.dark { color: var(--grey-400); }
.lang-opt.dark:hover { color: var(--grey-900); }
.lang-opt.dark.active { color: var(--teal-dark); font-weight: 600; }
.lang-divider.dark { color: var(--grey-300); }
.mobile-lang { gap: 5px; }

/* ══════════════════════════════════════
   PAGE ENTRY ANIMATIONS
══════════════════════════════════════ */
.brand-panel { animation: slideInLeft 0.5s var(--ease) both; }
.form-panel  { animation: slideInRight 0.5s var(--ease) both; }

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 860px) {
  body { flex-direction: column; }

  .brand-panel {
    display: none; /* hidden on mobile — logo shown in form panel instead */
  }

  .form-panel {
    min-height: 100vh;
    padding: 32px 24px 48px;
    justify-content: flex-start;
  }

  .mobile-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 32px;
  }

  .auth-view { max-width: 100%; }
}

@media (max-width: 400px) {
  .field-row.two-col { grid-template-columns: 1fr; }
  .form-panel { padding: 24px 18px 40px; }
}
