/* BDT Chat visual tokens and brand identity — aligned with docs-site/content/assets/bdt.css and portal.css. */

@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/assets/montserrat-latin-var.woff2") format("woff2");
}

:root {
  --bdt-violet: #544eeb;
  --bdt-violet-deep: #4338ca;
  --bdt-blue: #5d6eff;
  --bdt-teal: #78ddda;
  --bdt-lavender: #f2f1fe;
  --bdt-ink: #141625;
  --bdt-muted: #525973;
  --bdt-canvas: #f5f6fb;
  --bdt-card: #ffffff;
  --bdt-auth-surface: #ffffff;
  --bdt-border: #e4e6f2;
  --bdt-divider: rgba(20, 22, 37, 0.09);
  --bdt-gradient: linear-gradient(105deg, #5d6eff 0%, #544eeb 48%, #473bc2 100%);
  --bdt-display: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html.dark {
  --bdt-ink: #f1f3fc;
  --bdt-muted: #9ea6c2;
  --bdt-canvas: #0e1019;
  --bdt-card: #151928;
  --bdt-auth-surface: #131726;
  --bdt-border: rgba(196, 204, 240, 0.14);
  --bdt-divider: rgba(196, 204, 240, 0.12);
}

/* ============================================================================
   1. Corporate Split-Screen Login & Atomic Reveal (data-bdt-page="login")
   ============================================================================ */

@keyframes bdt-veil-pulse {
  0%,
  100% {
    opacity: 0.72;
    transform: scale(0.97);
  }
  50% {
    opacity: 1;
    transform: scale(1.03);
  }
}

#bdt-login-veil {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background-color: var(--bdt-auth-surface);
  opacity: 1;
  visibility: visible;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.bdt-veil__mark {
  width: 44px;
  height: 44px;
  animation: bdt-veil-pulse 1.5s ease-in-out infinite;
}

html[data-bdt-page="login"][data-bdt-login-ready="false"] #root,
html[data-bdt-page="login"][data-bdt-login-ready="false"] #bdt-login-showcase {
  opacity: 0;
  visibility: hidden;
}

html[data-bdt-page="login"][data-bdt-login-ready="true"] #bdt-login-veil {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

html[data-bdt-page="login"][data-bdt-login-ready="true"] #root,
html[data-bdt-page="login"][data-bdt-login-ready="true"] #bdt-login-showcase {
  opacity: 1;
  visibility: visible;
  transition: opacity 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Left architectural brand showcase panel (desktop >= 900px). */
#bdt-login-showcase {
  position: fixed;
  inset: 0 auto 0 0;
  width: 56vw;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(2.25rem, 4.5vw, 3.75rem);
  overflow: hidden;
  color: #f1f3fc;
  background-color: #0f1224;
  background-image:
    radial-gradient(62% 54% at 18% 22%, rgba(84, 78, 235, 0.34) 0%, transparent 66%),
    radial-gradient(46% 42% at 86% 84%, rgba(120, 221, 218, 0.16) 0%, transparent 64%),
    radial-gradient(rgba(241, 243, 252, 0.08) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 26px 26px;
}

.bdt-showcase__brand,
.bdt-showcase__copy {
  position: relative;
  z-index: 2;
}

.bdt-showcase__logo {
  display: block;
  height: 36px;
  width: auto;
}

.bdt-showcase__orbits {
  position: absolute;
  top: 50%;
  right: -8%;
  width: min(560px, 52vw);
  height: auto;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 1;
}

.bdt-showcase__copy {
  max-width: 460px;
}

.bdt-showcase__kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  font-family: var(--bdt-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #b7bed3;
}

.bdt-showcase__dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background-color: var(--bdt-teal);
  box-shadow: 0 0 10px rgba(120, 221, 218, 0.65);
}

.bdt-showcase__title {
  margin: 0;
  font-family: var(--bdt-display);
  font-size: clamp(1.9rem, 3.1vw, 2.75rem);
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -0.035em;
  color: #ffffff;
}

.bdt-showcase__title span {
  display: inline-block;
  margin-top: 0.25rem;
  font-weight: 400;
  color: #c5c1ff;
}

.bdt-showcase__domain {
  margin: 1.75rem 0 0;
  padding-top: 1.125rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #9ca4bd;
}

/* Right clean authentication pane. */
html[data-bdt-page="login"] body {
  min-height: 100vh;
  overflow-x: hidden;
}

html[data-bdt-page="login"] #root {
  margin-left: 56vw;
  width: auto;
  min-height: 100vh;
}

html[data-bdt-page="login"] #root > div:has(> main) {
  min-height: 100vh;
  background-color: var(--bdt-auth-surface);
  border-left: 1px solid var(--bdt-border);
}

/* Hide LibreChat's floating top logo on /login. */
html[data-bdt-page="login"] #root > div:has(> main) > div:has(img[src*="logo.svg"]) {
  display: none;
}

/* Theme selector cleanly pinned to bottom-right of the auth pane. */
html[data-bdt-page="login"] #root > div:has(> main) > div.absolute.bottom-0 {
  inset-inline-start: auto;
  inset-inline-end: 1.5rem;
  bottom: 1.5rem;
  margin: 0;
}

html[data-bdt-page="login"] #root > div:has(> main) > div.absolute.bottom-0 > div {
  padding-top: 0;
  background: transparent;
}

html[data-bdt-page="login"] #root > div:has(> main) > div.absolute.bottom-0 div.absolute {
  position: static;
  margin: 0;
}

html[data-bdt-page="login"] main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem clamp(2rem, 4vw, 4rem);
}

html[data-bdt-page="login"] main > div {
  width: min(360px, 100%);
  max-width: 360px;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* Left-aligned corporate emblem badge above the heading. */
html[data-bdt-page="login"] main > div::before {
  content: "";
  display: block;
  width: 42px;
  height: 42px;
  margin: 0 0 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--bdt-border);
  background-color: var(--bdt-lavender);
  background-image: url("/assets/bdt-isotipo.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 24px 24px;
}

html.dark[data-bdt-page="login"] main > div::before {
  background-color: #1c2135;
}

html[data-bdt-page="login"] main > div h1 {
  font-family: var(--bdt-display);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.03em;
  text-align: left;
  color: var(--bdt-ink);
  margin-bottom: 1.75rem;
}

html[data-bdt-page="login"] main > div h1::after {
  content: "Iniciá sesión con tu cuenta corporativa de Google.";
  display: block;
  margin-top: 0.55rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0;
  color: var(--bdt-muted);
}

/* Minimal left-aligned footer note below the action. */
html[data-bdt-page="login"] main > div::after {
  content: "Acceso privado · Inicio de sesión único (SSO)";
  display: block;
  margin-top: 2rem;
  padding-top: 1.125rem;
  border-top: 1px solid var(--bdt-divider);
  text-align: left;
  font-size: 0.75rem;
  color: var(--bdt-muted);
}

/* Google SSO button refinement. */
html[data-bdt-page="login"] a[data-testid="openid"] {
  justify-content: flex-start;
  gap: 0.875rem;
  min-height: 52px;
  padding: 0.8125rem 1.25rem;
  border-radius: 12px;
  border: 1.5px solid #d5d9ea;
  background-color: #ffffff;
  color: var(--bdt-ink);
  font-weight: 600;
  font-size: 0.9375rem;
  box-shadow: 0 1px 2px rgba(20, 22, 37, 0.05);
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

html[data-bdt-page="login"] a[data-testid="openid"] > * + * {
  margin-inline-start: 0 !important;
}

html[data-bdt-page="login"] a[data-testid="openid"] img {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

html[data-bdt-page="login"] a[data-testid="openid"]::after {
  content: "→";
  margin-left: auto;
  font-size: 1rem;
  color: var(--bdt-muted);
  transition: transform 150ms ease, color 150ms ease;
}

html[data-bdt-page="login"] a[data-testid="openid"]:hover {
  border-color: var(--bdt-violet);
  background-color: var(--bdt-lavender);
  box-shadow: 0 8px 20px -12px rgba(84, 78, 235, 0.45);
  transform: translateY(-1px);
}

html[data-bdt-page="login"] a[data-testid="openid"]:hover::after {
  transform: translateX(3px);
  color: var(--bdt-violet);
}

html.dark[data-bdt-page="login"] a[data-testid="openid"] {
  border-color: rgba(196, 204, 240, 0.22);
  background-color: #1c2135;
  color: var(--bdt-ink);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

html.dark[data-bdt-page="login"] a[data-testid="openid"]:hover {
  border-color: #8b87dd;
  background-color: #242a42;
  box-shadow: 0 8px 22px -10px rgba(93, 110, 255, 0.42);
}

html.dark[data-bdt-page="login"] a[data-testid="openid"]:hover::after {
  color: #b7b3ff;
}

@media (max-width: 899px) {
  html[data-bdt-page="login"] body {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    min-height: 100svh;
  }

  #bdt-login-showcase {
    position: relative;
    inset: auto;
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    gap: 1.5rem;
    padding: 1.75rem 1.5rem 1.75rem;
  }

  .bdt-showcase__logo {
    height: 30px;
  }

  .bdt-showcase__orbits {
    width: 280px;
    right: -40px;
    opacity: 0.75;
  }

  .bdt-showcase__kicker {
    margin-bottom: 0.55rem;
  }

  .bdt-showcase__title {
    font-size: 1.55rem;
  }

  .bdt-showcase__domain {
    display: none;
  }

  html[data-bdt-page="login"] #root {
    margin-left: 0;
    width: 100%;
    min-height: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
  }

  html[data-bdt-page="login"] #root > div:has(> main) {
    min-height: 0;
    height: auto;
    flex: 1 1 auto;
    border-left: 0;
    border-top: 1px solid var(--bdt-border);
  }

  html[data-bdt-page="login"] main {
    padding: 2.25rem 1.5rem 4.25rem;
  }
}

/* ============================================================================
   2. Persistent In-App Branding (data-bdt-page != "login")
   ============================================================================ */

/* Desktop expanded sidebar: top brand header above conversation history. */
html:not([data-bdt-page="login"]) aside > div > nav.bg-surface-sidebar {
  position: relative;
  padding-top: 56px;
}

html:not([data-bdt-page="login"]) aside > div > nav.bg-surface-sidebar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  border-bottom: 1px solid var(--bdt-divider);
  background: url("/assets/bdt-logo-color.svg") no-repeat 16px center / 124px 30px;
  pointer-events: none;
  z-index: 5;
}

html.dark:not([data-bdt-page="login"]) aside > div > nav.bg-surface-sidebar::before {
  background-image: url("/assets/bdt-logo-white.svg");
}

/* Mobile drawer: top brand header above conversation history. */
html:not([data-bdt-page="login"]) nav#chat-history-nav {
  position: relative;
  padding-top: 52px;
}

html:not([data-bdt-page="login"]) nav#chat-history-nav::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  border-bottom: 1px solid var(--bdt-divider);
  background: url("/assets/bdt-logo-color.svg") no-repeat 16px center / 118px 28px;
  pointer-events: none;
  z-index: 5;
}

html.dark:not([data-bdt-page="login"]) nav#chat-history-nav::before {
  background-image: url("/assets/bdt-logo-white.svg");
}

/* Desktop collapsed sidebar: show bdtglobal wordmark at the start of the chat header. */
html:not([data-bdt-page="login"])
  body:has([data-testid="open-sidebar-button"])
  div:has(> [data-testid="header-open-sidebar-button"])
  + div::before {
  content: "";
  display: block;
  width: 112px;
  height: 26px;
  padding-right: 12px;
  margin-right: 4px;
  border-right: 1px solid var(--bdt-divider);
  flex-shrink: 0;
  background: url("/assets/bdt-logo-color.svg") no-repeat left center / contain;
}

html.dark:not([data-bdt-page="login"])
  body:has([data-testid="open-sidebar-button"])
  div:has(> [data-testid="header-open-sidebar-button"])
  + div::before {
  background-image: url("/assets/bdt-logo-white.svg");
}

/* Mobile header: show bdtglobal logo beside the sidebar toggle button. */
html:not([data-bdt-page="login"]) div:has(> [data-testid="header-open-sidebar-button"])::after {
  content: "";
  display: block;
  width: 102px;
  height: 24px;
  margin-left: 8px;
  flex-shrink: 0;
  background: url("/assets/bdt-logo-color.svg") no-repeat left center / contain;
}

html.dark:not([data-bdt-page="login"]) div:has(> [data-testid="header-open-sidebar-button"])::after {
  background-image: url("/assets/bdt-logo-white.svg");
}

@media (max-width: 420px) {
  html:not([data-bdt-page="login"]) div:has(> [data-testid="header-open-sidebar-button"])::after {
    width: 26px;
    height: 26px;
    background-image: url("/assets/bdt-isotipo.svg") !important;
  }
}

/* ============================================================================
   3. Interactive Accents, Typography & Accessibility
   ============================================================================ */

/* Accentuate primary interactive controls and focus rings without breaking dark mode. */
button[data-testid="send-button"]:not(:disabled),
button[type="submit"].bg-submit {
  background-color: var(--bdt-violet);
  border-color: var(--bdt-violet);
}

button[data-testid="send-button"]:not(:disabled):hover,
button[type="submit"].bg-submit:hover {
  background-color: var(--bdt-violet-deep);
  border-color: var(--bdt-violet-deep);
}

a:focus-visible,
button:focus-visible,
textarea:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--bdt-blue);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .bdt-veil__mark {
    animation: none;
  }
  #bdt-login-veil,
  html[data-bdt-page="login"][data-bdt-login-ready="true"] #root,
  html[data-bdt-page="login"][data-bdt-login-ready="true"] #bdt-login-showcase,
  html[data-bdt-page="login"] a[data-testid="openid"],
  html[data-bdt-page="login"] a[data-testid="openid"]::after {
    transition: none;
  }
  html[data-bdt-page="login"] a[data-testid="openid"]:hover,
  html[data-bdt-page="login"] a[data-testid="openid"]:hover::after {
    transform: none;
  }
}

/* ============================================================================
   4. Proactive Access Request Banner (no active LiteLLM key)
   ============================================================================ */

#bdt-access-banner {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  width: min(720px, calc(100vw - 2rem));
  padding: 0.75rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(84, 78, 235, 0.28);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(242, 241, 255, 0.98) 100%);
  color: var(--bdt-ink, #141625);
  box-shadow: 0 14px 32px -14px rgba(20, 22, 37, 0.25);
  backdrop-filter: blur(10px);
}

html.dark #bdt-access-banner {
  border-color: rgba(139, 135, 221, 0.36);
  background: linear-gradient(135deg, rgba(24, 29, 49, 0.97) 0%, rgba(30, 34, 62, 0.97) 100%);
  color: #f3f5ff;
  box-shadow: 0 16px 36px -12px rgba(0, 0, 0, 0.55);
}

.bdt-access-banner__badge {
  flex-shrink: 0;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  background-color: rgba(84, 78, 235, 0.12);
  color: var(--bdt-violet, #544eeb);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

html.dark .bdt-access-banner__badge {
  background-color: rgba(139, 135, 221, 0.2);
  color: #c5c1ff;
}

.bdt-access-banner__content {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
  flex: 1 1 auto;
}

.bdt-access-banner__title {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
}

.bdt-access-banner__copy {
  font-size: 0.78rem;
  color: var(--bdt-muted, #5c637a);
  line-height: 1.35;
}

html.dark .bdt-access-banner__copy {
  color: #b7bfd8;
}

.bdt-access-banner__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.bdt-access-banner__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.85rem;
  border-radius: 9px;
  background-color: var(--bdt-violet, #544eeb);
  color: #ffffff;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 150ms ease;
}

.bdt-access-banner__btn:hover {
  background-color: var(--bdt-violet-deep, #3e37c9);
  color: #ffffff;
}

.bdt-access-banner__link {
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  color: var(--bdt-violet, #544eeb);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

html.dark .bdt-access-banner__link {
  color: #b7b3ff;
}

.bdt-access-banner__link:hover {
  text-decoration: underline;
}

.bdt-access-banner__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--bdt-muted, #5c637a);
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
}

.bdt-access-banner__close:hover {
  background-color: rgba(84, 78, 235, 0.1);
  color: var(--bdt-ink, #141625);
}

html.dark .bdt-access-banner__close:hover {
  background-color: rgba(183, 179, 255, 0.14);
  color: #ffffff;
}

@media (max-width: 680px) {
  #bdt-access-banner {
    top: 10px;
    flex-wrap: wrap;
    gap: 0.625rem;
    padding: 0.75rem 0.875rem;
  }
  .bdt-access-banner__actions {
    width: 100%;
    justify-content: flex-end;
  }
}
