/*
 * Thème Predikt pour LibreChat (ask.predikt.live).
 * Injecté par nginx (sub_filter, voir scripts/install.sh) après les CSS de LibreChat,
 * avec https://design.predikt.live/v3/fonts.css (Host Grotesk, JetBrains Mono).
 * Source des valeurs : predikt-design-system/tokens.json (V3.2). LibreChat attend des triplets RGB « r g b ».
 *   ink #151515 · ink-raised #1f1f1f · paper #f2f2ee · stone #e7e7e1 · white #fff · green #1c9664
 *   text-muted jour #5e5e58 / sombre #a1a19a · text-subtle jour #8a8a83 / sombre #6e6e68
 * Règles : interface neutre, pas de couleur vive, chartreuse (signature) réservée à la donnée, pas de gras > 500.
 */

/* Gris de LibreChat → neutres chauds Predikt (servent aux deux thèmes) */
:root {
  --gray-20: 242 242 238;
  --gray-50: 242 242 238;   /* paper */
  --gray-100: 231 231 225;  /* stone */
  --gray-200: 220 220 213;
  --gray-300: 200 200 193;
  --gray-400: 161 161 154;  /* text-muted sombre */
  --gray-500: 110 110 104;
  --gray-600: 94 94 88;     /* text-muted jour */
  --gray-650: 58 58 55;
  --gray-700: 46 46 44;
  --gray-800: 31 31 31;     /* ink-raised */
  --gray-850: 26 26 26;
  --gray-875: 24 24 24;
  --gray-900: 21 21 21;     /* ink */
  --gizmo-gray-950: 21 21 21;
  --brand-purple: 28 150 100;
  --theme-font-family: "Host Grotesk", system-ui, sans-serif;
}

/* Jour : fond paper, surfaces surélevées en blanc, texte ink */
html {
  --text-primary: 21 21 21;
  --text-secondary: 94 94 88;
  --text-secondary-alt: 94 94 88;
  --text-tertiary: 138 138 131;
  --text-muted: 94 94 88;
  --surface-primary: 242 242 238;
  --surface-primary-alt: 231 231 225;
  --surface-primary-contrast: 231 231 225;
  --surface-secondary: 231 231 225;
  --surface-tertiary: 231 231 225;
  --surface-tertiary-alt: 255 255 255;
  --surface-chat: 255 255 255;
  --surface-dialog: 255 255 255;
  --header-primary: 242 242 238;
  --header-hover: 231 231 225;
  --header-button-hover: 231 231 225;
  --presentation: 242 242 238;
  --surface-submit: 21 21 21;
  --surface-submit-hover: 31 31 31;
  --accent-primary: 28 150 100;
  --accent-primary-hover: 21 120 80;
  --ring-primary: 21 21 21;
  --link: 28 150 100;
  --link-hover: 21 120 80;
  --link-visited: 28 150 100;
}

/* Sombre : fond ink, surfaces ink-raised, texte paper */
html.dark {
  --text-primary: 242 242 238;
  --text-secondary: 161 161 154;
  --text-secondary-alt: 161 161 154;
  --text-tertiary: 110 110 104;
  --text-muted: 161 161 154;
  --surface-primary: 21 21 21;
  --surface-primary-alt: 26 26 26;
  --surface-primary-contrast: 26 26 26;
  --surface-secondary: 31 31 31;
  --surface-tertiary: 46 46 44;
  --surface-tertiary-alt: 46 46 44;
  --surface-chat: 31 31 31;
  --surface-dialog: 31 31 31;
  --header-primary: 21 21 21;
  --header-hover: 46 46 44;
  --header-button-hover: 46 46 44;
  --presentation: 21 21 21;
  --surface-submit: 242 242 238;
  --surface-submit-hover: 255 255 255;
  --accent-primary: 28 150 100;
  --accent-primary-hover: 40 175 118;
  --ring-primary: 242 242 238;
  --link: 40 175 118;
  --link-hover: 70 195 140;
  --link-visited: 40 175 118;
}

/* Typo : Host Grotesk partout, JetBrains Mono pour le code, graisses ≤ 500 */
html, body, .font-sans, .font-theme-ui, button, input, textarea, select {
  font-family: "Host Grotesk", system-ui, sans-serif !important;
}
code, pre, kbd, samp, .font-mono, .cm-editor {
  font-family: "JetBrains Mono", ui-monospace, monospace !important;
}
.font-semibold, .font-bold, .font-extrabold, .font-black,
strong, b, h1, h2, h3, h4, h5, h6, th,
.prose :where(strong, b, h1, h2, h3, h4, h5, h6, th) {
  font-weight: 500 !important;
}

/* Champs (connexion, réglages) : le libellé flottant prend le fond du champ, sinon il fait une pastille */
/* (LibreChat peint ses champs par une ombre interne .webkit-dark-styles, #fff ou #0d0d0d : on la recolore) */
input.lc-field, input.webkit-dark-styles { background-color: rgb(var(--surface-chat)) !important; }
.webkit-dark-styles, .webkit-dark-styles:focus { -webkit-box-shadow: inset 0 0 0 50vh rgb(var(--surface-chat)) !important; }
html.dark .webkit-dark-styles { -webkit-text-fill-color: #f2f2ee !important; }
input.lc-field ~ label, input.webkit-dark-styles ~ label { background-color: rgb(var(--surface-chat)) !important; }

/* Boutons pleins (Continuer, envoi) : fond inversé (ink le jour, paper la nuit), texte et icône lisibles */
html.dark .bg-surface-submit { color: #151515 !important; }
html:not(.dark) .bg-surface-submit svg, html:not(.dark) [data-testid="send-button"]:not(:disabled) svg { color: #f2f2ee; }
html.dark [data-testid="send-button"]:not(:disabled) svg, html.dark .bg-surface-submit svg { color: #151515; }

/* Logo de la page de connexion : version blanche en thème sombre */
html.dark img[src$="assets/logo.svg"] { content: url("/assets/logo-white.svg"); }
