/* ============================================================
   LOGIN.CSS — Auth pages (login, signup, password reset)
   ============================================================
   Auth pages use base_auth.html which doesn't load base.css,
   so we must import variables + utilities here.
   ============================================================ */
@import url('variables.css');
@import url('utilities.css');
@import url('dark_mode.css');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Layout ──
   Earlier versions pinned html/body to `overflow: hidden` and the
   login wrapper to a fixed `height: 100vh`. That broke as soon as the
   viewport was shorter than the form (e.g. laptops at 720p once the
   Turnstile widget was added — the captcha + submit button ended up
   below the fold with no way to scroll).
   The fix: use `min-height: 100vh` and allow scroll when content
   exceeds the viewport. Background still fills the screen because the
   wrapper stretches to min-height. */
html, body { height: 100%; margin: 0; }

.login-wrapper {
  background: linear-gradient(160deg, #f8fafc 0%, #f0fdfa 50%, #ccfbf1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;   /* dvh tracks the mobile viewport as the address bar shows/hides */
  padding: 1.5rem 1rem;
  box-sizing: border-box;
}

/* Signup needs scroll and top-aligns the card. */
.page-signup .login-wrapper {
  align-items: flex-start;
}

/* ── Form panel ── */
.glass-login {
  background: var(--clr-bg-card);
  border: 1px solid var(--clr-border);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.06);
  padding: 2rem 2.25rem 1.75rem;
  width: 100%;
  max-width: 440px;
}

/* Logo above form */
.auth-logo {
  text-align: center;
}
.auth-logo img {
  height: 45px;
}

.form-section {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 0.625rem;
  width: 100%;
}

.glass-form { width: 100%; display: flex; flex-direction: column; gap: 0.85rem; }

/* Turnstile widget — center the checkbox inside the form column.
   Turnstile injects a fixed-width iframe (~300px) inside its container;
   without this the widget hugs the left edge because the flex column's
   align-items defaults to `stretch`. */
.glass-form #turnstile-container,
.glass-form .cf-turnstile,
.login-form #turnstile-inline-login {
  display: flex;
  justify-content: center;
  margin: 0.25rem 0;
}

.form-section h2 {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--clr-text-dark);
  margin-bottom: 0.25rem;
  margin-top: 0.25rem;
  letter-spacing: -0.02em;
  text-align: center;
}

.form-section > p,
.form-section p:first-of-type {
  font-size: var(--text-base);
  color: var(--clr-text-muted);
  margin-bottom: 1rem;
  text-align: center;
}

/* ── Input fields ── */
.form-section .form-control {
  background: var(--clr-bg-card);
  border: 2px solid var(--clr-border);
  border-radius: var(--radius-pill);
  padding: 1rem 1.375rem;
  color: var(--clr-text-dark);
  font-size: var(--text-base);
  font-family: inherit;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-section .form-control.has-icon {
  padding-left: 2.75rem;
}

.form-section .form-control::placeholder {
  color: var(--clr-text-placeholder);
}

.form-section .form-control:focus {
  border-color: var(--clr-primary);
  box-shadow: var(--shadow-glow);
  outline: none;
}

/* Input icon */
.input-icon-wrapper {
  position: relative;
  width: 100%;
}
.input-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--clr-text-placeholder);
  font-size: 0.9rem;
  z-index: 1;
  pointer-events: none;
}

/* Password wrapper */
.password-wrapper {
  position: relative;
  width: 100%;
}
.password-wrapper .input-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
}

.toggle-password {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--clr-text-placeholder);
  font-size: var(--text-lg);
  cursor: pointer;
  padding: 0.25rem;
  transition: color var(--transition-fast);
  line-height: 1;
}
.toggle-password:hover { color: var(--clr-primary); }

/* ── Form options row ── */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  font-size: var(--text-sm);
}

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
  color: var(--clr-text-body);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  appearance: none;
  width: 1.125rem;
  height: 1.125rem;
  background: var(--clr-bg-subtle);
  border: 2px solid var(--clr-border);
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition: background var(--transition), border-color var(--transition);
  flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked {
  background: var(--clr-primary);
  border-color: var(--clr-primary);
}

.checkbox-label input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%) rotate(45deg);
  width: 4px;
  height: 7px;
  border: 2px solid white;
  border-top: none;
  border-left: none;
}

.checkbox-label input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: var(--shadow-glow);
}

/* Links */
.link-float {
  color: var(--clr-primary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: color var(--transition-fast);
}
.link-float:hover { color: var(--clr-primary-dark); text-decoration: underline; }

/* ── Primary button ── */
.form-section .btn-primary,
.btn-primary {
  background: var(--clr-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.875rem;
  width: 100%;
  font-size: var(--text-lg);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background var(--transition), transform var(--transition-fast), box-shadow var(--transition);
  box-shadow: 0 4px 14px rgba(13,148,136,0.25);
}
.form-section .btn-primary:hover,
.btn-primary:hover {
  background: var(--clr-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(13,148,136,0.35);
}
.form-section .btn-primary:active,
.btn-primary:active {
  transform: translateY(0);
}
.form-section .btn-primary:focus-visible,
.btn-primary:focus-visible {
  outline: none;
  box-shadow: var(--shadow-glow), 0 4px 14px rgba(13,148,136,0.35);
}

.btn-primary i { font-size: 0.85rem; }

/* ── Signup message ── */
.signup-msg {
  margin-top: 1rem;
  font-size: var(--text-sm);
  color: var(--clr-text-muted);
  text-align: center;
}
.signup-msg a {
  color: var(--clr-primary);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.signup-msg a:hover { color: var(--clr-primary-dark); }

/* ── Alerts ── */
.alert-container { width: 100%; }
.alert {
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  margin-bottom: 0.5rem;
}
.alert-error, .alert-danger {
  background: var(--clr-danger-bg);
  color: var(--clr-danger);
  border: 1px solid var(--clr-danger);
}
.alert-success {
  background: var(--clr-success-bg);
  color: var(--clr-success);
  border: 1px solid var(--clr-success);
}
.error-message {
  font-size: var(--text-xs);
  color: var(--clr-danger);
  margin-top: 0.25rem;
}

/* ── Password strength ── */
#strength-bar {
  border-radius: 3px;
  transition: width 0.3s, background 0.3s;
}

/* ── School autocomplete ── */
#school-suggestions {
  position: relative;
  width: 100%;
  z-index: 100;
}
#school-suggestions .autocomplete-items {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: var(--clr-bg-card);
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-xl);
  max-height: 14rem;
  overflow-y: auto;
  z-index: 999;
  box-shadow: var(--shadow-lg);
  margin-top: 4px;
  padding: 0.35rem 0;
}
#school-suggestions .autocomplete-items > div {
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  color: var(--clr-text-body);
  font-family: inherit;
  font-size: 0.925rem;
  line-height: 1.4;
  transition: background 0.15s;
  border-bottom: 1px solid var(--clr-border-light);
}
#school-suggestions .autocomplete-items > div:last-child { border-bottom: none; }
#school-suggestions .autocomplete-items > div:hover {
  background: var(--clr-primary-subtle);
}
#school-suggestions .autocomplete-items > div.autocomplete-active {
  background: var(--clr-primary-light);
  box-shadow: inset 3px 0 0 0 var(--clr-primary);
}
#school-suggestions .autocomplete-items > div strong {
  color: var(--clr-primary);
  font-weight: 700;
}

/* ── Footer ── */
.footer {
  position: absolute;
  bottom: 0.5rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: var(--text-xs);
  color: var(--clr-text-muted);
}
.footer a {
  color: var(--clr-text-muted);
  text-decoration: none;
}
.footer a:hover { color: var(--clr-primary); text-decoration: underline; }

/* ══════════════════════════════════════════════════════════════
   SIGNUP PAGE — Facebook-style full page, no card
   ══════════════════════════════════════════════════════════════ */

/* Remove card box on signup */
.page-signup .login-wrapper {
  background: var(--clr-bg-card);
  align-items: flex-start;
  padding: 0;
}
.page-signup .glass-login {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 2rem 1.5rem 3rem;
  max-width: 650px;
}
.page-signup .auth-logo {
  text-align: left;
  margin-bottom: 1.25rem;
}
.page-signup .auth-logo img {
  height: 50px;
}

/* Title + subtitle */
.su-title {
  font-size: var(--text-4xl);
  font-weight: 800;
  color: var(--clr-text-dark);
  margin: 0 0 0.4rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.su-subtitle {
  font-size: var(--text-base);
  color: var(--clr-text-muted);
  line-height: 1.55;
  margin: 0 0 1.5rem;
}

/* Form */
.su-form {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Labels */
.su-label {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--clr-text-dark);
  margin-top: 1rem;
  margin-bottom: 0.4rem;
  display: block;
}

/* Inputs — override .form-section .form-control with higher specificity */
.page-signup .form-section .su-input {
  width: 100%;
  padding: 1rem 1.15rem;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  font-size: var(--text-lg);
  font-family: inherit;
  color: var(--clr-text-dark);
  background: var(--clr-bg-subtle);
  transition: border-color var(--transition), background var(--transition);
}
.page-signup .form-section .su-input::placeholder {
  color: var(--clr-text-placeholder);
}
.page-signup .form-section .su-input:focus {
  border-color: var(--clr-primary);
  background: var(--clr-bg-card);
  outline: none;
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.12);
}

/* Field errors */
.su-error {
  font-size: var(--text-xs);
  color: var(--clr-danger);
  margin-top: 0.15rem;
}

/* Password eye */
.su-pw-wrap {
  position: relative;
}
.su-eye {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--clr-text-placeholder);
  cursor: pointer;
  font-size: var(--text-base);
  padding: 0.2rem;
}
.su-eye:hover { color: var(--clr-primary); }

/* School wrapper */
.su-school-wrap { position: relative; }

/* Terms — small grey text */
.su-terms {
  font-size: var(--text-xs);
  color: var(--clr-text-muted);
  line-height: 1.55;
  margin: 1rem 0 0.75rem;
}
.su-terms a {
  color: var(--clr-primary);
  text-decoration: none;
}
.su-terms a:hover { text-decoration: underline; }

/* Submit button */
.su-submit {
  background: var(--clr-primary);
  color: var(--clr-text-light);
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.85rem;
  width: 100%;
  font-size: var(--text-lg);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition);
}
.su-submit:hover { background: var(--clr-primary-dark); }
.su-submit:focus-visible {
  outline: none;
  box-shadow: var(--shadow-glow);
}

/* "I already have an account" */
.su-existing {
  display: block;
  text-align: center;
  margin-top: 1rem;
  padding: 0.75rem;
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-pill);
  color: var(--clr-primary);
  font-size: var(--text-base);
  font-weight: 600;
  transition: background var(--transition), border-color var(--transition);
}
.su-existing:hover {
  background: var(--clr-bg-subtle);
  border-color: var(--clr-primary);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  /* Phones: trim heading size so titles don't wrap awkwardly, and stack
     signup's side-by-side fields (both the grid rows and any legacy
     inline-flex sibling rows) into a single column. */
  .glass-login h1,
  .glass-login h2,
  .form-section h2,
  .su-title { font-size: var(--text-2xl); }
  .su-row,
  .su-row--12 { grid-template-columns: 1fr; }
  .su-form > div[style*="display:flex"] {
    flex-direction: column !important;
    gap: 1rem !important;
  }
}
@media (max-width: 480px) {
  .login-wrapper { padding: 1.5rem 1rem; }
  .glass-login { padding: 2rem 1.5rem 1.5rem; }
  .page-signup .glass-login { padding: 1.5rem 1.25rem 2.5rem; }
}

/* Respect the user's reduced-motion preference across the auth pages. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
/* Resend verification */
.resend-verify {
  margin-top: 1rem;
  text-align: center;
}
.resend-verify summary {
  font-size: var(--text-sm, 0.875rem);
  color: var(--clr-text-muted, #888);
  cursor: pointer;
  user-select: none;
}
.resend-verify summary:hover { color: var(--clr-primary, #1c8ef9); }
.resend-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  justify-content: center;
}
.resend-form input {
  flex: 1;
  max-width: 240px;
  padding: 0.5rem 0.75rem;
  font-size: var(--text-sm, 0.875rem);
}
.btn-secondary {
  padding: 0.5rem 1rem;
  font-size: var(--text-sm, 0.875rem);
  font-weight: 600;
  background: var(--clr-bg-card, #fff);
  border: 1.5px solid var(--clr-primary, #1c8ef9);
  color: var(--clr-primary, #1c8ef9);
  border-radius: var(--radius, 8px);
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover {
  background: var(--clr-primary, #1c8ef9);
  color: #fff;
}

/* Real-time availability hints */
.su-hint {
  font-size: 0.75rem;
  min-height: 1.1em;
  margin-top: 2px;
  transition: color 0.15s;
}
.su-hint-ok { color: #059669; }
.su-hint-err { color: #dc2626; }