/* FlexContext Auth Page
   Sliding-panel design: dark form halves + gradient overlay that slides between them
   ─────────────────────────────────────────────────────────────────────────────── */

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

:root {
  --bg:     #080c1a;
  --s1:     #0e1228;
  --s2:     #131830;
  --border: #1e2548;
  --text:   #edf0ff;
  --text2:  #5e6f9e;
  --text3:  #273060;
  --r:      20px;
  --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: hidden;
}

/* Dot grid background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, #1e2548 1px, transparent 1px);
  background-size: 30px 30px;
  opacity: 0.45;
  pointer-events: none;
  z-index: 0;
}

/* Ambient radial glow */
body::after {
  content: '';
  position: fixed;
  width: 700px;
  height: 700px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(97,113,246,0.08) 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;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  margin-bottom: 36px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  transition: opacity 0.18s;
}
.auth-brand:hover { opacity: 0.8; }

.auth-brand img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: block;
}

.auth-brand em {
  font-style: normal;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── SLIDING CONTAINER ── */
.auth-container {
  position: relative;
  width: 820px;
  max-width: 100%;
  min-height: 540px;
  overflow: hidden;
  border-radius: var(--r);
  box-shadow:
    0 40px 100px rgba(0,0,0,0.7),
    0 0 0 1px rgba(97,113,246,0.08),
    inset 0 1px 0 rgba(255,255,255,0.02);
}

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

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

.form-container h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-optical-sizing: auto;
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}

.form-sub {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 4px;
  line-height: 1.5;
}

/* Sign-in starts left */
.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;
}

/* ── ACTIVE STATE: right panel ── */
.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: 5px;
}

.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(--s2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  width: 100%;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.field input:focus {
  border-color: rgba(97,113,246,0.5);
  box-shadow: 0 0 0 3px rgba(97,113,246,0.08);
}
.field input::placeholder { color: var(--text3); }

.submit-btn {
  width: 100%;
  background: var(--grad);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 12px;
  cursor: pointer;
  margin-top: 6px;
  transition: opacity 0.18s, transform 0.18s, box-shadow 0.18s;
}
.submit-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
  box-shadow: 0 8px 26px rgba(97,113,246,0.3);
}
.submit-btn:active { transform: none; opacity: 0.95; }

.alert {
  padding: 10px 13px;
  border-radius: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.01em;
  line-height: 1.5;
}
.alert-error { background: rgba(239,68,68,0.08);  border: 1px solid rgba(239,68,68,0.22);  color: #fca5a5; }
.alert-ok    { background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.22); color: #6ee7b7; }

/* ── 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%);
}

/* The overlay is 200% wide so both panels fit 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 texture on the 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.18;
  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: 16px;
  padding: 52px 36px;
  text-align: center;
  transition: transform 0.65s ease-in-out;
}

.overlay-left {
  /* Left panel: hidden off screen to the left initially */
  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 panel content */
.overlay-logo {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  margin-bottom: 2px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

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

.overlay-panel p {
  font-size: 13.5px;
  color: rgba(255,255,255,0.72);
  max-width: 210px;
  line-height: 1.68;
}

.overlay-btn {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.6);
  border-radius: 30px;
  color: #fff;
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 10px 30px;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s, border-color 0.2s, transform 0.18s;
}
.overlay-btn:hover {
  background: rgba(255,255,255,0.14);
  border-color: #fff;
  transform: translateY(-1px);
}

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

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

  .auth-container {
    min-height: 560px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(97,113,246,0.1);
  }

  /* Both panels stack vertically; translateY drives the slide */
  .form-container {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    padding: 40px 28px !important;
    opacity: 1 !important;
    z-index: 1 !important;
    animation: none !important;
    /* vertical slide only — override desktop's `transition: all` */
    transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }

  /* Sign-in visible by default */
  .sign-in-container {
    transform: translateY(0) !important;
    z-index: 2 !important;
  }

  /* Sign-up waits below the viewport */
  .sign-up-container {
    transform: translateY(100%) !important;
    z-index: 1 !important;
  }

  /* Switch to register: sign-in exits up, sign-up enters from below */
  .right-panel-active .sign-in-container {
    transform: translateY(-100%) !important;
    z-index: 1 !important;
  }

  .right-panel-active .sign-up-container {
    transform: translateY(0) !important;
    z-index: 2 !important;
  }

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

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

  .mobile-switch-btn {
    background: none;
    border: none;
    color: #6171f6;
    font-family: 'Sora', system-ui, sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 3px;
  }
  .mobile-switch-btn:hover { opacity: 0.75; }
}
