/* =============================================================================
   Mayele IA — page publique /mayele/ : mise en page conversationnelle (2026-11-05)
   -----------------------------------------------------------------------------
   Demande : « sur sa propre page, quelque chose d'adapté, cf. Claude ou ChatGPT : simple mais professionnel ».
   Surcharge chargée APRÈS mayele-public.css (aucune règle de base modifiée) :
     1. palette sobre et chaude : fond blanc cassé, marine de la marque #0F3054, orange Mayele #E89045 en accent ;
        plus d'aurore indigo / violet ;
     2. accueil centré (logo, « Comment puis-je vous aider ? », zone de saisie au centre, suggestions dessous) ;
     3. dès le premier message (body.myl-chatting, posé par mayele-public-chat.js) : l'accueil s'efface, le fil
        occupe la colonne (réponses sans bulle, questions en bulle discrète) et la saisie reste collée en bas ;
     4. sélecteur d'agent (#mylDomain) dans la zone de saisie, comme le panneau connecté d'UEMI.
   Gabarit : mayele/templates/mayele/public.html. Copies identiques : uimi-web-app/static/mayele/ et staticfiles/.
   ============================================================================= */

:root {
  --myl-navy: #0f3054; --myl-indigo: #0f3054; --myl-violet: #1a4470; --myl-cyan: #f0b27a;
  --myl-orange: #d9772b; --myl-orange-2: #e89045;
  --myl-bg: #faf9f7; --myl-card: #ffffff; --myl-card-2: #fcfbf9;
  --myl-ink: #1d2433; --myl-muted: #667085; --myl-line: #e7e4df; --myl-line-2: #f1efeb;
  --myl-bot: #f4f2ee; --myl-me: #f0eee9; --myl-me-ink: #1d2433;
  --myl-glass: #ffffff; --myl-glass-line: #e7e4df;
  --myl-shadow: 0 .75rem 2rem rgba(16, 24, 40, .07); --myl-shadow-sm: 0 .2rem .6rem rgba(16, 24, 40, .05);
  --myl-grad: linear-gradient(120deg, #0b2440, #0f3054 60%, #1a4470);
  --myl-grad-warm: linear-gradient(120deg, #d9772b, #e89045);
}
@media (prefers-color-scheme: dark) {
  :root {
    --myl-bg: #15171c; --myl-card: #1d2027; --myl-card-2: #1a1d23; --myl-ink: #e8e9ec; --myl-muted: #9aa1ad;
    --myl-line: #2c3039; --myl-line-2: #252830; --myl-bot: #23262e; --myl-me: #2a2e37; --myl-me-ink: #eceef1;
    --myl-glass: #1d2027; --myl-glass-line: #2c3039; --myl-cyan: #f0b27a;
    --myl-shadow: 0 .75rem 2rem rgba(0, 0, 0, .35); --myl-shadow-sm: 0 .2rem .6rem rgba(0, 0, 0, .3);
  }
}

/* 1. Fond uni : pas de nappes de couleur. */
body::before { display: none; }
.myl-top { background: color-mix(in srgb, var(--myl-bg) 92%, transparent); }
.myl-btn--primary { background: var(--myl-navy); box-shadow: none; }
.myl-btn--primary:hover { background: #0b2440; box-shadow: none; }
.myl-btn--ghost { box-shadow: none; }

/* 2. Accueil centré. */
.myl-home {
  display: flex; flex-direction: column; justify-content: center; gap: 0;
  max-width: 820px; min-height: calc(100dvh - 66px); margin: 0 auto;
  padding: 1.5rem clamp(1rem, 4vw, 1.5rem) 1.25rem;
}
.myl-home__greet { text-align: center; margin-bottom: 1.4rem; }
.myl-home__mark { display: block; width: 52px; height: 52px; margin: 0 auto .9rem; }
.myl-home h1 {
  margin: 0; font-size: clamp(1.55rem, 3.6vw, 2.1rem); font-weight: 650; line-height: 1.2;
  letter-spacing: -.02em; color: var(--myl-ink);
}
.myl-home .myl-lead { margin: .55rem auto 0; max-width: 46ch; font-size: 1rem; font-weight: 400; color: var(--myl-muted); }

/* Carte de conversation : plus de verre, une simple colonne. */
.myl-home .myl-chat {
  min-height: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none; overflow: visible;
}
.myl-home .myl-chat::after { display: none; }
.myl-home .myl-chat__log { order: 1; }
.myl-home .myl-learning { order: 2; margin: 0 0 .7rem; }
.myl-home .myl-chat__form { order: 3; }
.myl-home .myl-voice { order: 4; }
.myl-home .myl-chat__chips { order: 5; }
.myl-home .myl-chat__head { order: 6; }
.myl-home .myl-chat__note { order: 7; }

/* État du moteur : simple mention discrète sous la saisie. */
.myl-home .myl-chat__head { justify-content: center; padding: .2rem 0 0; color: var(--myl-muted); background: none; }
.myl-home .myl-chat__head::before, .myl-home .myl-chat__head img, .myl-home .myl-chat__head strong { display: none; }
.myl-home .myl-chat__head small { color: var(--myl-muted); font-size: .74rem; }
.myl-home .myl-chat__note { margin: .2rem 0 0; text-align: center; font-size: .74rem; }

/* Zone de saisie : capsule claire, agent à gauche, micro / voix / envoi à droite. */
.myl-home .myl-chat__form {
  display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin: 0; padding: .55rem .6rem .5rem;
  border: 1px solid var(--myl-line); border-radius: 1.4rem; background: var(--myl-card);
  box-shadow: 0 .4rem 1.6rem rgba(16, 24, 40, .06);
}
.myl-home .myl-chat__form:focus-within { border-color: #c4ccd8; box-shadow: 0 .4rem 1.6rem rgba(16, 24, 40, .09); }
.myl-home .myl-chat__form textarea { flex: 1 1 100%; min-height: 2.8rem; padding: .35rem .5rem .2rem; font-size: 1rem; }
.myl-home .myl-chat__domain { flex: 0 1 auto; margin-right: auto; padding: 0; gap: .3rem; }
.myl-home .myl-chat__domain-icon { width: 1rem; height: 1rem; fill: var(--myl-navy); margin-left: .35rem; }
@media (prefers-color-scheme: dark) { .myl-home .myl-chat__domain-icon { fill: #f0b27a; } }
.myl-home .myl-chat__domain select {
  appearance: none; -webkit-appearance: none; padding: .3rem 1.4rem .3rem .45rem; border: 1px solid var(--myl-line);
  border-radius: 999px; font-size: .82rem; font-weight: 600; color: var(--myl-ink);
  background: var(--myl-card) linear-gradient(45deg, transparent 50%, currentColor 50%) calc(100% - .6rem) 52% / 4px 4px no-repeat;
}
.myl-home .myl-chat__domain-hint { display: block; font-size: .8rem; }

/* Sélecteur de langue : une commande compacte dans le composeur, avec le menu natif du navigateur. */
.myl-home .myl-chat__language {
  display: inline-flex; align-items: center; gap: .25rem; min-height: 2.2rem;
  padding: 0 .5rem; border: 1px solid var(--myl-line); border-radius: 999px;
  color: var(--myl-muted); background: var(--myl-card); font-size: .8rem;
}
.myl-home .myl-chat__language:focus-within { outline: 2px solid var(--myl-muted); outline-offset: 2px; }
.myl-home .myl-chat__language select {
  min-height: 2rem; padding: 0 .15rem; border: 0; background: var(--myl-card);
  color: var(--myl-ink); font: inherit; font-weight: 600;
}
.myl-home .myl-icon-btn { width: 2.2rem; height: 2.2rem; border-radius: 999px; }
.myl-home .myl-icon-btn svg { width: 1.1rem; height: 1.1rem; }
.myl-home .myl-icon-btn--send { color: #fff; background: var(--myl-navy); box-shadow: none; }
.myl-home .myl-icon-btn--send:hover { background: #0b2440; transform: none; }
@media (prefers-color-scheme: dark) { .myl-home .myl-icon-btn--send { color: #15171c; background: #eceef1; } }

/* Suggestions : pastilles centrées sous la saisie (accueil seulement). */
.myl-home .myl-chat__chips { justify-content: center; padding: .9rem 0 .2rem; }
.myl-home .myl-chat__chips button, .myl-home .myl-chat__tool {
  border-color: var(--myl-line); background: var(--myl-card); font-weight: 500; color: var(--myl-ink);
}
.myl-home .myl-chat__chips button:hover { border-color: var(--myl-orange-2); color: var(--myl-ink); transform: none; background: var(--myl-line-2); }

/* 3. Pendant la conversation. */
body:not(.myl-chatting) .myl-home .myl-chat__log { display: none; }
body.myl-chatting .myl-home { justify-content: flex-start; padding-top: .5rem; }
body.myl-chatting .myl-home .myl-chat { flex: 1 1 auto; }
body.myl-chatting .myl-home__greet { display: none; }
body.myl-chatting .myl-home .myl-chat__chips button { display: none; }
body.myl-chatting .myl-home .myl-chat__chips { justify-content: flex-start; padding: .5rem 0 0; }
body.myl-chatting .myl-home .myl-chat__log {
  flex: 1 1 auto; max-height: none; overflow: visible; gap: 1rem; padding: 1rem 0 1.25rem;
}
/* Le retrait et la zone sûre gardent le bas du composeur dégagé sur mobile. */
body.myl-chatting .myl-home .myl-chat__form { position: sticky; bottom: calc(.6rem + env(safe-area-inset-bottom, 0px)); z-index: 5; }

/* Messages : réponse sans bulle (lecture confortable), question dans une bulle discrète à droite. */
.myl-home .myl-msg { box-shadow: none; animation: none; line-height: 1.65; }
.myl-home .myl-msg--bot { position: relative; max-width: 100%; padding: 0 0 0 1.9rem; background: transparent; border-radius: 0; }
.myl-home .myl-msg--bot::before {
  content: ""; position: absolute; top: .15rem; left: 0; width: 1.35rem; height: 1.35rem;
  background: url("img/mayele-mark.svg") center / contain no-repeat;
}
.myl-home .myl-msg--me { max-width: 80%; padding: .6rem 1rem; border-radius: 1.2rem; color: var(--myl-me-ink); background: var(--myl-me); box-shadow: none; }
.myl-home .myl-msg--wait { color: var(--myl-muted); }
.myl-home .myl-msg__links a { background: var(--myl-line-2); }
.myl-home .myl-answer-actions { color: var(--myl-muted); }
.myl-home .myl-answer-actions [role="status"]:empty { position: absolute; }
.myl-home .myl-answer-language { margin: 0; font-size: .8rem; }
.myl-home .myl-answer-language summary { font-weight: 500; }
.myl-home .myl-answer-language[open] { flex: 1 1 14rem; }
.myl-home .myl-answer-language[open] span { display: block; margin-top: .2rem; }

/* Sections de présentation : un peu plus d'air entre l'accueil et le reste. */
.myl-home + .myl-section { border-top: 1px solid var(--myl-line); }

@media (max-width: 640px) {
  .myl-home { min-height: calc(100dvh - 58px); }
  .myl-home .myl-msg--me { max-width: 92%; }
  .myl-top__nav a:not(.myl-btn) { display: none; }
}

@media (max-width: 480px) {
  /* L'agent garde une ligne complète, le choix de langue partage la suivante avec les icônes. */
  .myl-home .myl-chat__domain { flex: 1 1 100%; }
  .myl-home .myl-chat__language { flex: 1 1 7rem; margin-right: auto; min-width: 0; max-width: 11rem; }
  .myl-home .myl-chat__language select { flex: 1 1 auto; min-width: 0; max-width: 7.25rem; font-size: 1rem; }
  .myl-home .myl-icon-btn--send { margin-left: auto; }
}

/* Persistance explicite : lien vers la bibliothèque privée et les conversations enregistrées. */
.myl-persistence { margin: .6rem 0; color: var(--myl-muted); font-size: .82rem; line-height: 1.5; text-align: center; }
.myl-persistence a { color: var(--myl-ink); text-decoration: underline; text-underline-offset: .2em; }

/* Saisie et bulles : couleurs appariées, y compris quand une feuille globale surcharge la typographie. */
.myl-home .myl-chat__form textarea { color: var(--myl-ink); background: var(--myl-card); caret-color: var(--myl-ink); line-height: 1.6; }
.myl-home .myl-chat__form textarea::placeholder { color: var(--myl-muted); opacity: 1; }
.myl-home .myl-msg--me, .myl-home .myl-msg--me p { color: var(--myl-me-ink); }

/* La feuille de marque chargée ensuite impose un fond marine : apparier explicitement le texte blanc. */
#mylLog .myl-msg--me { color: #ffffff !important; background: #173b63 !important; }
#mylLog .myl-msg--me :is(p, span, strong, em, li, a) { color: inherit !important; }
#mylLog .myl-msg--me a { text-decoration: underline; }
