/* ══════════════════════════════════════════════
   Login Page — Page Styles
   ══════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex; flex-direction: column;
}

/* ── AMBIENT ── */
.ambient-tl {
  position: fixed; top: -180px; left: -180px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(128,0,32,0.11) 0%, transparent 65%);
  pointer-events: none; z-index: 0;
  animation: drift 14s ease-in-out infinite alternate;
}
.ambient-br {
  position: fixed; bottom: -100px; right: -100px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(85,107,47,0.08) 0%, transparent 65%);
  pointer-events: none; z-index: 0;
}
@keyframes drift { from { transform: translate(0,0); } to { transform: translate(55px,65px); } }

/* ── LAYOUT ── */
.page-shell {
  flex: 1; display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
  position: relative; z-index: 1;
}

/* ── LEFT PANEL ── */
.left-panel {
  background: var(--text);
  display: flex; flex-direction: column;
  padding: 48px 56px;
  position: relative; overflow: hidden;
}
/* ── CLAVE CANVAS ── */
#clave-trail-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.clave-stamp {
  position: absolute;
  pointer-events: none;
  will-change: opacity;
  user-select: none;
}

.left-panel::before {
  content: '';
  position: absolute; top: -120px; right: -80px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(128,0,32,0.22) 0%, transparent 62%);
  pointer-events: none;
}
.left-panel::after {
  content: '';
  position: absolute; bottom: -80px; left: -60px;
  width: 380px; height: 380px;
  background: radial-gradient(circle, rgba(85,107,47,0.16) 0%, transparent 62%);
  pointer-events: none;
}
.lp-logo {
  display: flex; align-items: center; gap: 11px;
  text-decoration: none; margin-bottom: auto;
  position: relative; z-index: 1;
}
.lp-logo-mark {
  width: 38px; height: 38px; border-radius: 9px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif;
  font-weight: 800; font-size: 15px; color: #fff;
  box-shadow: 0 4px 18px rgba(128,0,32,0.38);
  flex-shrink: 0;
}
.lp-logo-text {
  font-family: 'Playfair Display', serif;
  font-weight: 700; font-size: 19px; color: rgba(255,255,255,0.95);
}
.lp-logo-text span { color: var(--primary); }
.lp-body {
  position: relative; z-index: 1;
  margin-bottom: 40px;
}
.lp-eyebrow {
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--primary);
  margin-bottom: 18px; display: block;
}
.lp-h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(32px, 3.5vw, 48px);
  font-weight: 900; color: #fff;
  line-height: 1.07; letter-spacing: -1px;
  margin-bottom: 20px;
}
.lp-h1 em { color: var(--primary); font-style: italic; }
.lp-sub {
  font-size: 15px; color: rgba(255,255,255,0.55);
  font-weight: 300; line-height: 1.75;
  max-width: 360px;
}
.lp-features {
  display: flex; flex-direction: column; gap: 14px;
  margin-top: 36px;
  position: relative; z-index: 1;
}
.lp-feature {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  transition: border-color 0.2s, background 0.2s;
}
.lp-feature-icon {
  font-size: 20px; flex-shrink: 0;
}
.lp-feature-text { font-size: 13px; color: rgba(255,255,255,0.7); font-weight: 300; line-height: 1.4; }
.lp-feature-text strong { color: rgba(255,255,255,0.92); font-weight: 600; display: block; margin-bottom: 2px; }
.lp-back {
  position: relative; z-index: 1; margin-top: auto; padding-top: 32px;
}
.lp-back a {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: rgba(255,255,255,0.4);
  text-decoration: none; transition: color 0.15s;
  font-weight: 400;
}
.lp-back a:hover { color: rgba(255,255,255,0.7); }

/* ── RIGHT PANEL ── */
.right-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 48px 56px;
  background: var(--bg);
}
.auth-box {
  width: 100%; max-width: 420px;
}

/* STEP indicator */
.steps {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 32px;
}
.step-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border2); transition: background 0.3s, width 0.3s, border-radius 0.3s;
  flex-shrink: 0;
}
.step-dot.active { background: var(--primary); width: 24px; border-radius: 4px; }
.step-dot.done   { background: var(--green); }

/* ── STEP 1: ROLE PICKER ── */
.step { display: none; }
.step.active { display: block; animation: slideIn 0.35s ease; }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

.auth-h2 {
  font-family: 'Playfair Display', serif;
  font-size: 26px; font-weight: 800;
  letter-spacing: -0.5px; margin-bottom: 6px;
}
.auth-h2 em { color: var(--primary); font-style: italic; }
.auth-sub {
  font-size: 13px; color: var(--text3); font-weight: 300;
  margin-bottom: 28px; line-height: 1.6;
}

.role-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin-bottom: 24px;
}
.role-card {
  background: var(--card); border: 2px solid var(--border);
  border-radius: 16px; padding: 24px 18px;
  cursor: pointer; transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  text-align: center; position: relative;
  overflow: hidden;
}
.role-card::before {
  content: ''; position: absolute; inset: 0;
  opacity: 0; transition: opacity 0.2s;
}
.role-card.role-student::before { background: rgba(128,0,32,0.04); }
.role-card.role-instructor::before { background: rgba(85,107,47,0.04); }
.role-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(19,10,6,0.1);
}
.role-card:hover::before { opacity: 1; }
.role-card.role-student:hover  { border-color: var(--primary); }
.role-card.role-instructor:hover { border-color: var(--accent); }
.role-card.selected.role-student  {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), 0 8px 28px rgba(128,0,32,0.18);
}
.role-card.selected.role-instructor {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 8px 28px rgba(85,107,47,0.18);
}
.role-emoji { font-size: 36px; margin-bottom: 12px; display: block; }
.role-title {
  font-family: 'Playfair Display', serif;
  font-size: 16px; font-weight: 700; margin-bottom: 6px;
}
.role-desc { font-size: 11px; color: var(--text3); font-weight: 300; line-height: 1.5; }
.role-check {
  position: absolute; top: 10px; right: 10px;
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: #fff;
  opacity: 0; transition: opacity 0.2s;
}
.role-card.selected.role-student  .role-check { background: var(--primary); opacity: 1; }
.role-card.selected.role-instructor .role-check { background: var(--accent); opacity: 1; }

.role-continue {
  width: 100%; background: var(--text); color: #fff;
  border: none; padding: 14px;
  border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  opacity: 0.35; pointer-events: none;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.role-continue.enabled {
  opacity: 1; pointer-events: auto;
}
.role-continue.enabled:hover {
  background: #1A0D08; transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(19,10,6,0.22);
}

/* ── STEP 2: LOGIN FORM ── */
.role-badge-bar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px;
}
.role-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.6px;
  padding: 5px 12px; border-radius: 20px;
}
.rb-student    { background: rgba(128,0,32,0.1);  color: var(--primary); border: 1px solid rgba(128,0,32,0.25); }
.rb-instructor { background: rgba(85,107,47,0.1); color: var(--accent);  border: 1px solid rgba(85,107,47,0.25); }
.role-change {
  font-size: 11px; color: var(--text3);
  text-decoration: underline; cursor: pointer;
  background: none; border: none;
  font-family: 'Outfit', sans-serif; padding: 0;
  transition: color 0.15s;
}
.role-change:hover { color: var(--primary); }

.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 11px; font-weight: 700;
  letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--text3); margin-bottom: 7px;
}
.form-input {
  width: 100%; height: 46px; padding: 0 14px;
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: 9px;
  font-family: 'Outfit', sans-serif;
  font-size: 14px; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-input::placeholder { color: var(--text3); }
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(128,0,32,0.12);
}
.form-input.error { border-color: var(--primary); }

.pw-wrap { position: relative; }
.pw-toggle {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--text3); padding: 4px;
  display: flex; align-items: center;
  transition: color 0.15s;
}
.pw-toggle:hover { color: var(--text2); }

.form-hint {
  font-size: 11px; color: var(--text3); margin-top: 6px;
}

.submit-btn {
  width: 100%; height: 48px; margin-top: 8px;
  border: none; border-radius: 10px;
  font-family: 'Outfit', sans-serif;
  font-size: 15px; font-weight: 700;
  cursor: pointer; transition: transform 0.2s, filter 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  position: relative; overflow: hidden;
}
.submit-btn.student-btn {
  background: var(--primary); color: #fff;
  box-shadow: 0 6px 24px rgba(128,0,32,0.34);
}
.submit-btn.instructor-btn {
  background: var(--accent); color: #fff;
  box-shadow: 0 6px 24px rgba(85,107,47,0.34);
}
.submit-btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.submit-btn:active { transform: translateY(0); }
.submit-btn.loading { pointer-events: none; opacity: 0.75; }
.submit-btn .spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
.submit-btn.loading .btn-label { display: none; }
.submit-btn.loading .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Error banner */
.error-banner {
  background: rgba(128,0,32,0.08);
  border: 1px solid rgba(128,0,32,0.25);
  border-radius: 9px; padding: 12px 14px;
  margin-bottom: 16px; display: none;
  align-items: flex-start; gap: 10px;
}
.error-banner.show { display: flex; }
.error-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.error-msg { font-size: 13px; color: var(--primary); font-weight: 400; line-height: 1.5; }

/* demo credentials helper */
.demo-panel {
  margin-top: 24px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden;
}
.demo-panel-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--text2);
  user-select: none; transition: background 0.15s;
}
.demo-panel-toggle:hover { background: var(--border); }
.demo-chevron {
  transition: transform 0.2s; font-size: 10px; color: var(--text3);
}
.demo-panel-toggle.open .demo-chevron { transform: rotate(180deg); }
.demo-body {
  display: none; padding: 0 16px 14px;
}
.demo-body.show { display: block; }
.demo-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.12s;
  border-radius: 6px;
}
.demo-row:last-child { border-bottom: none; }
.demo-row:hover { background: rgba(19,10,6,0.03); }
.demo-av {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 10px; color: #fff; flex-shrink: 0;
  font-family: 'Outfit', sans-serif;
}
.demo-name { font-size: 12px; font-weight: 600; color: var(--text); flex: 1; }
.demo-role-pill {
  font-size: 9px; font-weight: 700; padding: 2px 7px;
  border-radius: 4px; letter-spacing: 0.5px; text-transform: uppercase;
}
.demo-email { font-size: 10px; color: var(--text3); margin-top: 1px; }
.demo-hint { font-size: 10px; color: var(--text3); margin-top: 10px; }

/* auth divider */
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0; color: var(--text3); font-size: 11px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* footer row */
.auth-footer-row {
  margin-top: 20px; text-align: center;
  font-size: 13px; color: var(--text3);
}
.auth-footer-row a {
  color: var(--primary); text-decoration: none; font-weight: 500;
}
.auth-footer-row a:hover { text-decoration: underline; }

/* ── MOBILE LOGO (hidden on desktop, visible when left panel is gone) ── */
.mobile-logo {
  display: none;
  margin-bottom: 28px;
}
.mobile-logo .logo-img {
  height: 44px;
  width: auto;
}

/* ── RESPONSIVE ── */
@media (max-width: 820px) {
  .page-shell { grid-template-columns: 1fr; }
  .left-panel { display: none; }
  .right-panel { padding: 32px 24px; align-items: flex-start; padding-top: 40px; }
  .auth-box { max-width: 100%; }
  .mobile-logo { display: block; }
}
