/* ============================================================
   auth.css — Login.html & Signup.html
   Desktop  (>680px) : two-column, branding left / form right
   Mobile  (≤680px)  : full-screen app-native card
                       Respects light/dark theme automatically
   ============================================================ */

/* ── Section & container ──────────────────────────────────── */
.auth-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 90px 48px 60px;
}

.auth-container {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
}

/* ── LEFT: Branding ───────────────────────────────────────── */
.auth-left {
  display: flex;
  flex-direction: column;
}

.auth-branding {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
}

.auth-branding img {
  height: 48px;
  filter: drop-shadow(0 0 8px rgba(42,157,120,0.55))
          drop-shadow(0 0 16px rgba(184,137,42,0.35));
}

/* ── RIGHT: Form column ───────────────────────────────────── */
.auth-right {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-form-wrapper {
  width: 100%;
  max-width: 420px;
}

/* ── Desktop form elements ────────────────────────────────── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 2px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.form-input {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
  box-sizing: border-box;
}

.form-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-subtle);
}

.form-input::placeholder { color: var(--ink3); }
.form-hint  { font-size: 11px; color: var(--ink3); font-weight: 300; }
.form-error { font-size: 11px; color: var(--crimson); font-weight: 500; min-height: 14px; }

.form-status {
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  min-height: 18px;
}
.form-status.success { color: var(--teal); }
.form-status.error   { color: var(--crimson); }

/* ── Desktop Google button ────────────────────────────────── */
.auth-google-btn-desktop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--sans);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  margin-top: 8px;
}
.auth-google-btn-desktop:hover {
  border-color: var(--gold);
  background: var(--surface);
}

/* ── Desktop divider ──────────────────────────────────────── */
.auth-divider-desktop {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 4px;
  color: var(--ink3);
  font-size: 12px;
}
.auth-divider-desktop::before,
.auth-divider-desktop::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Mobile-only elements hidden on desktop ───────────────── */
.auth-mobile-top         { display: none; }
.auth-divider-mobile     { display: none; }
.auth-google-btn-mobile  { display: none; }
.auth-bottom-link        { display: none; }
.form-input-wrap .input-icon { display: none; }
.form-input-wrap .input-eye  { display: none; }

/* ── Tablet ───────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .auth-container {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .auth-right { justify-content: flex-start; }
}


/* ════════════════════════════════════════════════════════════
   MOBILE  ≤680px
   Uses CSS vars throughout — automatically inherits whatever
   theme (light or dark) the user already has active via
   html.light-theme set by main.js.
   ════════════════════════════════════════════════════════════ */
@media (max-width: 680px) {

  .navbar { display: none; }
  footer  { display: none; }

  /* Full-screen, uses the page's own background var */
  .auth-section {
    padding: 0;
    align-items: stretch;
    background: var(--surface);   /* dark mode: near-black | light mode: off-white */
    min-height: 100vh;
    min-height: 100dvh;
  }

  .auth-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 100%;
    padding: 0;
    gap: 0;
  }

  .auth-left { display: none; }

  .auth-right {
    flex: 1;
    align-items: flex-start;
    justify-content: center;
    padding: 52px 24px 48px;
    overflow-y: auto;
  }

  .auth-form-wrapper {
    max-width: 100%;
    width: 100%;
  }

  /* ── Mobile logo block ───────────────────────────────────── */
  .auth-mobile-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 32px;
    text-align: center;
  }

  .mob-logo-wrap {
    width: 68px;
    height: 68px;
    background: linear-gradient(135deg, #2fc99a, #d4a030);
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 8px 28px rgba(212,160,48,0.22);
  }

  /* Logo image: invert in dark mode, keep natural in light mode */
  .mob-logo-wrap img {
    height: 38px;
    filter: brightness(0) invert(1);      /* dark mode default */
  }
  html.light-theme .mob-logo-wrap img {
    filter: brightness(0) invert(1);      /* gradient bg is always dark so keep inverted */
  }

  .mob-title {
    font-family: var(--serif);
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--ink);                    /* dark: off-white | light: near-black */
    margin-bottom: 6px;
    letter-spacing: -0.3px;
  }

  .mob-sub {
    font-size: 13px;
    color: var(--ink3);
    line-height: 1.5;
  }

  /* ── Hide desktop heading on mobile ─────────────────────── */
  .auth-desktop-heading { display: none !important; }

  /* ── Form labels: hidden, icons + placeholders take over ─── */
  .form-group label { display: none; }

  .form-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
  }

  .form-input-wrap .input-icon {
    display: block;
    position: absolute;
    left: 16px;
    font-size: 16px;
    pointer-events: none;
    color: var(--ink3);
    line-height: 1;
    z-index: 1;
  }

  .form-input-wrap .input-eye {
    display: block;
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ink3);
    font-size: 16px;
    padding: 0;
    line-height: 1;
    z-index: 1;
  }
  .form-input-wrap .input-eye:hover { color: var(--ink); }

  /* ── Inputs: pill shape, use theme vars ──────────────────── */
  .form-input {
    background: var(--card) !important;
    border: 1px solid var(--border) !important;
    border-radius: 14px !important;
    padding: 16px 16px 16px 46px !important;
    font-size: 14px !important;
    color: var(--ink) !important;
    box-sizing: border-box;
  }

  .form-input.has-eye { padding-right: 44px !important; }

  .form-input:focus {
    border-color: var(--gold) !important;
    box-shadow: 0 0 0 3px var(--gold-subtle) !important;
    background: var(--card) !important;
  }

  .form-input::placeholder { color: var(--ink3) !important; }

  /* ── Terms checkbox row ──────────────────────────────────── */
  /* Uses a tinted version of the card bg — slightly green-tinted */
  .mob-terms-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 4px;
    font-size: 12px;
    color: var(--ink2);
    line-height: 1.5;
  }
  /* Extra green tint in dark mode only */
  html:not(.light-theme) .mob-terms-row {
    background: rgba(47, 201, 154, 0.07);
    border-color: rgba(47, 201, 154, 0.2);
    color: #5a9a6a;
  }
  .mob-terms-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
    accent-color: #2fc99a;
  }
  .mob-terms-row a { color: var(--gold); text-decoration: none; }

  /* ── Primary CTA button ──────────────────────────────────── */
  button[type="submit"].btn.btn-gold {
    width: 100% !important;
    padding: 16px !important;
    border-radius: 16px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    letter-spacing: 0.3px;
    background: linear-gradient(135deg, #d4a030, #b8892a) !important;
    border: none !important;
    color: #0f0e0c !important;
    margin-bottom: 4px !important;
    box-shadow: 0 6px 20px rgba(212,160,48,0.25) !important;
    cursor: pointer;
  }

  /* ── Divider ─────────────────────────────────────────────── */
  .auth-divider-desktop { display: none; }

  .auth-divider-mobile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0 4px;
    color: var(--ink3);
    font-size: 12px;
  }
  .auth-divider-mobile::before,
  .auth-divider-mobile::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
  }

  /* ── Google button (mobile) ──────────────────────────────── */
  .auth-google-btn-desktop { display: none !important; }

  .auth-google-btn-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 15px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--ink);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--sans);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-top: 4px;
    box-sizing: border-box;
  }
  .auth-google-btn-mobile:hover {
    border-color: var(--gold);
    background: var(--surface);
  }

  /* ── Bottom sign-in/up link ──────────────────────────────── */
  .auth-bottom-link {
    display: block;
    text-align: center;
    margin-top: 28px;
    font-size: 13px;
    color: var(--ink3);
  }
  .auth-bottom-link a {
    color: var(--teal);
    font-weight: 600;
    text-decoration: none;
  }

  .auth-desktop-bottom { display: none !important; }

  /* form-status, hint, error colours already use vars — no change needed */
  .auth-form { gap: 12px; }
  .form-group { margin-bottom: 0; }
}


/* ── Modal ────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(8,8,16,0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
html.light-theme .modal { background: rgba(250,248,245,0.92); }

.modal-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}