@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,600;1,9..144,300&family=DM+Sans:wght@300;400;500&display=swap');

/* ── TOKENS ── */
:root {
  --green-dark:  #2a5f48;
  --green-mid:   #3a7a5e;
  --green-light: #4a9e7e;
  --gold:        #e8b96a;
  --gold-dark:   #c99840;
  --white:       #ffffff;
  --off-white:   #f4f8f6;
  --text-dark:   #1a2e24;
  --text-muted:  #5a7a68;
  --radius:      16px;
  --radius-sm:   10px;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'DM Sans', system-ui, sans-serif; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
.gold { color: var(--gold); }

/* ══════════════════════════════
   SPLASH — MOBILE
══════════════════════════════ */
#splash {
  position: fixed; inset: 0;
  background: linear-gradient(160deg, #2a5f48 0%, #1e4535 40%, #162e24 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
#splash::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    radial-gradient(ellipse at 20% 30%, rgba(74,158,126,0.2) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 70%, rgba(42,95,72,0.3) 0%, transparent 50%);
  pointer-events: none;
}
#splash.exit { opacity: 0; transform: scale(1.04); pointer-events: none; }

.splash-inner {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  padding: 2rem; max-width: 360px; width: 100%;
  position: relative; z-index: 1;
}
.splash-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 3rem; font-weight: 400;
  color: var(--white); letter-spacing: -0.02em;
  margin-bottom: 1rem;
}
.splash-sub {
  font-size: 0.92rem; color: rgba(255,255,255,0.65);
  line-height: 1.7; margin-bottom: 2.5rem;
}
.get-started-btn {
  background: var(--gold); color: var(--text-dark);
  border: none; padding: 0.9rem 2.5rem;
  border-radius: 100px; font-size: 1rem; font-weight: 500;
  font-family: 'DM Sans', sans-serif; cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  margin-bottom: 1.25rem; width: 100%; max-width: 280px;
}
.get-started-btn:hover { background: var(--gold-dark); transform: translateY(-2px); }
.get-started-btn:active { transform: translateY(0); }
.terms-link {
  font-size: 0.78rem; color: rgba(255,255,255,0.45);
  text-decoration: underline; cursor: pointer; transition: color 0.2s;
}
.terms-link:hover { color: rgba(255,255,255,0.7); }

/* ══════════════════════════════
   LOADING
══════════════════════════════ */
#loading {
  position: fixed; inset: 0;
  background: linear-gradient(160deg, #2a5f48 0%, #1e4535 40%, #162e24 100%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 90; opacity: 0; pointer-events: none;
  transition: opacity 0.4s ease;
}
#loading.visible { opacity: 1; pointer-events: all; }
#loading.exit { opacity: 0; pointer-events: none; }
.loading-logo {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 2rem; font-weight: 400;
  color: var(--white); margin-bottom: 3rem; letter-spacing: -0.02em;
}
.loading-logo span { color: var(--gold); }
.progress-track {
  width: 220px; height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 100px; overflow: hidden; margin-bottom: 1rem;
}
.progress-bar {
  height: 100%; background: var(--gold);
  border-radius: 100px; width: 0%;
  transition: width 0.08s linear;
}
.loading-text { font-size: 0.78rem; color: rgba(255,255,255,0.45); letter-spacing: 0.05em; }

/* ══════════════════════════════
   AUTH — MOBILE (default)
══════════════════════════════ */
#auth {
  position: fixed; inset: 0;
  background: var(--off-white);
  display: flex; flex-direction: column;
  z-index: 80; opacity: 0; pointer-events: none;
  transition: opacity 0.5s ease; overflow-y: auto;
}
#auth.visible { opacity: 1; pointer-events: all; }

/* Left branding panel — hidden on mobile */
.auth-side-panel { display: none; }

/* Form area takes full width on mobile */
.auth-form-area {
  display: flex; flex-direction: column;
  flex: 1; min-height: 100%;
}

/* Mobile top band */
.auth-top {
  background: linear-gradient(135deg, #2a5f48, #1e4535);
  padding: 2.5rem 1.5rem 3.5rem;
  text-align: center;
}
.auth-logo {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.8rem; font-weight: 400;
  color: var(--white); margin-bottom: 1.5rem; letter-spacing: -0.02em;
}
.auth-logo span { color: var(--gold); }

/* Tab switchers */
.auth-tabs {
  display: flex; background: rgba(255,255,255,0.12);
  border-radius: 100px; padding: 4px;
  max-width: 260px; margin: 0 auto;
}
.auth-tab {
  flex: 1; padding: 0.55rem; border-radius: 100px;
  border: none; background: transparent;
  color: rgba(255,255,255,0.6); font-size: 0.88rem;
  font-weight: 500; font-family: 'DM Sans', sans-serif;
  cursor: pointer; transition: all 0.25s;
}
.auth-tab.active { background: var(--white); color: var(--text-dark); }

/* Desktop tab bar inside card — hidden on mobile */
.desktop-tabs { display: none; }

/* Auth card */
.auth-card {
  background: var(--white); border-radius: 24px 24px 0 0;
  margin-top: -1.5rem; padding: 2rem 1.5rem;
  flex: 1; box-shadow: 0 -4px 24px rgba(0,0,0,0.06);
}

/* ── FORMS ── */
.auth-form { display: none; }
.auth-form.active { display: block; }
.form-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.5rem; font-weight: 300;
  color: var(--text-dark); margin-bottom: 0.35rem;
}
.form-sub { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 1.75rem; }
.form-row { display: flex; gap: 0.75rem; }
.form-group { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; flex: 1; }
.form-label {
  font-size: 0.72rem; font-weight: 500;
  color: var(--text-muted); letter-spacing: 0.05em; text-transform: uppercase;
}
.form-input {
  background: var(--off-white); border: 1.5px solid transparent;
  border-radius: var(--radius-sm); padding: 0.7rem 0.9rem;
  font-size: 0.92rem; font-family: 'DM Sans', sans-serif;
  color: var(--text-dark); outline: none;
  transition: border-color 0.2s, background 0.2s; width: 100%;
}
.form-input:focus { border-color: var(--green-light); background: var(--white); }
.form-input::placeholder { color: #aac0b8; }
.pw-wrap { position: relative; }
.pw-wrap .form-input { padding-right: 2.75rem; }
.pw-eye {
  position: absolute; right: 0.75rem; top: 50%;
  transform: translateY(-50%); color: var(--text-muted);
  cursor: pointer; display: flex; align-items: center; transition: color 0.2s;
}
.pw-eye:hover { color: var(--green-mid); }
.form-select {
  background: var(--off-white); border: 1.5px solid transparent;
  border-radius: var(--radius-sm); padding: 0.7rem 0.9rem;
  font-size: 0.92rem; font-family: 'DM Sans', sans-serif;
  color: var(--text-dark); outline: none; width: 100%;
  cursor: pointer; transition: border-color 0.2s; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235a7a68' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.9rem center;
  background-size: 12px; padding-right: 2.5rem;
}
.form-select:focus { border-color: var(--green-light); }
.form-select option { color: var(--text-dark); }
.save-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; margin-top: -0.25rem;
}
.save-check {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.82rem; color: var(--text-muted); cursor: pointer;
}
.save-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--green-mid); cursor: pointer; }
.forgot-link {
  font-size: 0.82rem; color: var(--green-mid);
  cursor: pointer; transition: color 0.2s;
}
.forgot-link:hover { color: var(--green-dark); text-decoration: underline; }
.submit-btn {
  width: 100%; background: var(--green-mid); color: var(--white);
  border: none; padding: 0.9rem; border-radius: 100px;
  font-size: 0.95rem; font-weight: 500; font-family: 'DM Sans', sans-serif;
  cursor: pointer; transition: background 0.2s, transform 0.15s;
  margin-top: 0.25rem;
}
.submit-btn:hover { background: var(--green-dark); transform: translateY(-1px); }
.submit-btn:active { transform: translateY(0); }

/* ── FORGOT SHEET ── */
#forgotOverlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 200; display: flex; align-items: flex-end;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
#forgotOverlay.visible { opacity: 1; pointer-events: all; }
.forgot-sheet {
  background: var(--white); border-radius: 24px 24px 0 0;
  padding: 2rem 1.5rem; width: 100%;
  transform: translateY(100%); transition: transform 0.35s ease;
}
#forgotOverlay.visible .forgot-sheet { transform: translateY(0); }
.forgot-sheet h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.3rem; font-weight: 300;
  color: var(--text-dark); margin-bottom: 0.35rem;
}
.forgot-sheet p { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 1.25rem; }
.close-sheet {
  position: absolute; top: 1.25rem; right: 1.5rem;
  color: var(--text-muted); cursor: pointer;
  background: var(--off-white); width: 32px; height: 32px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  border: none;
}

/* ══════════════════════════════
   DESKTOP LAYOUT (768px+)
   Left green branding panel +
   Right scrollable form
══════════════════════════════ */
@media (min-width: 768px) {

  html, body { overflow: hidden; }

  /* Auth becomes side-by-side */
  #auth {
    flex-direction: row;
    overflow: hidden;
  }

  /* Show left branding panel */
  .auth-side-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 45%;
    min-width: 320px;
    background: linear-gradient(160deg, #2a5f48 0%, #1e4535 50%, #162e24 100%);
    padding: 3rem;
    position: relative;
    flex-shrink: 0;
  }
  .auth-side-panel::before {
    content: '';
    position: absolute; inset: 0;
    background-image:
      radial-gradient(ellipse at 20% 20%, rgba(74,158,126,0.25) 0%, transparent 60%),
      radial-gradient(ellipse at 80% 80%, rgba(42,95,72,0.35) 0%, transparent 50%);
    pointer-events: none;
  }
  .side-panel-inner { position: relative; z-index: 1; }
  .side-logo {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 2.2rem; font-weight: 400;
    color: var(--white); letter-spacing: -0.02em;
    margin-bottom: 2.5rem;
  }
  .side-logo span { color: var(--gold); }
  .side-title {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.8rem; font-weight: 300;
    color: var(--white); line-height: 1.2;
    margin-bottom: 1rem; letter-spacing: -0.01em;
  }
  .side-sub {
    font-size: 0.9rem; color: rgba(255,255,255,0.65);
    line-height: 1.7; margin-bottom: 2.5rem;
  }
  .side-features {
    list-style: none; display: flex; flex-direction: column; gap: 1rem;
  }
  .side-features li {
    display: flex; align-items: center; gap: 0.75rem;
    font-size: 0.88rem; color: rgba(255,255,255,0.8);
  }
  .side-features li svg { flex-shrink: 0; opacity: 0.9; }

  /* Form area: right side, scrollable */
  .auth-form-area {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: #ffffff;
  }

  /* Hide mobile top green band on desktop */
  .auth-top { display: none; }

  /* Auth card: no rounded top, fills height */
  .auth-card {
    flex: 1;
    border-radius: 0;
    margin-top: 0;
    box-shadow: none;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #ffffff;
  }

  /* Constrain and centre form content on desktop */
  .auth-card > * { width: 100%; max-width: 400px; }

  /* Show desktop tab switcher inside card */
  .desktop-tabs {
    display: flex;
    background: var(--off-white);
    border-radius: 100px;
    padding: 4px;
    margin-bottom: 2rem;
    width: fit-content;
  }
  .desktop-tabs .auth-tab {
    color: var(--text-muted);
    padding: 0.5rem 1.5rem;
    font-size: 0.88rem;
  }
  .desktop-tabs .auth-tab.active {
    background: var(--green-mid);
    color: var(--white);
  }

  /* Splash: centered card on desktop */
  .splash-inner {
    max-width: 440px;
  }
  .splash-title { font-size: 4rem; }
  .splash-sub { font-size: 1rem; }
  .get-started-btn { max-width: 320px; font-size: 1.05rem; padding: 1rem 2.5rem; }

  /* Forgot overlay: centered modal on desktop */
  #forgotOverlay { align-items: center; justify-content: center; }
  .forgot-sheet {
    border-radius: 24px;
    max-width: 440px;
    transform: translateY(20px) scale(0.96);
    transition: transform 0.3s ease, opacity 0.3s ease;
  }
  #forgotOverlay.visible .forgot-sheet {
    transform: translateY(0) scale(1);
  }
}

@media (min-width: 1100px) {
  .auth-side-panel { width: 42%; }
  .auth-card { padding: 4rem; }
}