/* Shared login/signup popup. Loaded globally via Layout.astro (like auth.js)
   since its only trigger today is the navbar "Login" link, which exists on
   every non-chromeless page. Brand colors match src/styles/style.css's
   --primary/--primary-dark; font inherits the site's Poppins. */

.auth-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(20, 6, 20, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: authModalFadeIn 0.2s ease;
}
.auth-modal-overlay.hidden { display: none !important; }

@keyframes authModalFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes authModalPopIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-modal {
  position: relative;
  width: 100%;
  max-width: 900px;
  max-height: 92vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(91, 2, 107, 0.28);
  animation: authModalPopIn 0.28s cubic-bezier(.2,.8,.2,1);
  /* Firefox — same brand-colors treatment as .course-sidebar */
  scrollbar-width: thin;
  scrollbar-color: var(--primary, #d1039e) #f1f5f9;
}
.auth-modal::-webkit-scrollbar { width: 6px; }
.auth-modal::-webkit-scrollbar-track {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 3px;
}
.auth-modal::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary, #d1039e), var(--primary-dark, #5b026b));
  border-radius: 3px;
}
.auth-modal::-webkit-scrollbar-thumb:hover { background: var(--primary, #d1039e); }

.auth-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  color: #4b1050;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: background 0.15s, transform 0.15s;
}
.auth-modal-close:hover { background: #fff; transform: rotate(90deg); }

.auth-modal-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr);
}

/* ============ Left: brand panel ============ */
.auth-modal-brand {
  position: relative;
  overflow: hidden;
  padding: 44px 38px;
  background: linear-gradient(160deg, #fdf1fa 0%, #f2e9fe 60%, #eee6fd 100%);
  border-radius: 22px 0 0 22px;
  display: flex;
  flex-direction: column;
}

.auth-modal-brand-glow {
  position: absolute;
  top: -60px;
  right: -80px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(209, 3, 158, 0.16), rgba(124, 58, 237, 0.05) 70%, transparent);
  pointer-events: none;
}

.auth-modal-logo {
  height: 34px;
  width: auto;
  object-fit: contain;
  object-position: left;
  margin-bottom: 26px;
}

.auth-modal-brand-headline {
  font-size: 1.6rem;
  line-height: 1.25;
  font-weight: 800;
  color: #1a1a1a;
  margin: 0 0 10px;
}
.auth-modal-brand-headline span {
  background: linear-gradient(135deg, var(--primary, #d1039e), #7c3aed);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.auth-modal-brand-sub {
  font-size: 0.92rem;
  color: #6b5b70;
  line-height: 1.5;
  margin: 0 0 26px;
  max-width: 30ch;
}

.auth-modal-features {
  list-style: none;
  margin: 0 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-modal-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #3d2b42;
}
.auth-modal-feature-ico {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.85rem;
  background: linear-gradient(135deg, var(--primary, #d1039e), #7c3aed);
  box-shadow: 0 4px 10px rgba(209, 3, 158, 0.25);
}

.auth-modal-float-cards {
  position: relative;
  height: 64px;
  margin-top: 30px;
}
.auth-modal-float-card {
  position: absolute;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(91, 2, 107, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  animation: authModalFloat 3.6s ease-in-out infinite;
}
.auth-modal-float-card.c1 { left: 0;   top: 10px; color: #3776ab; animation-delay: 0s; }
.auth-modal-float-card.c2 { left: 54px; top: -6px; color: #d7b500; animation-delay: 0.5s; }
.auth-modal-float-card.c3 { left: 108px; top: 14px; color: #61dafb; animation-delay: 1s; }
@keyframes authModalFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

.auth-modal-brand-caption {
  margin: 22px 0 0;
  font-size: 0.8rem;
  font-style: italic;
  color: #8a7690;
}

/* ============ Right: form panel ============ */
.auth-modal-form-side {
  padding: 40px 40px 32px;
  display: flex;
  flex-direction: column;
}

.auth-modal-tabs {
  display: flex;
  gap: 26px;
  border-bottom: 1.5px solid #f0e8f2;
  margin-bottom: 22px;
}
.auth-modal-tab {
  border: none;
  background: none;
  padding: 0 2px 12px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #9b8fa0;
  cursor: pointer;
  position: relative;
}
.auth-modal-tab.active { color: var(--primary, #d1039e); }
.auth-modal-tab.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1.5px;
  height: 2.5px;
  border-radius: 2px;
  background: linear-gradient(135deg, var(--primary, #d1039e), #7c3aed);
}

.auth-modal-headline {
  font-size: 1.35rem;
  font-weight: 800;
  color: #1a1a1a;
  margin: 0 0 6px;
}
.auth-modal-subtext {
  font-size: 0.85rem;
  color: #7a7a7a;
  margin: 0 0 20px;
}

.auth-modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-modal-field { display: flex; flex-direction: column; gap: 6px; }
.auth-modal-field-label { font-size: 0.8rem; font-weight: 600; color: #3d3d3d; }

.auth-modal-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-modal-input-ico {
  position: absolute;
  left: 14px;
  color: #b3a6b7;
  font-size: 0.88rem;
  pointer-events: none;
}
.auth-modal-input-wrap input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border-radius: 12px;
  border: 1.5px solid #e8e2ea;
  font-size: 0.9rem;
  font-family: inherit;
  color: #1a1a1a;
  background: #fbfafc;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.auth-modal-input-wrap input:focus {
  outline: none;
  border-color: var(--primary, #d1039e);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(209, 3, 158, 0.12);
}
.auth-modal-pw-toggle {
  position: absolute;
  right: 12px;
  border: none;
  background: none;
  color: #b3a6b7;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px;
}
.auth-modal-pw-toggle:hover { color: var(--primary, #d1039e); }

.auth-modal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-top: -4px;
}
.auth-modal-remember {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #4a4a4a;
  cursor: pointer;
  user-select: none;
}
.auth-modal-remember input { accent-color: var(--primary, #d1039e); width: 15px; height: 15px; }
.auth-modal-forgot { color: var(--primary, #d1039e); text-decoration: none; font-weight: 600; }
.auth-modal-forgot:hover { text-decoration: underline; }

.auth-modal-error {
  display: none;
  padding: 9px 13px;
  border-radius: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 0.8rem;
}

.auth-modal-submit {
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary, #d1039e), var(--primary-dark, #5b026b));
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(209, 3, 158, 0.3);
  transition: opacity 0.15s, transform 0.1s;
}
.auth-modal-submit:hover { opacity: 0.94; }
.auth-modal-submit:active { transform: translateY(1px); }
.auth-modal-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-modal-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 16px;
  color: #a89fac;
  font-size: 0.78rem;
}
.auth-modal-divider::before,
.auth-modal-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #eee6f0;
}

.auth-modal-social-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px;
  border-radius: 12px;
  border: 1.5px solid #e8e2ea;
  background: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.auth-modal-social-btn:hover { border-color: var(--primary, #d1039e); box-shadow: 0 4px 12px rgba(209, 3, 158, 0.12); }
.auth-modal-social-btn:active { transform: translateY(1px); }

.auth-modal-switch {
  text-align: center;
  margin: 20px 0 0;
  font-size: 0.85rem;
  color: #6b6b6b;
}
.auth-modal-switch a {
  color: var(--primary, #d1039e);
  font-weight: 700;
  text-decoration: none;
  margin-left: 4px;
}
.auth-modal-switch a:hover { text-decoration: underline; }

/* ============ Sign-up email OTP step ============ */
.auth-modal-otp-step {
  display: none; /* flex, toggled by JS */
  flex-direction: column;
}
.auth-modal-otp-input {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 1.5px solid #e8e2ea;
  background: #fbfafc;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.5em;
  text-align: center;
  color: #1a1a1a;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.auth-modal-otp-input:focus {
  outline: none;
  border-color: var(--primary, #d1039e);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(209, 3, 158, 0.12);
}
.auth-modal-otp-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  font-size: 0.82rem;
}
.auth-modal-otp-links a {
  color: var(--primary, #d1039e);
  text-decoration: none;
  font-weight: 600;
}
.auth-modal-otp-links a:hover { text-decoration: underline; }
.auth-modal-otp-links a.disabled {
  color: #b3a6b7;
  cursor: default;
  pointer-events: none;
  text-decoration: none;
}

/* ============ Responsive ============ */
@media (max-width: 720px) {
  .auth-modal-grid { grid-template-columns: 1fr; }
  .auth-modal-brand { display: none; }
  .auth-modal-form-side { padding: 34px 24px 26px; border-radius: 22px; }
  .auth-modal { max-height: 94vh; }
}

/* Theme: the rest of the site supports [data-theme="dark"] — this modal
   deliberately stays on a light card regardless (a login surface is a poor
   place to fight for contrast on an untested dark palette), matching how
   assessment.astro's gate screens also don't attempt dark-mode variants. */
