/* ==========================================================================
   AUTH PAGES — Sign In, Sign Up, Forgot Password
   Follows the topics-page centered-card pattern with editorial refinement
   ========================================================================== */

body:has(.auth-page) {
  background: var(--sl-cream);
}

.auth-page {
  font-family: var(--font-sans);
  min-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(2rem, 5vw, 4rem) 1.5rem clamp(3rem, 5vw, 5rem);
  position: relative;
  overflow: hidden;
}

/* Decorative blob — asymmetric, behind the card */
.auth-page::before {
  content: '';
  position: absolute;
  top: -35%;
  right: -18%;
  width: 65%;
  height: 170%;
  background: var(--sl-teal-light);
  border-radius: 50% 30% 40% 50%;
  z-index: 0;
  opacity: 0.45;
  animation: auth-blob 14s ease-in-out infinite;
  pointer-events: none;
}

@keyframes auth-blob {
  0%, 100% { transform: scale(1) rotate(0deg); border-radius: 50% 30% 40% 50%; }
  33%      { transform: scale(1.02) rotate(0.8deg); border-radius: 45% 35% 45% 45%; }
  66%      { transform: scale(0.98) rotate(-0.4deg); border-radius: 55% 28% 38% 52%; }
}

/* ============================================
   EYEBROW & HEADLINE
   ============================================ */

.auth-eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--sl-teal);
  font-weight: 500;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
  opacity: 0;
  animation: auth-fade-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.05s forwards;
}

.auth-headline {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.2;
  color: var(--sl-charcoal);
  text-align: center;
  margin-bottom: var(--space-lg);
  font-weight: 400;
  letter-spacing: -0.02em;
  max-width: 22ch;
  position: relative;
  z-index: 1;
  opacity: 0;
  animation: auth-fade-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.12s forwards;
}

.auth-headline em {
  font-style: italic;
  color: var(--sl-teal);
}

/* ============================================
   CARD
   ============================================ */

.auth-card {
  width: 100%;
  max-width: 460px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  position: relative;
  z-index: 1;
  opacity: 0;
  animation: auth-fade-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.2s forwards;
}

/* Subtle left accent line — echoes topics sentence-builder */
.auth-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 2rem;
  bottom: 2rem;
  width: 3px;
  background: linear-gradient(to bottom, var(--sl-teal), var(--sl-coral));
  border-radius: 2px;
  opacity: 0.5;
}

/* ============================================
   FORM OVERRIDES — Bootstrap form_for fields
   Transform boxed Bootstrap inputs into
   bottom-border editorial style
   ============================================ */

.auth-card .form-group {
  margin-bottom: 1.25rem;
}

.auth-card .form-group label,
.auth-card .form-label,
.auth-card .form-group .form-label {
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sl-gray);
  font-weight: 600;
  margin-bottom: 0.375rem;
  font-family: var(--font-sans);
}

.auth-card .form-control {
  background: transparent;
  border: none;
  border-bottom: 2px solid rgba(1, 129, 141, 0.18);
  border-radius: 0;
  padding: 0.5rem 0.125rem;
  font-size: 1rem;
  font-family: var(--font-sans);
  color: var(--sl-charcoal);
  font-weight: 500;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  box-shadow: none;
}

.auth-card .form-control:hover {
  border-color: rgba(1, 129, 141, 0.35);
}

.auth-card .form-control:focus {
  background: transparent;
  border-color: var(--sl-teal);
  box-shadow: none;
  outline: none;
}

.auth-card .form-control::placeholder {
  color: var(--sl-gray);
  opacity: 0.4;
  font-weight: 400;
}

/* Help text (password minimum) */
.auth-card .form-text,
.auth-card small.form-text {
  font-size: 0.75rem;
  color: var(--sl-gray);
  opacity: 0.65;
  margin-top: 0.375rem;
}

/* ============================================
   REMEMBER ME — modern toggle style
   ============================================ */

.auth-remember-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1.25rem 0 0.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.auth-card .form-check,
.auth-card .form-group.check_box {
  margin-bottom: 0;
}

.auth-card .form-check-label,
.auth-card .form-check label,
.auth-card .form-group.check_box label,
.auth-card .check_box label {
  font-size: 0.8125rem !important;
  color: var(--sl-gray) !important;
  font-weight: 400 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  cursor: pointer;
}

.auth-card .form-check-input {
  width: 1rem;
  height: 1rem;
  border: 1.5px solid rgba(1, 129, 141, 0.3);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-card .form-check-input:checked {
  background-color: var(--sl-teal);
  border-color: var(--sl-teal);
}

.auth-card .form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(1, 129, 141, 0.15);
  border-color: var(--sl-teal);
}

/* Forgot password link */
.auth-forgot-link {
  font-size: 0.8125rem;
  color: var(--sl-teal);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast), opacity var(--transition-fast);
  opacity: 0.8;
}

.auth-forgot-link:hover {
  color: var(--sl-teal-dark);
  opacity: 1;
  text-decoration: none;
}

/* ============================================
   SUBMIT BUTTON — coral gradient override
   Applied to the ButtonComponent wrapper
   ============================================ */

.auth-actions {
  margin-top: 1.75rem;
}

.auth-actions button,
.auth-actions .auth-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.9375rem 2rem;
  background: linear-gradient(135deg, var(--sl-coral) 0%, var(--sl-coral-dark) 100%) !important;
  color: white !important;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-sans);
  border: none;
  border-radius: var(--radius-full) !important;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(224, 122, 95, 0.3);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.auth-actions button::before,
.auth-actions .auth-submit::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
  pointer-events: none;
}

.auth-actions button:hover,
.auth-actions .auth-submit:hover {
  background: linear-gradient(135deg, var(--sl-coral-dark) 0%, #B55D47 100%) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(224, 122, 95, 0.4);
}

/* ============================================
   GOOGLE BUTTON — wider, rounder, prominent
   ============================================ */

.auth-google {
  margin-bottom: 0.25rem;
}

.auth-google .gsi-material-button {
  border-radius: var(--radius-full);
  height: 48px;
  border-color: rgba(0, 0, 0, 0.08);
  font-family: var(--font-sans);
  font-weight: 500;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-google .gsi-material-button:hover {
  border-color: rgba(1, 129, 141, 0.2);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}

.auth-google .gsi-material-button .gsi-material-button-contents {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.9375rem;
}

/* ============================================
   DIVIDER — "or" separator
   ============================================ */

.auth-divider {
  display: flex;
  align-items: center;
  margin: 1.25rem 0;
  gap: 1rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(1, 129, 141, 0.15), transparent);
}

.auth-divider span {
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sl-gray);
  font-weight: 500;
  opacity: 0.6;
}

/* ============================================
   ERROR MESSAGES
   ============================================ */

.auth-card #error_explanation {
  background: rgba(224, 122, 95, 0.06);
  border: 1px solid rgba(224, 122, 95, 0.15);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.auth-card #error_explanation h2 {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--sl-coral-dark);
  margin-bottom: 0.5rem;
  font-family: var(--font-sans);
}

.auth-card #error_explanation ul {
  margin: 0;
  padding-left: 1rem;
}

.auth-card #error_explanation li {
  font-size: 0.8125rem;
  color: var(--sl-coral-dark);
  line-height: 1.5;
}

/* ============================================
   FOOTER LINK — back to sign in / sign up
   ============================================ */

.auth-footer {
  text-align: center;
  margin-top: var(--space-md);
  position: relative;
  z-index: 1;
  opacity: 0;
  animation: auth-fade-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.35s forwards;
}

.auth-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: var(--sl-gray);
  text-decoration: none;
  transition: color var(--transition-fast);
  opacity: 0.7;
}

.auth-footer-link:hover {
  color: var(--sl-teal);
  opacity: 1;
  text-decoration: none;
}

.auth-footer-text {
  font-size: 0.875rem;
  color: var(--sl-gray);
  opacity: 0.6;
}

.auth-footer-text a {
  color: var(--sl-teal);
  text-decoration: none;
  font-weight: 500;
  opacity: 1;
}

.auth-footer-text a:hover {
  color: var(--sl-teal-dark);
  text-decoration: underline;
}

/* ============================================
   SUBTITLE TEXT
   ============================================ */

.auth-subtitle {
  font-size: 0.9375rem;
  color: var(--sl-gray);
  text-align: left;
  line-height: 1.6;
  margin-bottom: 1.25rem;
  font-weight: 300;
}

/* ============================================
   CONFIRMATION LINK BUTTON
   ============================================ */

.auth-secondary-action {
  margin-top: 0.75rem;
}

.auth-secondary-action button,
.auth-secondary-action a {
  background: transparent !important;
  border: 1.5px solid var(--sl-gray) !important;
  color: var(--sl-gray) !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

.auth-secondary-action button:hover,
.auth-secondary-action a:hover {
  border-color: var(--sl-teal) !important;
  color: var(--sl-teal) !important;
  background: rgba(1, 129, 141, 0.04) !important;
  transform: translateY(-1px);
  box-shadow: none !important;
}

/* ============================================
   ANIMATION
   ============================================ */

@keyframes auth-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 575px) {
  .auth-page {
    padding: var(--space-lg) 1rem var(--space-xl);
  }

  .auth-card {
    padding: 1.25rem;
  }

  .auth-card::before {
    display: none;
  }

  .auth-page::before {
    display: none;
  }

  .auth-remember-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.auth-page *:focus-visible {
  outline: 2px solid var(--sl-teal);
  outline-offset: 3px;
}

.auth-card .form-control:focus-visible {
  outline: none;
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .auth-page::before { animation: none; }

  .auth-eyebrow,
  .auth-headline,
  .auth-card,
  .auth-footer {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .auth-actions button,
  .auth-google .gsi-material-button,
  .auth-card .form-control {
    transition: none;
  }
}
