/* ─── Shared Auth Page Styles ─────────────────────────────────────────────── */
/* Used by learner/login.html and instructor/login.html                       */

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

:root {
  --primary:    #262626;
  --accent:     #f58321;
  --accent-dk:  #e07518;
  --accent-lt:  #fff4ec;
  --accent-mid: rgba(245,131,33,0.12);
  --muted:      #797879;
  --border:     #e0e0e0;
  --bg:         #ffffff;
  --surface:    #f9f9f9;
  --white:      #ffffff;
  --green:      #22c55e;
  --green-lt:   #f0fdf4;
  --red:        #ef4444;
  --font-head:  'Bricolage Grotesque', sans-serif;
  --font-body:  'Lato', sans-serif;
  --radius:     14px;
}

/* ── Dark Mode ────────────────────────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root:not(.light-mode) {
    --primary:    #e8e8e8;
    --accent:     #f58321;
    --accent-dk:  #e07518;
    --accent-lt:  #2e2014;
    --accent-mid: rgba(245,131,33,0.18);
    --muted:      #9e9e9e;
    --border:     #3a3a3a;
    --bg:         #1a1a1a;
    --surface:    #242424;
    --white:      #2e2e2e;
    --green:      #4ade80;
    --green-lt:   #14261a;
    --red:        #f87171;
    color-scheme: dark;
  }
  :root:not(.light-mode) .site-nav { background: rgba(26,26,26,0.95); }
}
:root.dark-mode {
  --primary:    #e8e8e8;
  --accent:     #f58321;
  --accent-dk:  #e07518;
  --accent-lt:  #2e2014;
  --accent-mid: rgba(245,131,33,0.18);
  --muted:      #9e9e9e;
  --border:     #3a3a3a;
  --bg:         #1a1a1a;
  --surface:    #242424;
  --white:      #2e2e2e;
  --green:      #4ade80;
  --green-lt:   #14261a;
  --red:        #f87171;
  color-scheme: dark;
}
:root.dark-mode .site-nav { background: rgba(26,26,26,0.95); }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  padding-top: 88px;
}

/* ── Top nav (hidden when sidebar.js loads, but kept as fallback) ────────── */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 0 32px;
  height: 64px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: rgba(38, 38, 38, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.site-nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.site-nav-logo img {
  width: 34px; height: 34px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  padding: 4px;
}
.site-nav-logo span {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}
.site-nav-logo span em { font-style: normal; color: var(--accent); }
.site-nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.site-nav-cta {
  display: flex;
  justify-content: flex-end;
}
.site-nav-link {
  color: rgba(255,255,255,0.6);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: 100px;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.18s;
  white-space: nowrap;
  background: transparent;
  cursor: pointer;
}
.site-nav-link:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
}
.site-nav-link.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}
.site-nav-link.primary:hover {
  background: var(--accent-dk);
  border-color: var(--accent-dk);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(245,131,33,0.35);
}
@media (max-width: 900px) {
  .site-nav { padding: 0 16px; }
  .site-nav-links, .site-nav-cta { display: none; }
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: none;
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.06);
  padding: 32px;
}
.card-title {
  font-family: var(--font-head);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--primary);
}
.card-sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 28px;
  line-height: 1.5;
}

/* ── Screen management ───────────────────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: block; }

/* ── Form elements ───────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  font-family: var(--font-body);
}
input[type="text"],
input[type="email"],
input[type="tel"],
textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s, background-color 0.2s;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus {
  border-color: var(--accent);
  background: var(--white);
}
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

/* ── Method toggle (email / SMS) ─────────────────────────────────────────── */
.method-toggle {
  display: flex;
  gap: 0;
  background: var(--surface);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
}
.method-btn {
  flex: 1;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.method-btn.active {
  background: var(--white);
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.method-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: var(--font-head);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 14px;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 8px rgba(245,131,33,0.2), inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-primary:hover {
  background: var(--accent-dk);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245,131,33,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-primary:active { transform: scale(0.98) translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-bottom: 20px;
  font-family: var(--font-body);
  transition: color 0.2s;
}
.btn-back:hover { color: var(--primary); }
.btn-back svg { width: 16px; height: 16px; }

/* ── Error message ───────────────────────────────────────────────────────── */
.error-msg {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #c41e1e;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
  font-family: var(--font-body);
}
.error-msg.show { display: block; }

/* ── Result / confirmation states ────────────────────────────────────────── */
.result-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.result-icon svg { width: 28px; height: 28px; }
.result-icon.orange {
  background: var(--accent-lt);
  color: var(--accent);
  box-shadow: 0 0 0 8px rgba(245,131,33,0.06), 0 0 0 16px rgba(245,131,33,0.03);
  animation: result-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.result-icon.green { background: rgba(34,197,94,0.1); color: var(--green); }
.result-icon.red   { background: rgba(239,68,68,0.1); color: var(--red); }

@keyframes result-pop {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.result-title {
  font-family: var(--font-head);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
  text-align: center;
}
.result-sub {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
  margin-bottom: 24px;
}
.result-sub strong { color: var(--primary); font-weight: 600; }

/* ── Resend / secondary link ─────────────────────────────────────────────── */
.resend-link {
  font-size: 0.82rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  padding: 0;
  transition: color 0.2s;
}
.resend-link:hover { color: var(--accent); }
.resend-link:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Hints / fine print ──────────────────────────────────────────────────── */
.hint {
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 20px;
  line-height: 1.5;
}

/* ── Back-to-home link ───────────────────────────────────────────────────── */
.back-link {
  margin-top: 20px;
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  font-family: var(--font-body);
}
.back-link:hover { color: var(--primary); }

/* ── Free badge ──────────────────────────────────────────────────────────── */
.free-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-lt);
  color: var(--accent-dk);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 100px;
  margin-bottom: 20px;
}
.free-badge svg { width: 14px; height: 14px; }

/* ── Name collection form (new users) ────────────────────────────────────── */
.name-form {
  margin-top: 20px;
  text-align: left;
}
.name-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.name-form input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s;
}
.name-form input:focus {
  border-color: var(--accent);
  background: var(--white);
}
.name-form .btn-primary {
  width: 100%;
  margin-top: 12px;
}

/* ── Choice cards (instructor) ───────────────────────────────────────────── */
.choice-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.choice-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
  background: var(--white);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
}
.choice-card:hover {
  background: var(--accent-lt);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245,131,33,0.12), 0 2px 4px rgba(0,0,0,0.06);
}
.choice-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.choice-icon svg { width: 24px; height: 24px; }
.choice-icon.sign-in { background: var(--accent-lt); color: var(--accent); }
.choice-icon.join    { background: #f0f0f0; color: var(--primary); }
.choice-label { font-weight: 700; font-size: 0.95rem; margin-bottom: 2px; }
.choice-desc  { font-size: 0.8rem; color: var(--muted); line-height: 1.4; }

/* ── SMS code input ──────────────────────────────────────────────── */
.code-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 20px 0 8px;
}
.code-inputs input[data-idx] {
  width: 46px !important;
  min-width: 46px;
  max-width: 46px;
  height: 56px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  font-family: var(--font-head);
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--primary);
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  padding: 0;
}
.code-inputs input:focus {
  border-color: var(--accent);
  background: var(--bg);
  box-shadow: 0 0 0 3px rgba(245,131,33,0.1);
}
.code-inputs input.filled {
  border-color: var(--accent);
  background: var(--accent-lt);
}
.code-error {
  color: var(--red, #ef4444);
  font-size: 0.82rem;
  margin-bottom: 12px;
  min-height: 1.2em;
}
