/* FlexContext Auth Page
   Light/white theme with dot-grid, wider sliding panels
   ─────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #f5f6fa;
  --panel:    #ffffff;
  --border:   #e2e5f0;
  --input-bg: #f4f5f9;
  --text:     #0f1117;
  --text2:    #6b7280;
  --text3:    #c0c4d6;
  --accent:   #6171f6;
  --r:        22px;
  --grad:     linear-gradient(135deg, #4facfe 0%, #6171f6 55%, #7c5cfc 100%);
}

html, body {
  height: 100%;
  font-family: 'Sora', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  overflow-y: auto;
}

/* White dot-grid — matches main app */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(91,110,245,0.13) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

/* Soft ambient glow */
body::after {
  content: '';
  position: fixed;
  width: 800px;
  height: 800px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(97,113,246,0.06) 0%, transparent 65%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
}

/* ── PAGE WRAPPER ── */
.auth-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

/* ── BRAND LINK ── */
.auth-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--text);
  margin-bottom: 32px;
  font-family: 'Audiowide', sans-serif;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0;
  transition: opacity 0.18s;
}
.auth-brand:hover { opacity: 0.7; }

/* ── SLIDING CONTAINER ── */
.auth-container {
  position: relative;
  width: 960px;
  max-width: 100%;
  min-height: 660px;
  overflow: hidden;
  border-radius: var(--r);
  box-shadow:
    0 2px 0 rgba(255,255,255,0.9) inset,
    0 20px 60px rgba(15,17,34,0.10),
    0 0 0 1px rgba(97,113,246,0.12);
}

/* ── FORM PANELS ── */
.form-container {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 52px;
  background: var(--panel);
  transition: all 0.65s ease-in-out;
}

.form-container form {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-container h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-optical-sizing: auto;
  font-size: 2.1rem;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.025em;
  margin-bottom: 2px;
}

.form-sub {
  font-size: 13.5px;
  color: var(--text2);
  margin-bottom: 2px;
  line-height: 1.55;
}

/* Sign-in starts left (50% wide) */
.sign-in-container {
  left: 0;
  width: 50%;
  z-index: 2;
}

/* Sign-up starts hidden behind overlay */
.sign-up-container {
  left: 0;
  width: 50%;
  opacity: 0;
  z-index: 1;
}

.auth-container.single-panel {
  width: 520px;
  min-height: 0;
  height: auto;
}

.auth-container.single-panel .sign-in-container {
  position: relative;
  left: auto;
  width: 100%;
  height: auto;
  transform: none;
  opacity: 1;
}

.auth-container.single-panel .sign-up-container,
.auth-container.single-panel .overlay-container {
  display: none;
}

/* ── ACTIVE STATE ── */
.right-panel-active .sign-in-container {
  transform: translateX(100%);
}

.right-panel-active .sign-up-container {
  transform: translateX(100%);
  opacity: 1;
  z-index: 5;
  animation: show 0.65s;
}

@keyframes show {
  0%, 49.99% { opacity: 0; z-index: 1; }
  50%, 100%  { opacity: 1; z-index: 5; }
}

/* ── FORM FIELDS ── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  color: var(--text2);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.field input {
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 14px;
  padding: 11px 15px;
  outline: none;
  width: 100%;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.field input:focus {
  background: #fff;
  border-color: rgba(97,113,246,0.5);
  box-shadow: 0 0 0 3px rgba(97,113,246,0.1);
}
.field input::placeholder { color: var(--text3); }

.auth-forgot-row {
  display: flex;
  justify-content: flex-end;
  margin-top: -4px;
}

.auth-forgot-row a,
.auth-alt-link a {
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}

.auth-forgot-row a:hover,
.auth-alt-link a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-alt-link {
  color: var(--text2);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.field-hint {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text2);
  line-height: 1.4;
}
.field-hint.ok { color: #059669; }
.field-hint.error { color: #dc2626; }


.password-requirements {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 10px;
  list-style: none;
  padding: 2px 0 0;
}

.password-requirements li {
  position: relative;
  padding-left: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  line-height: 1.4;
  color: var(--text2);
}

.password-requirements li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid #c8cedd;
  background: #fff;
}

.password-requirements li.met {
  color: #047857;
}

.password-requirements li.met::before {
  border-color: #10b981;
  background: #10b981;
  box-shadow: inset 0 0 0 2px #fff;
}

/* ── SUBMIT BUTTON ── */
.submit-btn {
  width: 100%;
  background: var(--grad);
  color: #fff;
  border: none;
  border-radius: 11px;
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 13px;
  cursor: pointer;
  margin-top: 4px;
  transition: opacity 0.18s, transform 0.18s, box-shadow 0.18s;
}
.submit-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(97,113,246,0.28);
}
.submit-btn:active { transform: none; opacity: 0.95; }
.submit-btn:disabled {
  cursor: not-allowed;
  opacity: 0.52;
  transform: none;
  box-shadow: none;
}

/* ── ALERTS ── */
.alert {
  padding: 10px 14px;
  border-radius: 11px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.01em;
  line-height: 1.55;
}
.alert-error { background: rgba(239,68,68,0.07);  border: 1px solid rgba(239,68,68,0.2);  color: #dc2626; }
.alert-ok    { background: rgba(16,185,129,0.07); border: 1px solid rgba(16,185,129,0.2); color: #059669; }

/* ── OVERLAY CONTAINER ── */
.overlay-container {
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 100%;
  overflow: hidden;
  transition: transform 0.65s ease-in-out;
  z-index: 100;
}

.right-panel-active .overlay-container {
  transform: translateX(-100%);
}

/* 200%-wide strip so both overlay panels sit side by side */
.overlay {
  background: var(--grad);
  position: relative;
  left: -100%;
  height: 100%;
  width: 200%;
  transform: translateX(0);
  transition: transform 0.65s ease-in-out;
}

.right-panel-active .overlay {
  transform: translateX(50%);
}

/* Subtle noise on gradient */
.overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.14;
  pointer-events: none;
}

/* ── OVERLAY PANELS ── */
.overlay-panel {
  position: absolute;
  top: 0;
  height: 100%;
  width: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  padding: 52px 40px;
  text-align: center;
  transition: transform 0.65s ease-in-out;
}

.overlay-left {
  transform: translateX(-20%);
}

.overlay-right {
  right: 0;
  transform: translateX(0);
}

.right-panel-active .overlay-left  { transform: translateX(0); }
.right-panel-active .overlay-right { transform: translateX(20%); }

.overlay-wordmark {
  font-family: 'Audiowide', sans-serif;
  font-size: 17px;
  font-weight: 400;
  color: #fff;
  letter-spacing: 0;
  margin-bottom: 4px;
  opacity: 0.9;
}

.overlay-panel h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-optical-sizing: auto;
  font-style: italic;
  font-size: 2.2rem;
  font-weight: 400;
  color: #fff;
  letter-spacing: -0.025em;
}

.overlay-panel p {
  font-size: 14px;
  color: rgba(255,255,255,0.76);
  max-width: 220px;
  line-height: 1.65;
}

.overlay-btn {
  background: rgba(255,255,255,0.15);
  border: 1.5px solid rgba(255,255,255,0.55);
  border-radius: 30px;
  color: #fff;
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 11px 34px;
  cursor: pointer;
  margin-top: 4px;
  backdrop-filter: blur(4px);
  transition: background 0.2s, border-color 0.2s, transform 0.18s;
}
.overlay-btn:hover {
  background: rgba(255,255,255,0.26);
  border-color: #fff;
  transform: translateY(-1px);
}

/* ── MOBILE SWITCH (hidden on desktop) ── */
.mobile-switch { display: none; }

/* ── RESPONSIVE ── */
@media (max-width: 760px) {
  html, body { overflow: auto; }

  .auth-page {
    padding: 24px 16px;
    padding-top: max(40px, calc(env(safe-area-inset-top) + 24px));
    padding-bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    justify-content: flex-start;
  }

  /* Prevent iOS auto-zoom on input focus */
  .field input { font-size: 16px; }

  /* Ensure 44px minimum touch targets */
  .field input { min-height: 44px; }
  .submit-btn  { min-height: 48px; }

  .auth-brand {
    margin-bottom: 24px;
  }

  .auth-container {
    width: 100%;
    min-height: 0;
    border-radius: 18px;
    overflow: hidden;
    box-shadow:
      0 2px 0 rgba(255,255,255,0.9) inset,
      0 12px 40px rgba(15,17,34,0.10),
      0 0 0 1px rgba(97,113,246,0.12);
  }

  .auth-container.single-panel {
    width: 100%;
    min-height: 0;
  }

  /* Full-width stacked panels; vertical slide replaces horizontal */
  .form-container {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 44px 28px 40px !important;
    opacity: 1 !important;
    animation: none !important;
    transition: none !important;
  }

  .form-container form {
    max-width: 100%;
  }

  /* Sign-in shown by default; sign-up hidden */
  .sign-in-container {
    display: block !important;
    z-index: 2 !important;
    transform: none !important;
  }

  .sign-up-container {
    display: none !important;
  }

  /* When register is active, flip visibility */
  .right-panel-active .sign-in-container {
    display: none !important;
    transform: none !important;
  }

  .right-panel-active .sign-up-container {
    display: block !important;
    transform: none !important;
    opacity: 1 !important;
    z-index: 2 !important;
  }

  /* Kill the overlay strip on mobile */
  .overlay-container { display: none !important; }

  /* Show in-form toggle links */
  .mobile-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 13.5px;
    color: var(--text2);
    margin-top: 6px;
  }

  .mobile-switch-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-family: 'Sora', system-ui, sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 3px;
  }
  .mobile-switch-btn:hover { opacity: 0.7; }
}

@media (max-width: 400px) {
  .form-container {
    padding: 36px 20px 32px !important;
  }
  .form-container h2 { font-size: 1.75rem; }
}
