/**
 * HEALIST LOGIN PAGE
 * ==================
 * Split-panel login layout with brand panel and form panel.
 * Uses tokens from healist-tokens.css
 */

/* ============================================
   LOGIN PAGE LAYOUT
   ============================================ */

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

/* ============================================
   BRAND PANEL (Left Side)
   ============================================ */

.login-brand-panel {
  flex: 1;
  background: var(--login-brand-bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-20);
  position: relative;
  overflow: hidden;
}

.login-brand-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--login-brand-overlay);
  pointer-events: none;
}

.brand-content {
  position: relative;
  z-index: 1;
}

/* Brand Logo */
.brand-logo {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-12);
}

.brand-mark {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--brand-secondary) 0%, var(--brand-surface) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--brand-primary);
}

.brand-wordmark {
  font-family: var(--font-heading);
  font-size: var(--text-5xl);
  font-weight: var(--font-semibold);
  color: var(--brand-text-light);
  letter-spacing: var(--tracking-wider);
}

.brand-wordmark span {
  color: var(--brand-secondary);
}

/* Brand Headline */
.brand-headline {
  font-family: var(--font-heading);
  font-size: var(--text-6xl);
  font-weight: var(--font-normal);
  color: var(--brand-text-light);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-6);
}

.brand-headline em {
  color: var(--brand-secondary);
  font-style: normal;
}

/* Brand Description */
.brand-description {
  font-size: var(--text-lg);
  color: rgba(255, 255, 255, 0.7);
  line-height: var(--leading-loose);
  max-width: 420px;
  margin-bottom: var(--space-12);
}

/* Brand Credentials */
.brand-credentials {
  display: flex;
  gap: var(--space-8);
}

.credential {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.credential-icon {
  width: 40px;
  height: 40px;
  background: var(--credential-icon-bg);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
}

.credential-text {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: rgba(255, 255, 255, 0.8);
}

/* Qualifier under a credential badge (e.g. what "Clinical Grade" means) */
.credential-sub {
  display: block;
  margin-top: 2px;
  font-size: 0.7em;
  font-weight: var(--font-normal, 400);
  text-transform: none;
  letter-spacing: normal;
  color: rgba(255, 255, 255, 0.6);
}

/* ============================================
   FORM PANEL (Right Side)
   ============================================ */

.login-form-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--space-20);
  background: var(--login-form-bg);
}

/* Login Header with Logo */
.login-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-12);
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
}

.login-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-header-text h2 {
  font-family: var(--font-heading);
  font-size: var(--text-4xl);
  font-weight: var(--font-semibold);
  color: var(--brand-text);
  margin-bottom: var(--space-1);
}

.login-header-text p {
  font-size: var(--text-base);
  color: var(--brand-text-muted);
}

/* Login Form */
.login-form {
  max-width: var(--form-max-width);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* Login Divider */
.login-divider {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  color: var(--brand-text-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--brand-border);
}

/* "New to Healist.AI?" — sits directly above the Sign Up button (Vincent 2026-11-04). The form is a
   flex column with a --space-6 gap, so the negative bottom margin pulls the prompt down onto the
   button it introduces instead of floating halfway between the divider and the button. */
.login-signup-prompt {
  margin: 0 0 calc(var(--space-2) - var(--space-6));
  text-align: center;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 700;
  font-style: italic;
  color: var(--brand-primary);
}

/* Rate limits link (centered, below Sign Up) */
.login-rate-limits-link {
  text-align: center;
  margin-top: var(--space-4);
}

.login-rate-limits-link a {
  color: var(--brand-text-muted);
  text-decoration: none;
  font-size: var(--text-xs);
  transition: color var(--transition);
}

.login-rate-limits-link a:hover {
  color: var(--brand-primary);
  text-decoration: underline;
}

/* Login Footer Links */
.login-footer-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--brand-border);
}

.login-footer-links a {
  color: var(--brand-text-muted);
  text-decoration: none;
  font-size: var(--text-sm);
  transition: color var(--transition);
}

.login-footer-links a:hover {
  color: var(--brand-primary);
}

/* Login Copyright (inline, below footer links) */
.login-copyright {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--brand-text-muted);
  margin-top: var(--space-4);
}

.login-copyright strong {
  color: var(--brand-primary);
}

/* ============================================
   LOGIN FOOTER
   ============================================ */

.login-footer {
  padding: var(--space-5) var(--space-12);
  border-top: 1px solid var(--brand-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--footer-bg);
  font-size: var(--text-sm);
  color: var(--footer-text);
}

.login-footer .footer-copyright {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.login-footer .footer-links {
  display: flex;
  gap: var(--space-8);
}

.login-footer .footer-links a {
  color: var(--footer-text);
  text-decoration: none;
  transition: color var(--transition);
}

.login-footer .footer-links a:hover {
  color: var(--brand-primary);
}

/* ============================================
   RESPONSIVE - LOGIN
   ============================================ */

@media (max-width: 1200px) {
  .login-brand-panel {
    display: none;
  }
  
  .login-form-panel {
    flex: 1;
  }
}

@media (max-width: 768px) {
  .login-form-panel {
    padding: var(--space-8);
  }
  
  .login-footer {
    flex-direction: column;
    gap: var(--space-4);
    text-align: center;
    padding: var(--space-4);
  }
  
  .login-footer .footer-links {
    gap: var(--space-4);
  }
}

/* ============================================
   AUTH CONTAINER (Pre-login fallback layout)
   Migrated from styles.css → Design 4 tokens
   ============================================ */

.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-primary-dark) 0%, var(--brand-primary) 100%);
}

.auth-form {
  background: var(--brand-surface);
  padding: var(--space-8);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
}

.auth-form h2 {
  text-align: center;
  margin-bottom: var(--space-6);
  color: var(--brand-text);
  font-family: var(--font-heading);
}

/* ============================================
   REFERRAL LANDING PAGE BANNER
   ============================================ */

.rlp-referralBanner {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  margin-bottom: var(--space-4);
  background: linear-gradient(135deg, rgba(30, 58, 95, 0.05), rgba(201, 169, 98, 0.1));
  border: 1px solid var(--brand-gold);
  border-radius: var(--radius-lg);
}

.rlp-referralIcon {
  font-size: 2.5rem;
  margin-bottom: var(--space-2);
}

.rlp-referralTitle {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  color: var(--brand-navy);
  margin-bottom: var(--space-2);
}

.rlp-referralSubtext {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto;
}

.rlp-codeField {
  margin-top: var(--space-3);
}

.rlp-codeInput {
  background: var(--bg-tertiary) !important;
  color: var(--text-secondary);
  cursor: default;
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.5px;
}

@media (max-width: 768px) {
  .rlp-referralBanner {
    padding: var(--space-4) var(--space-3);
  }
  .rlp-referralTitle {
    font-size: var(--text-lg);
  }
}

/* Session Expired Banner — shown on login form after session timeout or revocation */
.login-session-banner {
  text-align: center;
  font-size: var(--text-base);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius);
  animation: login-banner-fade-in 0.3s ease-out;
}
@keyframes login-banner-fade-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   BETA CONSENT GATE (migration 113) — registration cannot proceed until both
   agreements are ticked and the full name is typed.
   TWO checkboxes on purpose: the beta terms carry an adverse clause (an unused
   account is permanently deleted at 30 days), and an adverse term buried inside
   a blanket "I agree to everything" is what gets clickwrap set aside.
   D4S palette only — navy + gold, never green (DESIGN_SYSTEM.md).
   ========================================================================= */
.consent-gate {
  margin: var(--space-5) 0 var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--brand-border, #e5e7eb);
  border-radius: var(--radius);
  background: var(--brand-surface-alt, #fbfaf6);
}
.consent-gate-title {
  margin: 0 0 var(--space-1);
  font-size: var(--text-base);
  color: var(--brand-navy, #1e3a5f);
  font-weight: 600;
}
.consent-gate-intro {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--brand-text-muted, #6b7280);
}
.consent-toggle {
  font-size: var(--text-sm);
  margin-bottom: var(--space-3);
  display: inline-block;
}
.consent-terms {
  max-height: 260px;
  overflow-y: auto;
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  background: #fff;
  border: 1px solid var(--brand-border, #e5e7eb);
  border-radius: var(--radius-sm, 8px);
  font-size: var(--text-sm);
  line-height: 1.6;
}
.consent-terms h5 {
  margin: var(--space-3) 0 var(--space-1);
  color: var(--brand-navy, #1e3a5f);
  font-size: var(--text-sm);
  font-weight: 600;
}
.consent-terms h5:first-child { margin-top: 0; }
.consent-terms ul { margin: var(--space-1) 0; padding-left: var(--space-4); }
.consent-terms p { margin: 0 0 var(--space-2); }
.consent-terms-foot {
  color: var(--brand-text-muted, #6b7280);
  font-size: var(--text-xs);
}
.consent-check {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
  line-height: 1.55;
  cursor: pointer;
}
.consent-check input[type="checkbox"] {
  margin-top: 3px;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  accent-color: var(--brand-navy, #1e3a5f);
  cursor: pointer;
}
.consent-sign { margin-top: var(--space-2); }
.consent-sign label {
  display: block;
  font-size: var(--text-xs);
  color: var(--brand-text-muted, #6b7280);
  margin-bottom: var(--space-1);
}
.consent-hint {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--brand-text-muted, #6b7280);
  margin-top: var(--space-2);
}
