/* =============================================================
   L'assistant de Coach Mamad — même DA que la page (tokens de styles.css)
   ============================================================= */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.asst { --asst-gap: 16px; }

/* ---------- Bouton ---------- */
.asst__fab {
  position: fixed; z-index: 60;
  right: var(--asst-gap);
  bottom: calc(var(--asst-gap) + env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid rgba(240, 200, 106, 0.55);
  background: var(--bg, #0d0c0b);
  color: var(--gold-hi, #f0c86a);
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .7), 0 0 0 4px rgba(212, 168, 75, 0.12);
  cursor: pointer;
  transition: bottom .25s ease, transform .15s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.asst__fab { padding: 0; border: 2px solid var(--gold-hi, #f0c86a); }
.asst__fab-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.asst__fab-badge {
  position: absolute; left: -3px; bottom: -3px;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--gold-hi, #f0c86a); color: #1a1408;
  border: 2px solid var(--bg, #0d0c0b);
}
.asst__fab::after { /* pastille « en ligne » */
  content: ""; position: absolute; right: 1px; top: 1px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #8fbf7a; border: 2px solid var(--bg, #0d0c0b);
}
.asst__fab:hover { transform: translateY(-2px); }
.asst__fab:focus-visible { outline: 3px solid var(--gold-hi, #f0c86a); outline-offset: 3px; }

.asst__tip {
  position: absolute; right: 68px; top: 50%; transform: translateY(-50%);
  white-space: nowrap;
  padding: 7px 12px; border-radius: 999px;
  background: var(--panel, #161412); border: 1px solid var(--line, #2a2623);
  color: var(--text, #f5efe6); font: 600 13px var(--f-title, sans-serif);
  opacity: 0; pointer-events: none; transition: opacity .15s ease;
}
.asst__fab:hover .asst__tip, .asst__fab:focus-visible .asst__tip { opacity: 1; }
.asst.is-open .asst__tip { display: none; }

/* ---------- Bulle d'accroche (à gauche du bouton) ---------- */
.asst__teaser {
  position: fixed; z-index: 59;
  right: calc(var(--asst-gap) + 58px + 12px);
  bottom: calc(var(--asst-gap) + env(safe-area-inset-bottom));
  width: max-content;
  max-width: min(280px, calc(100vw - 58px - 12px - 2 * var(--asst-gap)));
  opacity: 0; transform: translateY(8px) scale(.98);
  transition: opacity .25s ease, transform .25s ease, bottom .25s ease;
}
.asst__teaser.is-visible { opacity: 1; transform: none; }
.asst__teaser[hidden] { display: none; }
html.asst-open .asst__teaser { display: none; }
.asst__teaser-body {
  display: flex; flex-direction: column; gap: 3px;
  width: 100%; text-align: left;
  padding: 11px 30px 12px 14px;
  border-radius: 16px 16px 4px 16px;
  border: 1px solid rgba(212, 168, 75, 0.45);
  background: var(--panel, #161412);
  box-shadow: 0 14px 36px -12px rgba(0, 0, 0, .8), 0 6px 26px -14px rgba(240, 200, 106, .35);
  color: var(--text, #f5efe6);
  cursor: pointer;
  font-family: var(--f-text, sans-serif);
}
.asst__teaser-body:focus-visible { outline: 2px solid var(--gold-hi, #f0c86a); outline-offset: 2px; }
.asst__teaser-label { font: 600 11px/1.2 var(--f-title, sans-serif); letter-spacing: .06em; text-transform: uppercase; color: var(--gold, #d4a84b); }
.asst__teaser-q { font: 700 15px/1.3 var(--f-title, sans-serif); }
.asst__teaser-cta { font-size: 13px; color: var(--text-2, #b3a99c); }
.asst__teaser-close {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  border: 0; background: transparent; color: var(--text-2, #b3a99c);
  cursor: pointer;
}
.asst__teaser-close:hover { color: var(--text, #f5efe6); background: rgba(255,255,255,.06); }
@media (prefers-reduced-motion: reduce) { .asst__teaser { transition: none; } }
@media (max-width: 380px) { .asst__teaser-q { font-size: 14px; } }

/* ---------- Panneau : plein écran sur mobile ---------- */
.asst__panel {
  position: fixed; z-index: 70; inset: 0;
  display: flex; flex-direction: column;
  height: 100dvh;
  background: var(--bg, #0d0c0b);
  color: var(--text, #f5efe6);
  font-family: var(--f-text, sans-serif);
}
.asst__panel[hidden] { display: none; }
html.asst-open { overflow: hidden; }
html.asst-open .asst__fab { display: none; }

.asst__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px calc(14px) 18px;
  padding-top: calc(14px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line, #2a2623);
  background: var(--panel, #161412);
}
.asst__avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold, #d4a84b); }
.asst__who { flex: 1; min-width: 0; }
.asst__title { margin: 0; font: 700 16px/1.2 var(--f-title, sans-serif); color: var(--text, #f5efe6); }
.asst__sub { margin: 3px 0 0; font-size: 12.5px; color: var(--text-2, #b3a99c); }
.asst__sub::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #8fbf7a; margin-right: 6px; vertical-align: 1px;
}
.asst__close {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: none; border: 1px solid var(--line, #2a2623); color: var(--text, #f5efe6);
  cursor: pointer;
}
.asst__close:focus-visible { outline: 2px solid var(--gold-hi, #f0c86a); outline-offset: 2px; }

/* ---------- Fil ---------- */
.asst__log {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 16px 8px;
  display: flex; flex-direction: column; gap: 10px;
}
.asst__msg {
  max-width: 86%;
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 15.5px; line-height: 1.5;
  overflow-wrap: anywhere;
}
.asst__msg--bot { align-self: flex-start; background: var(--panel, #161412); border: 1px solid var(--line, #2a2623); border-bottom-left-radius: 6px; }
.asst__msg--user { align-self: flex-end; background: linear-gradient(180deg, var(--gold-hi, #f0c86a), var(--gold, #d4a84b)); color: #1a1408; border-bottom-right-radius: 6px; }
.asst__msg--sys { border-color: rgba(255, 179, 92, 0.45); }
.asst__msg a { color: var(--gold-hi, #f0c86a); font-weight: 600; text-underline-offset: 3px; }
.asst__msg strong { color: var(--text, #f5efe6); font-weight: 600; }

.asst__quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.asst__quick button {
  padding: 9px 14px; border-radius: 999px;
  border: 1px solid rgba(212, 168, 75, 0.5);
  background: transparent; color: var(--gold-hi, #f0c86a);
  font: 600 14px var(--f-title, sans-serif);
  cursor: pointer;
}
.asst__quick button:hover { background: rgba(212, 168, 75, 0.1); }
.asst__quick button:focus-visible { outline: 2px solid var(--gold-hi, #f0c86a); outline-offset: 2px; }

.asst__dots { display: inline-flex; gap: 4px; padding: 4px 0; }
.asst__dots i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--text-2, #b3a99c);
  animation: asst-dot 1.1s infinite ease-in-out;
}
.asst__dots i:nth-child(2) { animation-delay: .15s; }
.asst__dots i:nth-child(3) { animation-delay: .3s; }
@keyframes asst-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .asst__dots i { animation: none; opacity: .7; } }

/* ---------- Saisie ---------- */
.asst__form {
  position: relative;
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line, #2a2623);
  background: var(--panel, #161412);
}
.asst__input {
  flex: 1; resize: none;
  min-height: 44px; max-height: 120px;
  padding: 11px 14px;
  border-radius: 22px;
  border: 1px solid var(--line, #2a2623);
  background: var(--bg, #0d0c0b); color: var(--text, #f5efe6);
  font: 16px/1.4 var(--f-text, sans-serif); /* 16px : pas de zoom iOS */
}
.asst__input::placeholder { color: #7d756b; }
.asst__input:focus { outline: none; border-color: rgba(212, 168, 75, 0.6); }
.asst__send {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  border: 0; cursor: pointer;
  background: linear-gradient(180deg, var(--gold-hi, #f0c86a), var(--gold, #d4a84b)); color: #1a1408;
}
.asst__send:disabled, .asst__input:disabled { opacity: .45; cursor: not-allowed; }
.asst__send:focus-visible { outline: 2px solid var(--text, #f5efe6); outline-offset: 2px; }
.asst__consent {
  flex-basis: 100%;
  margin: 0 4px;
  font-size: 11.5px; line-height: 1.35;
  color: var(--text-2, #b3a99c);
}
.asst__err {
  position: absolute; left: 12px; right: 12px; bottom: 100%;
  margin: 0 0 6px; padding: 8px 12px; border-radius: 10px;
  background: #2a1a10; border: 1px solid rgba(255, 179, 92, 0.5);
  color: #ffcf99; font-size: 13.5px;
}

/* ---------- Desktop : panneau 380 × 560 ---------- */
@media (min-width: 720px) {
  .asst { --asst-gap: 24px; }
  .asst__panel {
    inset: auto 24px 24px auto;
    width: 380px; height: 560px; max-height: calc(100vh - 48px);
    border: 1px solid rgba(212, 168, 75, 0.35);
    border-radius: 18px; overflow: hidden;
    box-shadow: 0 24px 70px -20px rgba(0, 0, 0, .85), 0 10px 50px -18px rgba(240, 200, 106, 0.25);
  }
  html.asst-open { overflow: auto; }
  .asst__head { padding-top: 14px; }
}
