/* Ro.Pro overlay for LibreChat v0.8.8. Load after the bundled stylesheet.
   Keep high-contrast modes and semantic success/error/provider colours intact. */
@font-face {
  font-family: 'RoPro Open Sans';
  src: url('./open-sans.woff2') format('woff2');
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
}

html:not(.high-contrast) {
  --theme-font-family: 'RoPro Open Sans', 'Open Sans', Arial, sans-serif;
  --presentation: 255 255 255;
  --text-primary: 21 49 92;
  --text-secondary: 82 97 122;
  --text-secondary-alt: 82 97 122;
  --text-tertiary: 89 106 131;
  --text-muted: 89 106 131;
  --link: 23 69 143;
  --link-hover: 21 49 92;
  --accent-primary: 23 69 143;
  --accent-primary-hover: 21 49 92;
  --ring-primary: 148 96 0;
  --header-primary: 255 255 255;
  --header-hover: 243 246 250;
  --header-button-hover: 243 246 250;
  --surface-primary: 255 255 255;
  --surface-primary-alt: 243 246 250;
  --surface-primary-contrast: 233 239 247;
  --surface-secondary: 243 246 250;
  --surface-secondary-alt: 233 239 247;
  --surface-tertiary: 233 239 247;
  --surface-tertiary-alt: 255 255 255;
  --surface-dialog: 255 255 255;
  --surface-chat: 255 255 255;
  --surface-active: 233 239 247;
  --surface-active-alt: 217 224 233;
  --surface-hover: 233 239 247;
  --surface-hover-alt: 217 224 233;
  --surface-composer-hover: 233 239 247;
  --surface-submit: 23 69 143;
  --surface-submit-hover: 21 49 92;
  --border-light: 217 224 233;
  --border-medium: 184 197 214;
  --border-medium-alt: 184 197 214;
  --border-heavy: 89 106 131;
}

html.dark:not(.high-contrast) {
  --presentation: 12 22 39;
  --text-primary: 237 243 252;
  --text-secondary: 185 199 218;
  --text-secondary-alt: 185 199 218;
  --text-tertiary: 172 191 213;
  --text-muted: 172 191 213;
  --link: 169 201 255;
  --link-hover: 247 168 27;
  --accent-primary: 169 201 255;
  --accent-primary-hover: 247 168 27;
  --ring-primary: 247 168 27;
  --header-primary: 12 22 39;
  --header-hover: 27 46 72;
  --header-button-hover: 27 46 72;
  --surface-primary: 22 38 61;
  --surface-primary-alt: 12 22 39;
  --surface-primary-contrast: 27 46 72;
  --surface-secondary: 20 36 58;
  --surface-secondary-alt: 27 46 72;
  --surface-tertiary: 27 46 72;
  --surface-tertiary-alt: 22 38 61;
  --surface-dialog: 22 38 61;
  --surface-chat: 22 38 61;
  --surface-active: 27 46 72;
  --surface-active-alt: 52 72 98;
  --surface-hover: 27 46 72;
  --surface-hover-alt: 52 72 98;
  --surface-composer-hover: 27 46 72;
  --border-light: 52 72 98;
  --border-medium: 104 125 152;
  --border-medium-alt: 104 125 152;
  --border-heavy: 172 191 213;
}

html:not(.high-contrast) body,
html:not(.high-contrast) .font-sans {
  font-family: 'RoPro Open Sans', 'Open Sans', Arial, sans-serif;
}

/* Replace only the application's own logo, never model/provider/user images.
   CSS uses the explicit LibreChat theme, including manual theme switching. */
img[src='assets/logo.svg'], img[src='/assets/logo.svg'] {
  content: url('./logo-light@2x.png');
  object-fit: contain;
}
html.dark img[src='assets/logo.svg'], html.dark img[src='/assets/logo.svg'] {
  content: url('./logo-dark@2x.png');
}

html:not(.high-contrast) .min-h-screen:has(.w-authPageWidth) {
  background: #15315c;
  border-top: 5px solid #f7a81b;
  display: grid;
  min-height: 100svh;
  grid-template-rows: minmax(132px, 1fr) auto auto auto minmax(72px, 1fr);
}
html.dark:not(.high-contrast) .min-h-screen:has(.w-authPageWidth) {
  background: #0c1627;
}
/* The upper row shares the spare height with the lower row. The small offset
   accounts for the card's padding: logo centre ≈ halfway from top to heading. */
html:not(.high-contrast) .min-h-screen:has(.w-authPageWidth) > div:has(> img[src$='assets/logo.svg']) {
  grid-row: 1;
  align-self: center;
  justify-self: center;
  width: 148px;
  height: 40px;
  margin: 0;
  transform: translateY(16px);
}
html:not(.high-contrast) .min-h-screen:has(.w-authPageWidth) img[src$='assets/logo.svg'] {
  content: url('./logo-white-gold@2x.png');
}
html:not(.high-contrast) .min-h-screen:has(.w-authPageWidth) > main {
  grid-row: 3;
}
/* AuthLayout renders token/server errors before main, outside the form card. */
html:not(.high-contrast) .min-h-screen:has(.w-authPageWidth) > .mx-auto {
  grid-row: 2;
  justify-self: center;
  width: calc(100% - 2rem);
  max-width: 24rem;
  margin: 0 1rem 1rem;
}
html:not(.high-contrast) .min-h-screen:has(.w-authPageWidth) > [role='contentinfo'] {
  grid-row: 5;
  align-self: end;
  color: #fff;
}
html:not(.high-contrast) .min-h-screen:has(.w-authPageWidth) > .absolute button,
html:not(.high-contrast) .min-h-screen:has(.w-authPageWidth) > .absolute svg {
  color: #fff;
}
html:not(.high-contrast) .w-authPageWidth {
  border: 1px solid rgb(var(--border-light));
  border-radius: 12px;
  padding: 2rem;
  margin: 0 1rem;
  box-shadow: 0 12px 40px rgb(21 49 92 / 7%);
}
html:not(.high-contrast) .w-authPageWidth h1 {
  color: rgb(var(--accent-primary));
  font-weight: 750;
  letter-spacing: -0.035em;
}
html:not(.high-contrast) .w-authPageWidth input:not([type='checkbox']):not(:focus):not([aria-invalid='true']) {
  border-color: rgb(var(--border-medium));
}
/* Upstream's WebKit autofill workaround paints an opaque black inset shadow. */
html.dark:not(.high-contrast) .w-authPageWidth input.webkit-dark-styles {
  -webkit-box-shadow: 0 0 0 360px rgb(var(--surface-primary)) inset !important;
  -webkit-text-fill-color: rgb(var(--text-primary)) !important;
}
html:not(.high-contrast) .w-authPageWidth button[type='submit'],
html:not(.high-contrast) .w-authPageWidth button.bg-surface-submit {
  background-color: #f7a81b;
  color: #15315c;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 750;
}
html:not(.high-contrast) .w-authPageWidth button[type='submit']:hover:not(:disabled),
html:not(.high-contrast) .w-authPageWidth button.bg-surface-submit:hover:not(:disabled) {
  background-color: #ffbc3f;
}
html:not(.high-contrast) .w-authPageWidth a {
  color: #17458f;
  text-underline-offset: 3px;
}
html:not(.high-contrast) .w-authPageWidth a:hover {
  color: #15315c;
  text-decoration: underline;
}
html.dark:not(.high-contrast) .w-authPageWidth a {
  color: #f7a81b;
}
html.dark:not(.high-contrast) .w-authPageWidth a:hover {
  color: #ffbc3f;
}
html:not(.high-contrast) .w-authPageWidth :focus-visible {
  outline: 2px solid rgb(var(--ring-primary));
  outline-offset: 3px;
}
html:not(.high-contrast) .w-authPageWidth .bg-status-success-subtle {
  background-color: rgb(var(--surface-secondary));
  border-color: rgb(var(--border-medium));
  color: rgb(var(--text-primary));
}

/* VerifyEmail has its own layout instead of AuthLayout (v0.8.8).
   Scope to its exact root class combination; leave application screens alone. */
html:not(.high-contrast) .min-h-screen.flex-col.items-center.justify-center.bg-surface-primary.pt-6 {
  display: grid;
  grid-template-rows: minmax(132px, 1fr) auto auto minmax(72px, 1fr);
  justify-content: stretch;
  min-height: 100svh;
  padding-top: 0;
  border-top: 5px solid #f7a81b;
  background: #15315c;
}
html.dark:not(.high-contrast) .min-h-screen.flex-col.items-center.justify-center.bg-surface-primary.pt-6 {
  background: #0c1627;
}
html:not(.high-contrast) .min-h-screen.flex-col.items-center.justify-center.bg-surface-primary.pt-6::before {
  content: '';
  grid-row: 1;
  justify-self: center;
  width: 148px;
  height: 40px;
  transform: translateY(16px);
  background: url('./logo-white-gold@2x.png') center / contain no-repeat;
}
html:not(.high-contrast) .min-h-screen.flex-col.items-center.justify-center.bg-surface-primary.pt-6 > .flex {
  grid-row: 2;
  justify-self: center;
  width: calc(100% - 2rem);
  max-width: 32rem;
  padding: 2rem;
  border: 1px solid rgb(var(--border-light));
  border-radius: 12px;
  background: rgb(var(--surface-primary));
  color: rgb(var(--text-primary));
  overflow-wrap: anywhere;
}
html:not(.high-contrast) .min-h-screen.flex-col.items-center.justify-center.bg-surface-primary.pt-6 > .absolute button,
html:not(.high-contrast) .min-h-screen.flex-col.items-center.justify-center.bg-surface-primary.pt-6 > .absolute svg {
  color: #fff;
}
html:not(.high-contrast) .min-h-screen.flex-col.items-center.justify-center.bg-surface-primary.pt-6 h1 {
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -0.035em;
  color: rgb(var(--accent-primary));
}
@media (max-width: 480px) {
  html:not(.high-contrast) .w-authPageWidth {
    padding: 1.5rem;
    max-width: calc(100vw - 2rem);
  }
}

/* Welcome signet: transparent artwork with contrast appropriate to the theme. */
/* Place the single auth scheme control directly below the form card.
   The glyph is 20% smaller; retain a comfortable keyboard/touch target. */
html:not(.high-contrast) .min-h-screen:has(.w-authPageWidth),
html:not(.high-contrast) .min-h-screen.flex-col.items-center.justify-center.bg-surface-primary.pt-6 {
  grid-template-columns: minmax(0, 1fr);
}
html:not(.high-contrast) .min-h-screen:has(.w-authPageWidth) > div:has(> img[src$='assets/logo.svg']),
html:not(.high-contrast) .min-h-screen.flex-col.items-center.justify-center.bg-surface-primary.pt-6::before {
  grid-column: 1;
}
html:not(.high-contrast) .min-h-screen:has(.w-authPageWidth) > .absolute,
html:not(.high-contrast) .min-h-screen.flex-col.items-center.justify-center.bg-surface-primary.pt-6 > .absolute {
  position: relative;
  grid-column: 1;
  align-self: start;
  justify-self: center;
  inset: auto;
  margin: 16px 0 0;
  transform: none;
  z-index: 1;
}
html:not(.high-contrast) .min-h-screen:has(.w-authPageWidth) > .absolute {
  grid-row: 4;
}
html:not(.high-contrast) .min-h-screen.flex-col.items-center.justify-center.bg-surface-primary.pt-6 > .absolute {
  grid-row: 3;
}
html:not(.high-contrast) .min-h-screen:has(.w-authPageWidth) > .absolute button,
html:not(.high-contrast) .min-h-screen.flex-col.items-center.justify-center.bg-surface-primary.pt-6 > .absolute button {
  width: 44px;
  height: 44px;
  padding: 12.4px;
}
html:not(.high-contrast) .min-h-screen:has(.w-authPageWidth) > .absolute svg,
html:not(.high-contrast) .min-h-screen.flex-col.items-center.justify-center.bg-surface-primary.pt-6 > .absolute svg {
  width: 19.2px;
  height: 19.2px;
}

img[data-testid="ropro-welcome-logo"] {
  content: url('./signet-transparent-light.svg');
  background: transparent;
}
html.dark img[data-testid="ropro-welcome-logo"] {
  content: url('./signet-transparent-dark.svg');
}

/* Native Chromium autofill uses color-scheme for its important FieldText colour.
   The custom dark palette alone does not tell the browser to use light text. */
html:not(.high-contrast) .w-authPageWidth {
  color-scheme: light;
}
html.dark:not(.high-contrast) .w-authPageWidth {
  color-scheme: dark;
}
html:not(.high-contrast) .w-authPageWidth input.webkit-dark-styles,
html:not(.high-contrast) .w-authPageWidth input.webkit-dark-styles:focus {
  color: rgb(var(--text-primary)) !important;
  -webkit-text-fill-color: rgb(var(--text-primary)) !important;
  caret-color: rgb(var(--text-primary));
}

/* Conversation history: the Ro.Pro mark in the original muted provider-icon tint. */
[data-testid='convo-item'] [data-testid='convo-icon'] img[src$='/openrouter.png'] {
  content: url('./signet-mono.svg');
}
