@font-face {
  font-family: "Brown";
  font-style: normal;
  font-weight: 100 400;
  font-display: swap;
  src: url("/public/fonts/brown-light.woff2") format("woff2");
}

@font-face {
  font-family: "Brown";
  font-style: normal;
  font-weight: 401 600;
  font-display: swap;
  src: url("/public/fonts/brown-medium.woff2") format("woff2");
}

@font-face {
  font-family: "Brown";
  font-style: normal;
  font-weight: 601 900;
  font-display: swap;
  src: url("/public/fonts/brown-bold.woff2") format("woff2");
}

@font-face {
  font-family: "Domaine Sans Text";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/public/fonts/domaine-sans-text-medium.woff2") format("woff2");
}

:root {
  --background: 45 50% 96.9% !important;
  --foreground: 0 0% 0% !important;
  --card: 0 0% 100% !important;
  --card-foreground: 0 0% 0% !important;
  --popover: 0 0% 100% !important;
  --popover-foreground: 0 0% 0% !important;
  --primary: 0 0% 0% !important;
  --primary-foreground: 0 0% 100% !important;
  --secondary: 45 30.8% 89.8% !important;
  --secondary-foreground: 0 0% 0% !important;
  --muted: 45 30.8% 89.8% !important;
  --muted-foreground: 0 0% 36.9% !important;
  --accent: 45 30.8% 89.8% !important;
  --accent-foreground: 0 0% 0% !important;
  --destructive: 2.1 67.5% 32.5% !important;
  --destructive-foreground: 0 0% 100% !important;
  --border: 0 0% 89.8% !important;
  --input: 0 0% 89.8% !important;
  --ring: 0 0% 0% !important;
  --radius: 0.375rem !important;
  --font-heading: "Domaine Sans Text", "Inter", sans-serif !important;
  --font-body: "Brown", -apple-system, "Segoe UI", Roboto, sans-serif !important;
}

body {
  font-family: var(--font-body);
}

h1, h2, h3, h4, h5, h6,
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  font-family: var(--font-heading);
  font-weight: 500;
}

/* Liens markdown "normaux" (hors AppointmentCTA, retirés du texte et rendus
   en bouton dédié, cf. extract_appointment_ctas) : mise en avant a minima
   par soulignement, sans quoi ils se confondent avec le texte du message. */
.prose a {
  color: hsl(var(--primary));
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose a:hover {
  color: hsl(var(--foreground));
}

/* CTA primaires : angles droits, majuscules, en dérogation au --radius par défaut.
   border explicite requise ici : sans elle, border-color seul (règle de hover
   ci-dessous) n'a aucun effet visuel et le bouton disparaît au survol. */
button[type="submit"],
.heytens-cta-primary,
#chat-submit {
  border-radius: 0 !important;
  border: 1px solid hsl(var(--primary)) !important;
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* Survol inversé : boutons pleins noirs -> fond blanc/texte noir, bordure noire conservée */
button[type="submit"]:hover,
.heytens-cta-primary:hover,
#chat-submit:hover {
  background-color: hsl(var(--background)) !important;
  color: hsl(var(--foreground)) !important;
  border-color: hsl(var(--foreground)) !important;
}

/* Masque le toggle jour/nuit natif de Chainlit : thème clair uniquement */
#theme-toggle {
  display: none !important;
}

/* Page de login : aligne sur le design system (cf. heytens-visualize-app,
   même structure logo centré + carte). Masque le panneau image de droite
   (favicon agrandi par défaut en l'absence de login_page_image custom) et
   repasse en une seule colonne centrée. */
.bg-muted.lg\:block {
  display: none !important;
}
.min-h-svh.lg\:grid-cols-2 {
  grid-template-columns: 1fr !important;
}
.grid.min-h-svh .justify-center.gap-2.md\:justify-start {
  justify-content: center !important;
  margin-bottom: 12px;
}
.grid.min-h-svh img[alt="logo"] {
  width: 200px !important;
}
label[for="email"],
label[for="password"] {
  font-size: 12px !important;
  font-weight: 600 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  color: hsl(var(--muted-foreground)) !important;
}
#email,
#password {
  border-radius: 0 !important;
}

/* Évite qu'un fond (--muted/--background) transparaisse en letterbox derrière les images
   object-contain (ex. avatar, images de message redimensionnées) */
div:has(> img.object-contain) {
  background-color: transparent !important;
}

.heytens-markdown-zoomable-image {
  cursor: zoom-in;
}

.heytens-markdown-zoomable-image:focus-visible {
  outline: 2px solid #000000;
  outline-offset: 3px;
}

.heytens-language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 34px;
  margin-left: 6px;
  padding: 2px;
  border: 1px solid hsl(var(--border, 0 0% 89.8%));
  border-radius: 8px;
  background: hsl(var(--background, 45 50% 96.9%));
}

.heytens-language-switcher-button {
  min-width: 34px;
  min-height: 28px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: hsl(var(--foreground, 0 0% 0%));
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.heytens-language-switcher-button:hover {
  background: hsl(var(--muted, 45 30.8% 89.8%));
}

.heytens-language-switcher-button[data-active="true"] {
  background: #000000;
  color: #ffffff;
}

.heytens-language-switcher-button:focus-visible {
  outline: 2px solid #000000;
  outline-offset: 2px;
}

#heytens-markdown-image-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 24px 24px;
  background: rgba(0, 0, 0, 0.96);
  cursor: zoom-out;
}

.heytens-image-modal-close {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2147483647;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 9999px;
  background: #ffffff;
  color: #000000;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.heytens-image-modal-img {
  display: block;
  width: auto;
  height: auto;
  max-width: 92vw;
  max-height: 82vh;
  object-fit: contain;
  cursor: default;
}

#heytens-feedback-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.45);
}

.heytens-feedback-modal-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 420px;
  padding: 24px;
  border-radius: 12px;
  background: hsl(var(--background, 45 50% 96.9%));
  color: hsl(var(--foreground, 0 0% 0%));
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  cursor: default;
}

.heytens-feedback-modal-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.heytens-feedback-modal-textarea {
  min-height: 100px;
  padding: 10px;
  border: 1px solid hsl(var(--border, 0 0% 89.8%));
  border-radius: 8px;
  background: hsl(var(--background, 45 50% 96.9%));
  color: hsl(var(--foreground, 0 0% 0%));
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}

.heytens-feedback-modal-textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.heytens-feedback-modal-message {
  margin: 0;
  font-size: 13px;
  color: hsl(var(--muted-foreground, 0 0% 40%));
}

.heytens-feedback-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.heytens-feedback-modal-cancel,
.heytens-feedback-modal-submit {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.heytens-feedback-modal-cancel {
  border: 1px solid hsl(var(--border, 0 0% 89.8%));
  background: hsl(var(--background, 45 50% 96.9%));
  color: hsl(var(--foreground, 0 0% 0%));
}

.heytens-feedback-modal-cancel:hover {
  background: hsl(var(--muted, 45 30.8% 89.8%));
}

.heytens-feedback-modal-submit {
  border: 1px solid #000000;
  background: #000000;
  color: #ffffff;
}

.heytens-feedback-modal-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.heytens-feedback-modal-submit:hover:not(:disabled) {
  background: #222222;
}

/* Historique des conversations : Chainlit affiche nativement le side-view
   (cl.ElementSidebar) à droite (ordre DOM, pas une classe de position) ;
   la spec demande un affichage à gauche (design doc §A.4). :has() scope la
   règle au seul conteneur qui contient effectivement le side-view ouvert,
   sans affecter d'autres flex containers partageant les mêmes classes
   utilitaires ailleurs dans l'app. */
.flex.flex-row.flex-grow:has(#side-view-title) {
  flex-direction: row-reverse !important;
}

/* Bouton de réouverture de l'historique des conversations, à côté du bouton
   "nouvelle conversation" (#new-chat-button) dans l'en-tête. Un rechargement
   de page suffit à rouvrir le panneau : on_chat_start rappelle
   send_thread_history_panel à chaque connexion. */
.heytens-history-reopen-button {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin-left: 6px;
  padding: 0 10px;
  border: 1px solid hsl(var(--border, 0 0% 89.8%));
  border-radius: 8px;
  background: hsl(var(--background, 45 50% 96.9%));
  color: hsl(var(--foreground, 0 0% 0%));
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.heytens-history-reopen-button:hover {
  background: hsl(var(--muted, 45 30.8% 89.8%));
}

.heytens-history-reopen-button:focus-visible {
  outline: 2px solid #000000;
  outline-offset: 2px;
}

/* Bouton "Donner un avis" (feedback conversation), injecté dans l'en-tête
   à côté du bouton d'historique — même traitement visuel pour rester
   cohérent avec l'identité du header. */
.heytens-feedback-button {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin-left: 6px;
  padding: 0 10px;
  border: 1px solid hsl(var(--border, 0 0% 89.8%));
  border-radius: 8px;
  background: hsl(var(--background, 45 50% 96.9%));
  color: hsl(var(--foreground, 0 0% 0%));
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.heytens-feedback-button:hover {
  background: hsl(var(--muted, 45 30.8% 89.8%));
}

.heytens-feedback-button:focus-visible {
  outline: 2px solid #000000;
  outline-offset: 2px;
}
