:root {
  /* Breakpoints: mobile: <=480px | tablet: <=768px | small-desktop: <=1024px | wide: >=1440px */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --tap-min: 44px;
}

/* ── Shared auth page styles (signin) ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #cfd8e3;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5) var(--space-4);
  box-sizing: border-box;
  margin: 0;
}

/* Outer border used on sign-in */
.outer {
  padding: var(--space-2);
  border: 2px solid #2563eb;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 10px 35px rgba(0,0,0,0.12);
  width: 100%;
  max-width: 820px;
  margin: auto;
  box-sizing: border-box;
}

.card {
  display: flex;
  width: 100%;
  max-width: 820px;
  min-height: 500px;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 6px 32px rgba(0,0,0,0.13);
  margin: auto;
}

/* Sign-in card sits inside .outer so no shadow needed */
.outer .card {
  width: 100%;
  min-height: 520px;
  border-radius: 14px;
  box-shadow: none;
  margin: 0;
}

/* ── Left panel ── */
.left {
  flex: 1;
  background: #1a3a8c;
  border-radius: 14px;
  margin: var(--space-2);
  padding: var(--space-5) var(--space-6) var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #fff;
  min-height: 520px;
}

/* Logo + school name — row layout, pinned to the top */
.left-top {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
}

.left-logo {
  width: 52px;
  height: auto;
  flex-shrink: 0;
  object-fit: contain;
}

.left-school {
  font-size: 0.82rem;
  font-weight: 700;
  color: #c8d8f5;
  letter-spacing: 0.01em;
  line-height: 1.35;
  text-align: left;
}

/* Main text block — centered, grows to fill remaining space */
.left-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

/* Signin left — remove fixed width so it matches the shared flex: 1 rule */
.outer .left {
  border-radius: 12px;
  margin: 0;
}

.left h1 {
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: var(--space-3);
}

.left .subtitle {
  color: #4da6ff;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.left p {
  font-size: 0.75rem;
  color: #c5d3f0;
  line-height: 1.6;
}

.left p span { color: #4da6ff; }

/* ── Right panel ── */
.right {
  flex: 1;
  padding: var(--space-5) var(--space-6) var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 520px;
}

.bcp-logo {
  width: 82px;
  height: 92px;
  margin-bottom: var(--space-3);
  object-fit: contain;
}

h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #111;
  margin-bottom: var(--space-5);
}

/* ── Form fields ── */
.form-group {
  width: 100%;
  margin-bottom: var(--space-4);
}

.form-group label {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 0.78rem;
  color: #555;
  margin-bottom: var(--space-1);
  font-weight: 500;
}

.form-group input {
  width: 100%;
  height: 44px;
  border: 1.5px solid #d0d7e2;
  border-radius: 6px;
  padding: 0 var(--space-3);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
}

.form-group input:focus { border-color: #2563eb; }

/* ── Buttons ── */
.btn-done,
.btn-signin {
  width: 100%;
  height: 48px;
  margin-top: var(--space-2);
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition: background 0.2s;
  letter-spacing: 0.02em;
}

.btn-done:hover,
.btn-signin:hover { background: #1d4ed8; }

/* ── OTP resend link ── */
.resend {
  font-size: 0.78rem;
  color: #555;
  align-self: flex-start;
  margin-bottom: var(--space-3);
  cursor: pointer;
}

.resend:hover { text-decoration: underline; color: #2563eb; }

/* ── Register link under sign-in ── */
.register-link {
  margin-top: var(--space-4);
  font-size: 0.8rem;
  color: #666;
}

.register-link a { color: #2563eb; text-decoration: none; }
.register-link a:hover { text-decoration: underline; }

/* ── Wider card for the registration form (more fields) ── */
.register-card {
  width: 900px;
  min-height: 560px;
}

/* ── Two-column name row ── */
.form-row {
  display: flex;
  gap: var(--space-3);
  width: 100%;
}

.form-row .form-group { flex: 1; }

/* ── Inline select for role ── */
.form-group select {
  width: 100%;
  height: 44px;
  border: 1.5px solid #d0d7e2;
  border-radius: 6px;
  padding: 0 var(--space-3);
  font-size: 0.9rem;
  outline: none;
  background: #fff;
  transition: border-color 0.2s;
  cursor: pointer;
}
.form-group select:focus { border-color: #2563eb; }

/* ── Role toggle styles removed — role is always student on registration ── */

/* ── Error / success banners ── */
.auth-error,
.auth-success {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: var(--space-3);
  line-height: 1.4;
}

.auth-error {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
}

.auth-success {
  background: #dcfce7;
  color: #16a34a;
  border: 1px solid #86efac;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — AUTH PAGES
   Breakpoints: tablet ≤ 768px, mobile ≤ 480px
════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  body {
    padding: var(--space-5) var(--space-4);
  }

  /* Single panel view: clean 450px max width centered on screen */
  .outer {
    max-width: 450px;
    width: 100%;
    padding: var(--space-2);
    border-radius: 20px;
    margin: auto;
  }

  .card,
  .outer .card,
  .register-card {
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    min-height: unset;
    border-radius: 14px;
    margin: 0 auto;
  }

  /* Left panel hidden on mobile/tablet for focused login */
  .left {
    display: none;
  }

  /* Right panel takes full card width with comfortable padding */
  .right {
    min-height: unset;
    padding: var(--space-6) var(--space-5) var(--space-6);
    border-radius: 12px;
    width: 100%;
  }

  .bcp-logo {
    width: 72px;
    height: auto;
    margin-bottom: var(--space-3);
  }

  h2 {
    font-size: 1.35rem;
    margin-bottom: var(--space-5);
    text-align: center;
  }

  /* Name row stacks on mobile */
  .form-row {
    flex-direction: column;
    gap: 0;
  }
}

@media (max-width: 480px) {
  body {
    padding: var(--space-4) var(--space-3);
  }

  .outer {
    max-width: 100%;
    width: 100%;
    padding: var(--space-2);
    border: 2px solid #2563eb;
    border-radius: 18px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.10);
    margin: auto;
  }

  .card,
  .outer .card {
    border-radius: 12px;
    width: 100%;
    box-shadow: none;
  }

  .right {
    padding: var(--space-5) var(--space-4) var(--space-6);
    border-radius: 10px;
    width: 100%;
  }

  .bcp-logo {
    width: 60px;
    margin-bottom: var(--space-2);
  }

  h2 {
    font-size: 1.25rem;
    margin-bottom: var(--space-4);
  }

  .form-group {
    margin-bottom: var(--space-3);
  }

  .form-group input,
  .form-group select {
    height: 46px;
    font-size: 0.95rem;
  }

  .btn-done,
  .btn-signin {
    height: 48px;
    font-size: 0.95rem;
    margin-top: var(--space-2);
  }
}

/* Password wrapper & toggle */
.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-wrap input {
  width: 100%;
  padding-right: var(--space-7);
}

.toggle-pw {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.9rem;
  padding: var(--space-1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-pw:hover {
  color: #2563eb;
}

/* Extreme small screens (<= 400px) */
@media (max-width: 480px) {
  .right { padding: 16px 12px 24px; }
  .form-group label { font-size: 0.75rem; }
  .form-group input,
  .form-group select,
  .form-group textarea { font-size: 0.88rem; padding: 9px 12px; }
  .bcp-logo { width: 52px; height: 52px; margin-bottom: 12px; }
  h2 { font-size: 1.15rem; }
}

/* ── Multi-Factor Authentication (MFA) Styles ── */
.mfa-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  animation: mfaFadeIn 0.25s ease-out;
}

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

.mfa-icon-badge {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #eff6ff;
  border: 2px solid #bfdbfe;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2563eb;
  font-size: 1.55rem;
  margin-bottom: 14px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
  position: relative;
}

.mfa-icon-badge .badge-sub {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 22px;
  height: 22px;
  background: #10b981;
  color: #fff;
  border-radius: 50%;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
}

.mfa-subtitle {
  font-size: 0.86rem;
  color: #475569;
  text-align: center;
  line-height: 1.45;
  margin-bottom: 20px;
}

.mfa-target-email {
  color: #1e3a8a;
  font-weight: 700;
  word-break: break-all;
}

/* 6-Digit OTP Group */
.otp-inputs-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
  width: 100%;
}

.otp-box {
  width: 44px;
  height: 52px;
  font-family: 'JetBrains Mono', Courier, monospace;
  font-size: 1.45rem;
  font-weight: 800;
  text-align: center;
  color: #1e3a8a;
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  outline: none;
  transition: all 0.18s ease;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.04);
}

.otp-box:focus {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
  transform: translateY(-2px);
}

.otp-box.filled {
  border-color: #3b82f6;
  background: #eff6ff;
}

@media (max-width: 420px) {
  .otp-inputs-row { gap: 6px; }
  .otp-box { width: 38px; height: 46px; font-size: 1.25rem; border-radius: 8px; }
}

/* Timer and Resend Row */
.mfa-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 0.80rem;
  color: #64748b;
  margin-bottom: 18px;
  padding: 0 4px;
}

.mfa-timer {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  color: #475569;
}

.mfa-timer.urgent {
  color: #dc2626;
  animation: pulseTimer 1s infinite alternate;
}

@keyframes pulseTimer {
  from { opacity: 1; }
  to { opacity: 0.5; }
}

.btn-resend-link {
  background: none;
  border: none;
  color: #2563eb;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color 0.15s ease;
}

.btn-resend-link:hover:not(:disabled) {
  color: #1d4ed8;
  text-decoration: underline;
}

.btn-resend-link:disabled {
  color: #94a3b8;
  cursor: not-allowed;
  text-decoration: none;
}

/* Back Link */
.mfa-back-wrap {
  margin-top: 14px;
  text-align: center;
  width: 100%;
}

.btn-mfa-back {
  background: none;
  border: none;
  color: #64748b;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.btn-mfa-back:hover {
  color: #0f172a;
  background: #f1f5f9;
}

