/* ============================================================
   Laeka Brain — Login Page Custom Skin v3
   Split layout (form left / visual right) + canonical nav/footer
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Instrument+Serif:ital@0;1&display=swap');

/* ── Root tokens ── */
:root {
  --laeka-beige:       #F5F0E6;
  --laeka-beige-dark:  #EFE9DC;
  --laeka-beige-mid:   #E8E0CC;
  --laeka-navy:        #1E3A5F;
  --laeka-black:       #0A0A0A;
  --laeka-text-muted:  #6B7280;
}

/* ── Base fonts ── */
body {
  font-family: 'Inter', system-ui, sans-serif;
}

/* ── Outer wrapper: real LibreChat auth selector ──
   Actual DOM class: "relative flex min-h-screen flex-col bg-white dark:bg-gray-900"
   We target it when it contains the auth main element
*/
.relative.flex.min-h-screen.flex-col.bg-white:has(main.flex.flex-grow) {
  background-color: var(--laeka-beige) !important;
  padding-top: 64px; /* compensate for fixed nav */
}

/* Dark mode on login — force beige regardless of user pref */
.dark .relative.flex.min-h-screen.flex-col.bg-white:has(main.flex.flex-grow),
.relative.flex.min-h-screen.flex-col:has(main.flex.flex-grow) {
  background-color: var(--laeka-beige) !important;
}

/* ── Desktop: grid 2-col split ── */
@media (min-width: 1024px) {
  .relative.flex.min-h-screen.flex-col.bg-white:has(main.flex.flex-grow) {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    /* Positioning context for ::after — height grows with content */
    min-height: calc(100vh - 64px);
    height: auto !important;
    position: relative;
  }

  /* Right panel — absolute within the login wrapper, not fixed to viewport.
     This ensures it does NOT overlap the footer which lives outside this wrapper. */
  .relative.flex.min-h-screen.flex-col.bg-white:has(main.flex.flex-grow)::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background-image:
      radial-gradient(circle at 55% 45%, #EFE9DC 0%, #E8E0CC 50%, #DDD5C0 100%);
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    z-index: 0;
    pointer-events: none;
  }

  /* Main form — left col scrolls with the document */
  .relative.flex.min-h-screen.flex-col.bg-white:has(main.flex.flex-grow) > main {
    grid-column: 1;
    background: var(--laeka-beige) !important;
  }

  /* Footer/bottom strip — left col only */
  .relative.flex.min-h-screen.flex-col.bg-white:has(main.flex.flex-grow) > div:last-of-type {
    grid-column: 1;
    background: var(--laeka-beige) !important;
  }

  /* Logo strip — left col */
  .relative.flex.min-h-screen.flex-col.bg-white:has(main.flex.flex-grow) > div:first-of-type {
    grid-column: 1;
    background: var(--laeka-beige) !important;
  }
}

/* ── Main form area ── */
.relative.flex.min-h-screen.flex-col.bg-white:has(main.flex.flex-grow) > main {
  background: var(--laeka-beige) !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 2rem 2rem;
  position: relative;
  z-index: 1;
}

/* ── Form card (w-authPageWidth) ── */
.w-authPageWidth {
  background: #FFFFFF !important;
  border-radius: 16px !important;
  box-shadow: 0 4px 32px rgba(10, 10, 10, 0.08) !important;
  padding: 2.5rem !important;
  max-width: 420px !important;
  width: 100% !important;
}

/* Login heading */
.w-authPageWidth h1 {
  font-family: 'Instrument Serif', Georgia, serif !important;
  font-weight: 400 !important;
  font-size: 1.875rem !important;
  color: var(--laeka-black) !important;
  letter-spacing: -0.02em !important;
  margin-bottom: 1.5rem !important;
}

/* Input fields */
.w-authPageWidth input[type="email"],
.w-authPageWidth input[type="password"],
.w-authPageWidth input[type="text"] {
  background: #FAFAF8 !important;
  border: 1px solid #E5E0D5 !important;
  border-radius: 8px !important;
  padding: 0.625rem 1rem !important;
  font-family: 'Inter', system-ui !important;
  font-size: 0.9375rem !important;
  color: var(--laeka-black) !important;
  transition: border-color 0.15s ease !important;
}

.w-authPageWidth input:focus {
  border-color: var(--laeka-navy) !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12) !important;
}

/* Primary submit button */
.w-authPageWidth button[type="submit"] {
  background: var(--laeka-navy) !important;
  color: #FFFFFF !important;
  border-radius: 8px !important;
  font-family: 'Inter', system-ui !important;
  font-weight: 500 !important;
  font-size: 0.9375rem !important;
  letter-spacing: 0.01em !important;
  transition: background 0.15s ease !important;
  border: none !important;
}

.w-authPageWidth button[type="submit"]:hover {
  background: #162D4A !important;
}

/* Google OAuth button */
.w-authPageWidth button[aria-label*="Google"],
.w-authPageWidth button[data-provider="google"],
.w-authPageWidth a[href*="/oauth/google"],
.w-authPageWidth [class*="social"] {
  border: 1px solid #E5E0D5 !important;
  border-radius: 8px !important;
  background: #FFFFFF !important;
  color: var(--laeka-black) !important;
  font-family: 'Inter', system-ui !important;
  font-weight: 500 !important;
  transition: border-color 0.15s ease, background 0.15s ease !important;
}

.w-authPageWidth button[aria-label*="Google"]:hover {
  background: var(--laeka-beige) !important;
  border-color: #C8C2B5 !important;
}

/* Links (forgot password, register) */
.w-authPageWidth a {
  color: var(--laeka-navy) !important;
  text-decoration: none !important;
}

.w-authPageWidth a:hover {
  text-decoration: underline !important;
}

/* ── Caption on right panel (login page only) ── */
#laeka-login-caption {
  display: none;
}

@media (min-width: 1024px) {
  #laeka-login-caption {
    display: block;
    /* absolute within .relative wrapper (which has position:relative) */
    position: absolute;
    right: 0;
    bottom: 12%;
    width: 50%;
    text-align: center;
    padding: 0 3.5rem;
    z-index: 1;
    pointer-events: none;
  }

  #laeka-login-caption .laeka-title {
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: italic;
    font-size: 1.625rem;
    color: var(--laeka-navy);
    margin-bottom: 0.625rem;
    display: block;
    line-height: 1.3;
  }

  #laeka-login-caption .laeka-subtitle {
    font-family: 'Inter', system-ui;
    font-size: 0.9375rem;
    color: var(--laeka-text-muted);
    display: block;
    line-height: 1.6;
    max-width: 320px;
    margin: 0 auto;
  }
}

/* ── Logo strip above form — hidden (sigil already in nav, no duplicate needed) ── */
.mt-6.h-10.w-full {
  display: none !important;
}

/* ── Beige background for surrounding divs ── */
.relative.flex.min-h-screen.flex-col.bg-white:has(main.flex.flex-grow) > div {
  background: var(--laeka-beige) !important;
}

/* ── Body background for auth pages (prevents white strip between form and footer) ── */
body:has(.relative.flex.min-h-screen.flex-col:has(main.flex.flex-grow)) {
  background-color: var(--laeka-beige) !important;
}

/* ── Fill the gap between auth wrapper and footer (html/body base color) ── */
html, body {
  background-color: var(--laeka-beige) !important;
}

/* ── Footer: override LibreChat Tailwind blue-bold bleed ── */
.lk-footer,
.lk-footer * {
  color: rgba(239, 233, 220, 0.5) !important;
  font-weight: normal !important;
}

.lk-footer .lk-footer-brand-name {
  color: rgba(239, 233, 220, 1) !important;
  font-weight: 600 !important;
}

.lk-footer .lk-footer-brand-tagline {
  color: rgba(239, 233, 220, 0.3) !important;
}

.lk-footer .lk-footer-col h5 {
  color: rgba(239, 233, 220, 0.4) !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
}

.lk-footer .lk-footer-col a {
  color: rgba(239, 233, 220, 0.5) !important;
  text-decoration: none !important;
}

.lk-footer .lk-footer-col a:hover {
  color: rgba(239, 233, 220, 1) !important;
}

.lk-footer .lk-footer-copy,
.lk-footer .lk-footer-built {
  color: rgba(239, 233, 220, 0.25) !important;
}
