/* ============================================================
   THE MAGIC LAB — auth-modal.css
   Drop-in auth UI — matches your existing dark theme exactly
   Include after your Google Fonts link on every page
   ============================================================ */

/* ── Auth button in nav ─────────────────────────────────────── */
.ml-auth-btn {
  font-size: 11px; font-weight: 700; padding: 5px 14px;
  border-radius: 8px; border: 1px solid rgba(99,102,241,0.40);
  background: rgba(99,102,241,0.12); color: #a5b4fc;
  cursor: pointer; transition: all 140ms;
  font-family: "DM Sans", sans-serif;
  display: flex; align-items: center; gap: 6px;
}
.ml-auth-btn:hover { background: rgba(99,102,241,0.22); color: #c7d2fe; }

/* Signed-in state */
.ml-user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 6px;
  border-radius: 99px; border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05); color: #dde1f0;
  font-size: 12px; font-weight: 600;
  font-family: "DM Sans", sans-serif;
  cursor: default;
}
.ml-user-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #10b981);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.ml-signout-btn {
  font-size: 10px; color: rgba(221,225,240,0.40);
  background: none; border: none; cursor: pointer;
  padding: 2px 4px; border-radius: 4px;
  font-family: "DM Sans", sans-serif;
  transition: color 130ms;
}
.ml-signout-btn:hover { color: rgba(221,225,240,0.75); }

/* ── Overlay ────────────────────────────────────────────────── */
.ml-modal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(6, 8, 20, 0.80);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 200ms ease;
}
.ml-modal-overlay.ml-open {
  opacity: 1; pointer-events: all;
}

/* ── Modal box ──────────────────────────────────────────────── */
.ml-modal {
  background: #0e1428;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 24px;
  padding: 36px 32px 32px;
  width: 100%; max-width: 420px;
  position: relative;
  box-shadow: 0 32px 80px rgba(0,0,0,0.60);
  transform: translateY(12px);
  transition: transform 200ms ease;
}
.ml-modal-overlay.ml-open .ml-modal {
  transform: translateY(0);
}

.ml-modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  color: rgba(221,225,240,0.50); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: all 130ms;
}
.ml-modal-close:hover { color: #dde1f0; background: rgba(255,255,255,0.09); }

/* ── Modal header ───────────────────────────────────────────── */
.ml-modal-logo {
  font-family: "Syne", sans-serif; font-weight: 800; font-size: 18px;
  background: linear-gradient(125deg, #fff 0%, #a5b4fc 55%, #6ee7b7 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 6px;
}
.ml-modal-title {
  font-family: "Syne", sans-serif; font-weight: 700; font-size: 22px;
  color: #e8eaf4; margin-bottom: 6px;
}
.ml-modal-sub {
  font-size: 13px; color: rgba(221,225,240,0.45); margin-bottom: 26px;
}

/* ── Tabs ───────────────────────────────────────────────────── */
.ml-tabs {
  display: flex; gap: 4px; margin-bottom: 24px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px; padding: 3px;
}
.ml-tab {
  flex: 1; padding: 7px; border-radius: 8px;
  border: none; background: none;
  font-family: "DM Sans", sans-serif; font-size: 13px; font-weight: 600;
  color: rgba(221,225,240,0.45); cursor: pointer;
  transition: all 150ms;
}
.ml-tab.ml-active {
  background: rgba(99,102,241,0.20);
  color: #c7d2fe;
  border: 1px solid rgba(99,102,241,0.30);
}

/* ── Form fields ────────────────────────────────────────────── */
.ml-field { margin-bottom: 14px; }
.ml-label {
  display: block; font-size: 11px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: rgba(221,225,240,0.50); margin-bottom: 6px;
}
.ml-input {
  width: 100%; padding: 11px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px; color: #e8eaf4;
  font-family: "DM Sans", sans-serif; font-size: 14px;
  outline: none; transition: border-color 150ms;
}
.ml-input::placeholder { color: rgba(221,225,240,0.28); }
.ml-input:focus { border-color: rgba(99,102,241,0.50); }

/* Role selector */
.ml-role-row { display: flex; gap: 8px; margin-bottom: 14px; }
.ml-role-btn {
  flex: 1; padding: 9px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  font-family: "DM Sans", sans-serif; font-size: 13px; font-weight: 600;
  color: rgba(221,225,240,0.50); cursor: pointer;
  transition: all 150ms;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.ml-role-btn.ml-selected {
  border-color: rgba(99,102,241,0.45);
  background: rgba(99,102,241,0.14);
  color: #c7d2fe;
}

/* Grade selector (student only) */
.ml-grade-row {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px;
}
.ml-grade-btn {
  padding: 5px 11px; border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  font-family: "DM Sans", sans-serif; font-size: 12px; font-weight: 600;
  color: rgba(221,225,240,0.45); cursor: pointer;
  transition: all 140ms;
}
.ml-grade-btn.ml-selected {
  border-color: rgba(16,185,129,0.45);
  background: rgba(16,185,129,0.12);
  color: #6ee7b7;
}

/* ── Submit button ──────────────────────────────────────────── */
.ml-submit {
  width: 100%; padding: 13px;
  border-radius: 12px; border: none;
  background: linear-gradient(135deg, #4f46e5, #10b981);
  color: #fff; font-family: "DM Sans", sans-serif;
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: all 160ms; margin-top: 6px;
  box-shadow: 0 4px 18px rgba(79,70,229,0.30);
}
.ml-submit:hover { box-shadow: 0 6px 24px rgba(79,70,229,0.45); transform: translateY(-1px); }
.ml-submit:active { transform: translateY(0); }
.ml-submit:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ── Error / success messages ───────────────────────────────── */
.ml-msg {
  margin-top: 12px; padding: 10px 14px;
  border-radius: 8px; font-size: 13px; font-weight: 500;
  display: none;
}
.ml-msg.ml-show { display: block; }
.ml-msg-error {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.25);
  color: #fca5a5;
}
.ml-msg-success {
  background: rgba(16,185,129,0.12);
  border: 1px solid rgba(16,185,129,0.25);
  color: #6ee7b7;
}

/* ── Progress badge in nav (shows streak/xp when logged in) ── */
.ml-xp-badge {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px; font-weight: 600;
  padding: 2px 8px; border-radius: 99px;
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.25);
  color: #fbbf24; margin-left: 2px;
}
