/* =====================================================
   AUTH PAGE — Login & Sign Up
   Color palette mirrors the Legal / About modal (warm
   cream + crimson red + deep purple).
   ===================================================== */

:root {
  --page-bg: #F9F3E9;
  --text-primary: #4a5568;
  --bg-points-card: #f2f2f2;
  --border-light: rgba(87, 115, 179, 0.305);
  --nav-btn-border: rgba(87, 115, 179, 0.305);
  --nav-btn-arrow-color: 74, 85, 104;
  --nav-btn-bg: #f2f1e6;
  --accent: #0077cc;
  --accent-subtle: rgba(0, 119, 204, 0.07);
  --accent-border: rgba(0, 119, 204, 0.3);
  --accent-glow: rgba(0, 119, 204, 0.12);
  --maroon: #d12847;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f2f1e6;
  color: #4a5568;
}

/* ── PAGE SHELL ─────────────────────────────────── */

.auth-page {
  display: flex;
  min-height: 100vh;
  height: 100vh;
}

/* ── LEFT: FORM PANEL ──────────────────────────── */

.auth-form-panel {
  flex: 0 0 min(620px, 60%);
  display: flex;
  flex-direction: column;
  padding: 36px 52px 44px;
  background: linear-gradient(160deg, #f2f2f2 0%, #f2f1e6 100%);
  border-right: 1px solid rgba(87, 115, 179, 0.18);
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(209, 40, 71, 0.55) rgba(87, 115, 179, 0.08);
  position: relative;
  z-index: 1;
}

.auth-form-panel::-webkit-scrollbar {
  width: 14px;
}

.auth-form-panel::-webkit-scrollbar-track {
  background: linear-gradient(180deg, rgba(87, 115, 179, 0.06), rgba(87, 115, 179, 0.14));
  border: 4px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}

.auth-form-panel::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(209, 40, 71, 0.9), rgba(71, 57, 84, 0.92));
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
  min-height: 56px;
}

.auth-form-panel::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(184, 30, 59, 0.96), rgba(71, 57, 84, 0.98));
  background-clip: padding-box;
}

.auth-back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #4a5568;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  opacity: 0.55;
  margin-bottom: 32px;
  letter-spacing: 0.01em;
  transition: opacity 0.15s;
}
.auth-back-link:hover { opacity: 1; }

/* Brand */
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 30px;
}
.auth-brand-icon {
  font-size: 2.1rem;
  color: #d12847;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(209, 40, 71, 0.3));
}
.auth-brand-name {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: -0.025em;
  color: #473954;
}
/* Distinct styling for the historic year 1475 */
.auth-brand-name .auth-brand-year {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-weight: 700;
  font-style: italic;
  background: linear-gradient(135deg, #d4af37 0%, #f0e68c 50%, #d4af37 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.02em;
}

/* ── TOGGLE PILL ─────────────────────────────── */

.auth-toggle {
  position: relative;
  display: flex;
  background: rgba(87, 115, 179, 0.09);
  border: 1px solid rgba(87, 115, 179, 0.2);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 30px;
  width: fit-content;
  user-select: none;
}

.auth-toggle-pill {
  position: absolute;
  top: 4px;
  height: calc(100% - 8px);
  background: #d12847;
  border-radius: 999px;
  transition: left 0.28s cubic-bezier(0.34, 1.3, 0.64, 1),
              width 0.28s cubic-bezier(0.34, 1.3, 0.64, 1);
  z-index: 0;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(209, 40, 71, 0.32);
}

.auth-toggle-btn {
  position: relative;
  z-index: 1;
  border: none;
  background: none;
  color: #4a5568;
  font-size: 0.88rem;
  font-weight: 800;
  padding: 8px 26px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s;
  white-space: nowrap;
  font-family: inherit;
  letter-spacing: 0.01em;
}
.auth-toggle-btn.active { color: #ffffff; }

/* ── VIEW ────────────────────────────────────── */

.auth-view {
  display: block;
  animation: authFadeIn 0.28s ease;
}
.auth-view.hidden { display: none; }

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

.auth-view-header { margin-bottom: 22px; }

.auth-heading {
  margin: 0 0 5px;
  font-size: 1.95rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #d12847;
  line-height: 1.1;
  text-shadow: 0 3px 14px rgba(209, 40, 71, 0.13);
}
.auth-subheading {
  margin: 0;
  font-size: 0.94rem;
  color: #4a5568;
  opacity: 0.75;
  font-weight: 600;
}

/* ── FORM FIELDS ─────────────────────────────── */

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

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.auth-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.auth-field-row--security {
  align-items: end;
}

.auth-label {
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #473954;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid rgba(87, 115, 179, 0.32);
  border-radius: 10px;
  background: #ffffff;
  color: #4a5568;
  font-size: 0.95rem;
  font-weight: 500;
  transition: border-color 0.18s, box-shadow 0.18s;
  outline: none;
  font-family: inherit;
  -webkit-appearance: none;
}
.auth-input:focus {
  border-color: #d12847;
  box-shadow: 0 0 0 3px rgba(209, 40, 71, 0.1);
}
.auth-input::placeholder { opacity: 0.38; }
.auth-input-wrap .auth-input { padding-right: 42px; }

.auth-password-hint-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.auth-password-token {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #6b7280;
  transition: color 0.18s ease;
}

.auth-password-token-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(107, 114, 128, 0.45);
  box-shadow: inset 0 0 0 1px rgba(71, 57, 84, 0.12);
  transition: background-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.auth-password-token.is-met {
  color: #166534;
}

.auth-password-token.is-met .auth-password-token-dot {
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.18);
  transform: scale(1.05);
}

.auth-eye-btn {
  position: absolute;
  right: 11px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  opacity: 0.38;
  padding: 4px;
  line-height: 1;
  transition: opacity 0.15s;
  font-family: inherit;
}
.auth-eye-btn:hover { opacity: 0.75; }

/* ── CONSENT CHECKBOX ────────────────────────── */

.auth-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.8rem;
  line-height: 1.55;
  color: #4a5568;
  cursor: pointer;
  padding: 6px 0 2px;
}
.auth-consent input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: #d12847;
  cursor: pointer;
}
.auth-consent a {
  color: #0077cc;
  font-weight: 700;
  text-underline-offset: 2px;
}
.auth-consent a:hover { color: #d12847; }

/* ── ERROR ───────────────────────────────────── */

.auth-error {
  font-size: 0.82rem;
  color: #d12847;
  font-weight: 700;
  min-height: 0;
  transition: min-height 0.15s;
}
.auth-error:not(:empty) { min-height: 18px; }

/* ── SUBMIT BUTTON ───────────────────────────── */

.auth-submit {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 10px;
  background: #d12847;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s, box-shadow 0.18s;
  box-shadow: 0 4px 16px rgba(209, 40, 71, 0.3);
  margin-top: 4px;
  font-family: inherit;
  -webkit-appearance: none;
}
.auth-submit:hover {
  background: #b81e3b;
  box-shadow: 0 6px 22px rgba(209, 40, 71, 0.4);
  transform: translateY(-1px);
}
.auth-submit:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(209, 40, 71, 0.2);
}

/* ── FORGOT / SWITCH LINKS ───────────────────── */

.auth-forgot-row {
  display: flex;
  justify-content: flex-end;
  margin-top: -4px;
}
.auth-forgot {
  font-size: 0.83rem;
  color: #0077cc;
  font-weight: 700;
  text-decoration: none;
  text-underline-offset: 2px;
}
.auth-forgot:hover { color: #d12847; text-decoration: underline; }

.auth-recovery-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 2px;
  padding: 12px;
  border: 1px solid rgba(87, 115, 179, 0.2);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
}

.auth-recovery-panel.hidden {
  display: none;
}

.auth-recovery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.auth-recovery-caption {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #473954;
}

.auth-recovery-policy {
  margin-top: 10px;
  font-size: 0.74rem;
  line-height: 1.45;
  color: rgba(71, 57, 84, 0.88);
  font-weight: 700;
}

.auth-recovery-question {
  margin: 0;
  font-size: 0.83rem;
  line-height: 1.45;
  color: #4a5568;
  font-weight: 700;
}

.auth-recovery-close {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(87, 115, 179, 0.25);
  background: rgba(255, 255, 255, 0.8);
  color: #4a5568;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.auth-recovery-close:hover {
  border-color: rgba(209, 40, 71, 0.45);
  color: #d12847;
}

.auth-recovery-step.hidden {
  display: none;
}

.auth-submit.hidden {
  display: none;
}

.auth-recovery-submit {
  margin-top: 10px;
}

.auth-switch {
  margin: 16px 0 0;
  font-size: 0.87rem;
  color: #4a5568;
  text-align: center;
}
.auth-switch-link {
  color: #0077cc;
  font-weight: 800;
  text-decoration: none;
}
.auth-switch-link:hover { color: #d12847; text-decoration: underline; }

/* ── DIVIDER ─────────────────────────────────── */

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0;
  color: #4a5568;
  opacity: 0.38;
  font-size: 0.8rem;
  font-weight: 700;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(87, 115, 179, 0.3);
}

/* ── RIGHT: SHOWCASE PANEL ───────────────────── */

.auth-showcase {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 420px;
  background: #0f172a;
}

/* Carousel */
.auth-carousel {
  position: absolute;
  inset: 0;
}
.auth-carousel-slide {
  position: absolute;
  inset: 0;
  background-size: 30%;
  background-position: left 24px bottom 24px;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 1.4s ease;
}
.auth-carousel-slide.is-active {
  opacity: 1;
  transition: opacity 1.4s ease;
}

/* Gradient overlay */
.auth-showcase-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    140deg,
    rgba(2, 4, 22, 0.80) 0%,
    rgba(71, 57, 84, 0.55) 48%,
    rgba(2, 4, 22, 0.84) 100%
  );
  z-index: 1;
}

/* Content on top */
.auth-showcase-content {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 44px;
  text-align: center;
  gap: 28px;
}

/* Back button at top-left */
.auth-showcase-back {
  position: absolute;
  top: 24px;
  left: 24px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  z-index: 10;
}
.auth-showcase-back:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
  color: #ffffff;
}

/* Tagline */
.auth-tagline-wrap {
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-tagline {
  color: #ffffff;
  font-size: clamp(1.2rem, 2.6vw, 1.85rem);
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 1.26;
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  max-width: 480px;
}
.auth-tagline.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Dots */
.auth-carousel-dots {
  display: flex;
  gap: 7px;
  z-index: 3;
}
.auth-carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.3s, transform 0.3s;
}
.auth-carousel-dot.is-active {
  background: #d12847;
  transform: scale(1.3);
}

/* Badge */
.auth-showcase-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 10px 22px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.auth-badge-icon { font-size: 1.1rem; }

/* Floating decorative pieces */
.auth-piece {
  position: absolute;
  font-size: 3rem;
  color: rgba(255, 255, 255, 0.07);
  pointer-events: none;
  animation: authPieceFloat ease-in-out infinite;
  z-index: 1;
  line-height: 1;
  user-select: none;
}
@keyframes authPieceFloat {
  0%   { transform: translateY(0)    rotate(0deg);  }
  50%  { transform: translateY(-18px) rotate(6deg); }
  100% { transform: translateY(0)    rotate(0deg);  }
}

/* ── RESPONSIVE ──────────────────────────────── */

@media (max-width: 820px) {
  .auth-form-panel {
    flex: none;
    width: 100%;
    padding: 28px 24px 36px;
    border-right: none;
    border-bottom: 1px solid rgba(87, 115, 179, 0.18);
  }
  .auth-showcase { order: -1; min-height: 220px; }
  .auth-tagline-wrap { min-height: 72px; }
  .auth-tagline { font-size: 1.05rem; }
  .auth-showcase-badge { font-size: 0.76rem; padding: 8px 16px; }
  .auth-showcase-content { padding: 28px 24px; gap: 16px; }
  .auth-showcase-back { top: 16px; left: 16px; padding: 8px 14px; font-size: 0.8rem; }
  .auth-heading { font-size: 1.55rem; }
  .auth-field-row { grid-template-columns: 1fr; gap: 10px; }
}

@media (max-width: 480px) {
  .auth-form-panel { padding: 20px 18px 30px; }
  .auth-brand-name { font-size: 1.15rem; }
  .auth-toggle-btn { padding: 7px 18px; font-size: 0.82rem; }
  .auth-field-row { grid-template-columns: 1fr; gap: 10px; }
}
