/* Glace8 Assistant — styles du widget, alignés sur le thème glace8-custom
   (tokens --g8-* de homepage.css, même langage que le mini-panier).
   Les valeurs de repli ne servent que si le thème ne charge pas ses tokens. */

:root {
  --g8a-navy: var(--g8-navy, #22314C);
  --g8a-navy-hover: var(--g8-navy-hover, #304568);
  --g8a-rose: var(--g8-rose-soft, #FECDC0);
  --g8a-rose-pale: var(--g8-rose-pale, #FEE7E1);
  --g8a-rose-hover: var(--g8-rose-hover, #F7BCAE);
  --g8a-coral: var(--g8-coral-strong, #C87870);
  --g8a-foam: var(--g8-foam-soft, #F6FDFF);
  --g8a-bg: #FFFDFC;
  --g8a-text: var(--g8-text, #3C3C3C);
  --g8a-muted: var(--g8-muted, rgba(60, 60, 60, .68));
  --g8a-border: var(--g8-border, rgba(34, 49, 76, .14));
  --g8a-border-strong: rgba(34, 49, 76, .22);
  --g8a-danger: #A12622;
  --g8a-success: #1F6B3A;
  --g8a-radius: var(--g8-radius, 8px);
  --g8a-font: var(--g8-font-body, "Nobel Sans", "Inter", "Avenir Next", system-ui, sans-serif);
  --g8a-font-heading: var(--g8-font-heading, "Nobel", "Avenir Next", "Futura", system-ui, sans-serif);
  --g8a-z: 99990; /* sous le mini-panier du thème (100100) */
  --g8a-offset: 20px; /* à augmenter si un bandeau cookies occupe le bas de l'écran */
}

.g8a-launcher, .g8a-panel, .g8a-panel * { box-sizing: border-box; font-family: var(--g8a-font); -webkit-tap-highlight-color: transparent; }
.g8a-panel h2, .g8a-panel h3 { font-family: var(--g8a-font-heading); }

/* Bouton d'ouverture : action « navy » du thème (g8-button--navy). */
.g8a-launcher {
  position: fixed; right: var(--g8a-offset); bottom: var(--g8a-offset); z-index: var(--g8a-z);
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 48px; padding: 0 18px 0 15px; border: 1px solid var(--g8a-navy); border-radius: var(--g8a-radius);
  background: var(--g8a-navy); color: #fff;
  font-size: .92rem; font-weight: 500; line-height: 1.1; cursor: pointer;
  box-shadow: 0 12px 24px -16px rgba(34, 49, 76, .62), 0 2px 6px rgba(34, 49, 76, .12);
  transition: transform .18s ease, background .18s ease;
}
.g8a-launcher:hover { background: var(--g8a-navy-hover); transform: translateY(-1px); }
.g8a-launcher:active { transform: scale(.96); transition-duration: .08s; }
.g8a-launcher:focus-visible { outline: 3px solid var(--g8a-navy); outline-offset: 3px; }
.g8a-launcher__icon {
  width: 20px; height: 20px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M5 4.5h14a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-9l-4.5 3.5v-3.5H5a2 2 0 0 1-2-2v-9a2 2 0 0 1 2-2z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M5 4.5h14a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-9l-4.5 3.5v-3.5H5a2 2 0 0 1-2-2v-9a2 2 0 0 1 2-2z'/%3E%3C/svg%3E") center / contain no-repeat;
}
html.g8a-open .g8a-launcher { display: none; }

/* Panneau : mêmes surfaces que le mini-panier (fond #fffdfc, en-tête écume). */
.g8a-panel {
  position: fixed; right: var(--g8a-offset); bottom: var(--g8a-offset); z-index: calc(var(--g8a-z) + 1);
  display: flex; flex-direction: column;
  width: 392px; height: min(620px, calc(100vh - 2 * var(--g8a-offset)));
  background: var(--g8a-bg); color: var(--g8a-text);
  border: 1px solid rgba(34, 49, 76, .12); border-radius: var(--g8a-radius);
  box-shadow: 0 28px 70px -36px rgba(29, 42, 66, .68), 0 4px 14px rgba(34, 49, 76, .08);
  overflow: hidden; font-size: .92rem; font-weight: 400; line-height: 1.5;
}
.g8a-panel[hidden] { display: none; }

.g8a-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 16px 20px; border-bottom: 1px solid var(--g8a-border); background: var(--g8a-foam); }
.g8a-title { margin: 0; color: var(--g8a-navy); font-size: 1.25rem; font-weight: 560; line-height: 1.15; }
.g8a-close { display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 1px solid var(--g8a-border-strong); border-radius: 50%; background: #fff; color: var(--g8a-navy); font-size: 1.6rem; line-height: 1; cursor: pointer; }
.g8a-close:hover { border-color: var(--g8a-navy); background: var(--g8a-rose-pale); }

.g8a-preview { margin: 0; padding: 7px 20px; background: var(--g8a-rose-pale); color: var(--g8a-navy); font-size: .74rem; font-weight: 600; }
.g8a-notice { margin: 0; padding: 9px 20px; border-bottom: 1px solid var(--g8a-border); color: var(--g8a-muted); font-size: .74rem; line-height: 1.45; }
.g8a-notice a { color: var(--g8a-navy); text-decoration: underline; text-underline-offset: 3px; }

.g8a-log { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.g8a-msg { max-width: 88%; padding: 11px 14px; border-radius: var(--g8a-radius); overflow-wrap: anywhere; }
.g8a-msg p { margin: 0 0 8px; }
.g8a-msg p:last-child { margin-bottom: 0; }
.g8a-msg ul, .g8a-msg ol { margin: 0 0 8px; padding-left: 20px; }
.g8a-msg strong { color: var(--g8a-navy); font-weight: 600; }
.g8a-msg a { color: var(--g8a-navy); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.g8a-msg--assistant { align-self: flex-start; border: 1px solid var(--g8a-border); background: #fff; border-bottom-left-radius: 2px; }
.g8a-msg--user { align-self: flex-end; background: var(--g8a-rose-pale); color: var(--g8a-navy); border-bottom-right-radius: 2px; white-space: pre-wrap; }
.g8a-msg--error { border-left: 3px solid var(--g8a-danger); }
.g8a-msg--success { border-left: 3px solid var(--g8a-success); }

.g8a-typing { display: inline-flex; gap: 5px; padding: 15px 16px; }
.g8a-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--g8a-coral); animation: g8a-dot 1.2s infinite ease-in-out; }
.g8a-typing span:nth-child(2) { animation-delay: .15s; }
.g8a-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes g8a-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Questions suggérées : bouton secondaire du thème. */
.g8a-chips { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.g8a-chip { min-height: 44px; max-width: 100%; padding: 10px 14px; border: 1px solid var(--g8a-border-strong); border-radius: var(--g8a-radius); background: #fff; color: var(--g8a-navy); font-size: .86rem; font-weight: 500; line-height: 1.3; text-align: left; cursor: pointer; transition: background .18s ease, border-color .18s ease; }
.g8a-chip:hover { border-color: var(--g8a-navy); background: var(--g8a-foam); }

/* Boutons : primaire rose / texte navy (g8-button--primary), secondaire blanc. */
.g8a-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.g8a-btn { min-height: 48px; padding: 0 18px; border: 1px solid var(--g8a-border-strong); border-radius: var(--g8a-radius); background: #fff; color: var(--g8a-navy); font-size: .88rem; font-weight: 500; line-height: 1.1; cursor: pointer; transition: background .18s ease, border-color .18s ease, box-shadow .18s ease; }
.g8a-btn:hover { border-color: var(--g8a-navy); background: var(--g8a-foam); }
.g8a-btn--primary { border-color: transparent; background: var(--g8a-rose); box-shadow: 0 12px 26px -18px rgba(34, 49, 76, .48); }
.g8a-btn--primary:hover { border-color: transparent; background: var(--g8a-rose-hover); }
.g8a-btn[disabled] { color: var(--g8a-muted); background: var(--g8a-rose-pale); box-shadow: none; cursor: progress; }

.g8a-compose { display: flex; align-items: flex-end; gap: 8px; padding: 12px 16px 14px; border-top: 1px solid var(--g8a-border); background: #fff; }
.g8a-compose[hidden] { display: none; }
.g8a-input { flex: 1; min-height: 48px; max-height: 120px; padding: 12px 13px; border: 1px solid rgba(34, 49, 76, .24); border-radius: var(--g8a-radius); resize: none; font: inherit; font-size: .92rem; color: var(--g8a-text); background: #fff; }
.g8a-input::placeholder { color: var(--g8a-muted); }
.g8a-send { display: grid; place-items: center; width: 48px; height: 48px; flex: none; padding: 0; border: 1px solid var(--g8a-navy); border-radius: var(--g8a-radius); background: var(--g8a-navy); color: #fff; cursor: pointer; transition: background .18s ease; }
.g8a-send:hover { background: var(--g8a-navy-hover); }
.g8a-send[disabled] { border-color: transparent; background: var(--g8a-rose-pale); color: var(--g8a-muted); cursor: default; }
.g8a-send__icon { display: block; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat; }

/* Focus : contour navy sur les boutons, halo rose sur les champs (comme le formulaire de contact). */
.g8a-close:focus-visible, .g8a-chip:focus-visible, .g8a-btn:focus-visible, .g8a-send:focus-visible, .g8a-panel a:focus-visible { outline: 3px solid var(--g8a-navy); outline-offset: 3px; }
.g8a-input:focus, .g8a-field input:focus, .g8a-field select:focus, .g8a-field textarea:focus { border-color: var(--g8a-coral); outline: 3px solid var(--g8a-rose-pale); outline-offset: 2px; box-shadow: 0 0 0 1px var(--g8a-rose); }

.g8a-escalation { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--g8a-border); border-radius: var(--g8a-radius); background: #fff; }
.g8a-escalation__title { margin: 0; color: var(--g8a-navy); font-size: 1.05rem; font-weight: 560; line-height: 1.2; }
.g8a-escalation__intro { margin: 0; color: var(--g8a-muted); font-size: .8rem; }
.g8a-field { display: flex; flex-direction: column; gap: 5px; font-size: .84rem; }
.g8a-field__label { color: var(--g8a-navy); font-weight: 600; }
.g8a-field input, .g8a-field select, .g8a-field textarea { width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid rgba(34, 49, 76, .24); border-radius: var(--g8a-radius); font: inherit; font-size: .92rem; color: var(--g8a-text); background: #fff; }
.g8a-field textarea { min-height: 96px; resize: vertical; }
.g8a-field input[type="file"] { padding: 8px 0; border: 0; min-height: 0; font-size: .8rem; }
.g8a-consent { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; color: var(--g8a-muted); font-size: .8rem; }
.g8a-consent input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--g8a-navy); }
.g8a-consent a { color: var(--g8a-navy); text-decoration: underline; text-underline-offset: 3px; }
.g8a-form-error { margin: 0; color: var(--g8a-danger); font-size: .8rem; font-weight: 500; }
.g8a-form-error:empty { display: none; }
.g8a-hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; opacity: 0; }

.g8a-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Mobile : icône seule, panneau plein écran. */
@media (max-width: 600px) {
  .g8a-launcher { padding: 0; width: 56px; height: 56px; justify-content: center; right: 16px; bottom: 16px; }
  .g8a-launcher__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .g8a-panel { right: 0; bottom: 0; left: 0; top: 0; width: 100%; height: 100%; height: 100dvh; border: 0; border-radius: 0; }
  html.g8a-open, html.g8a-open body { overflow: hidden; }
  .g8a-panel { border-radius: 0; }
  .g8a-header { padding: 14px 14px 14px 18px; }
  .g8a-log { padding: 16px; }
  .g8a-compose { padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); }
  .g8a-input, .g8a-field input, .g8a-field select, .g8a-field textarea { font-size: 16px; } /* évite le zoom automatique sur iOS */
}

@media (prefers-reduced-motion: reduce) {
  .g8a-typing span { animation: none; opacity: .6; }
  .g8a-launcher, .g8a-chip, .g8a-btn, .g8a-send { transition: none; }
  .g8a-launcher:hover, .g8a-launcher:active { transform: none; }
}
