/* ============================================================================
   Page Aria — styles
   ============================================================================
   Principe : le chat EST la page. Il est placé en haut, il est haut (il occupe
   l'écran sur mobile), et la saisie reste toujours accessible en bas.
   Le reste — bandeau de présentation, aide — tient en peu de lignes.
   Palette : celles du serveur (vert, « diamant »), plus de violet.
   ============================================================================ */

.aria-page {
  --aria-1: #7ac74f;
  --aria-2: #57d3ff;
  --aria-glow: rgba(87, 211, 255, .3);
}

/* ---------- Fond animé : nappes de bleu qui dérivent lentement ---------- */
/* Le fond ne doit jamais distraire du chat, mais il doit donner l'impression que la page
   est vivante. Trois principes : un dégradé qui respire, des nappes très floues qui
   dérivent sur de longues durées, et un fondu (« screen ») qui les fait se mêler à la
   manière d'une lumière, pas de taches posées. */
.aria-aurore { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

/* Voile de fond : nappes bleutées qui se déplacent en cadence lente */
.aria-aurore::before {
  content: '';
  position: absolute; inset: -25%;
  background:
    radial-gradient(42% 38% at 16% 18%, rgba(30, 100, 200, .40), transparent 70%),
    radial-gradient(38% 36% at 84% 24%, rgba(0, 158, 205, .32), transparent 72%),
    radial-gradient(48% 44% at 52% 90%, rgba(18, 58, 148, .38), transparent 74%);
  animation: ariaDerive 30s ease-in-out infinite alternate;
}
@keyframes ariaDerive {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(2.5%, -2%, 0) scale(1.06); }
  100% { transform: translate3d(-2%, 2.5%, 0) scale(1.02); }
}

/* Nappes floues : chacune dérive à sa propre vitesse, ce qui évite l'effet « bloc » */
.aria-aurore i {
  position: absolute; display: block; border-radius: 50%;
  filter: blur(72px); mix-blend-mode: screen; will-change: transform;
}
.aria-aurore i:nth-child(1) {
  width: 52vmax; height: 52vmax; left: -16vmax; top: -18vmax;
  background: radial-gradient(circle at 40% 40%, rgba(64, 150, 255, .55), transparent 66%);
  animation: ariaFlotte1 38s ease-in-out infinite;
}
.aria-aurore i:nth-child(2) {
  width: 44vmax; height: 44vmax; right: -14vmax; top: 6vmax;
  background: radial-gradient(circle at 50% 50%, rgba(0, 176, 220, .48), transparent 68%);
  animation: ariaFlotte2 46s ease-in-out infinite;
}
.aria-aurore i:nth-child(3) {
  width: 48vmax; height: 48vmax; left: 18vmax; bottom: -22vmax;
  background: radial-gradient(circle at 50% 50%, rgba(28, 72, 190, .52), transparent 70%);
  animation: ariaFlotte3 42s ease-in-out infinite;
}
@keyframes ariaFlotte1 {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(9vmax, 6vmax, 0) scale(1.12); }
}
@keyframes ariaFlotte2 {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1.05); }
  50%      { transform: translate3d(-8vmax, 9vmax, 0) scale(.94); }
}
@keyframes ariaFlotte3 {
  0%, 100% { transform: translate3d(0, 0, 0) scale(.96); }
  50%      { transform: translate3d(7vmax, -7vmax, 0) scale(1.1); }
}
.aria-page > .container { position: relative; z-index: 1; }

/* ---------- Bandeau de présentation : une seule ligne ---------- */
.aria-tete {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 0 16px;
}
.aria-portrait-petit {
  position: relative; flex-shrink: 0;
  width: 58px; height: 58px; border-radius: 16px;
  padding: 2px;
  background: linear-gradient(135deg, var(--aria-1), var(--aria-2));
}
/* La « respiration » : un halo qui s'ouvre et se referme lentement derrière l'avatar.
   C'est ce qui donne l'impression qu'Aria est présente plutôt qu'affichée. */
.aria-portrait-petit::after {
  content: '';
  position: absolute; inset: -7px; border-radius: 22px; z-index: -1;
  background: radial-gradient(circle, rgba(87, 211, 255, .75), rgba(122, 199, 79, .35) 55%, transparent 75%);
  filter: blur(13px);
  animation: ariaRespire 4.6s ease-in-out infinite;
}
@keyframes ariaRespire {
  0%, 100% { opacity: .38; transform: scale(.94); }
  50%      { opacity: .82; transform: scale(1.09); }
}
.aria-portrait-petit img {
  width: 100%; height: 100%; display: block; border-radius: 14px;
  image-rendering: pixelated; background: #0b0e14; object-fit: cover;
}
.aria-tete-texte { min-width: 0; }
.aria-tete-texte h1 {
  margin: 0; font-family: var(--font-pixel); font-size: 1.35rem; letter-spacing: 2px;
  background: linear-gradient(100deg, var(--aria-1), var(--aria-2) 40%, #eaf6ff 50%, var(--aria-2) 60%, var(--aria-1));
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  /* Un léger reflet qui traverse le nom : c'est ce qui le fait « briller » sans clignoter. */
  animation: ariaBrillance 7s ease-in-out infinite;
}
@keyframes ariaBrillance {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
.aria-tete-texte p {
  margin: 4px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.45;
}
.aria-etat { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; color: var(--aria-1); }
.aria-etat i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--aria-1);
  box-shadow: 0 0 7px var(--aria-1);
}

/* ---------- LE CHAT ---------- */
/* Pas de hauteur imposée : le chat s'ajuste à son contenu et ne grandit qu'au fur
   et à mesure, jusqu'à un plafond. Une conversation d'un seul message ne laisse
   donc pas une grande zone vide. */
.aria-chat {
  display: flex; flex-direction: column;
  max-height: min(72vh, 620px);
  border-radius: 18px; overflow: hidden;
  background: rgba(18, 24, 38, .78);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border: 1px solid var(--border-strong);
  /* Halo qui respire très légèrement : la page donne l'impression d'être vivante
     sans jamais attirer l'œil plus que la conversation elle-même. */
  animation: ariaChatRespire 7s ease-in-out infinite;
}
@keyframes ariaChatRespire {
  0%, 100% { box-shadow: 0 22px 52px rgba(0, 0, 0, .45), 0 0 0 1px rgba(87, 211, 255, .05); }
  50%      { box-shadow: 0 22px 52px rgba(0, 0, 0, .45), 0 0 28px rgba(87, 211, 255, .16); }
}
/* Sur téléphone, le chat peut monter presque jusqu'au bas de l'écran. */
@media (max-width: 760px) {
  .aria-chat { max-height: calc(100dvh - 190px); border-radius: 14px; }
  .aria-page > .container { padding-left: 12px; padding-right: 12px; }
}

.aria-chat-tete {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 16px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, .2);
}
.aria-chat-titre {
  font-size: .78rem; font-weight: 700; letter-spacing: .8px; text-transform: uppercase;
  color: var(--muted-2); display: flex; align-items: baseline; gap: 8px;
}
.aria-chat-titre em { font-style: normal; font-weight: 500; letter-spacing: 0; text-transform: none; opacity: .7; }
.aria-effacer {
  flex-shrink: 0; padding: 6px 13px; border-radius: 100px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--muted);
  font-family: var(--font-body); font-size: .78rem;
  transition: color .16s, border-color .16s;
}
.aria-effacer:hover { color: var(--red); border-color: rgba(255, 92, 92, .5); }

.aria-fil {
  flex: 1; min-height: 130px; overflow-y: auto;
  padding: 16px; display: flex; flex-direction: column; gap: 13px;
  scroll-behavior: smooth; overscroll-behavior: contain;
}
.aria-msg { display: flex; gap: 9px; align-items: flex-start; }
/* Les messages arrivés pendant la visite apparaissent en glissant : l'échange paraît
   vivant. Les messages de l'historique, eux, sont déjà là et ne bougent pas. */
.aria-msg.aria-nouveau { animation: ariaEntre .34s cubic-bezier(.22,.8,.3,1) both; }
@keyframes ariaEntre {
  from { opacity: 0; transform: translateY(9px); }
  to   { opacity: 1; transform: none; }
}
.aria-msg > img {
  width: 28px; height: 28px; border-radius: 8px; image-rendering: pixelated;
  flex-shrink: 0; background: rgba(0, 0, 0, .3); border: 1px solid var(--border);
}
.aria-msg .bulle {
  padding: 10px 14px; border-radius: 14px; line-height: 1.6; font-size: .91rem;
  max-width: min(640px, 86%); overflow-wrap: anywhere;
}
.aria-msg--elle .bulle { background: var(--surface-2); border: 1px solid var(--border); border-top-left-radius: 4px; }
.aria-msg--moi { flex-direction: row-reverse; }
.aria-msg--moi .bulle {
  background: linear-gradient(135deg, rgba(122, 199, 79, .17), rgba(87, 211, 255, .13));
  border: 1px solid rgba(87, 211, 255, .28); border-top-right-radius: 4px;
}
.aria-msg .bulle p { margin: 0 0 .5rem; }
.aria-msg .bulle p:last-child { margin-bottom: 0; }
.aria-msg .bulle a { color: var(--aria-2); text-decoration: none; border-bottom: 1px dashed rgba(87, 211, 255, .5); }
.aria-msg .bulle a:hover { border-bottom-style: solid; }
.aria-msg .bulle code {
  background: rgba(87, 211, 255, .12); border: 1px solid rgba(87, 211, 255, .3);
  border-radius: 6px; padding: .1rem .42rem; font-family: var(--font-mono); color: #7dffe0;
}
/* Éléments produits par Aria (grille de fabrication, pastille d'objet) */
.aria-msg .bulle .aria-recette {
  margin: 8px 0 4px; padding: 10px; border-radius: 12px;
  background: rgba(0, 0, 0, .3); border: 1px solid var(--border);
}
.aria-msg .bulle .aria-recette-nom { font-size: .9rem; }

/* Indicateur de frappe */
.aria-frappe { display: none; gap: 5px; padding: 4px 16px 12px; flex-shrink: 0; }
.aria-frappe.on { display: flex; }
.aria-frappe i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--aria-2);
  animation: ariaFrappe 1.3s infinite both;
}
.aria-frappe i:nth-child(2) { animation-delay: .18s; }
.aria-frappe i:nth-child(3) { animation-delay: .36s; }
@keyframes ariaFrappe { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* Suggestions */
.aria-suggest {
  display: flex; gap: 7px; padding: 4px 16px 14px; flex-shrink: 0;
  overflow-x: auto; scrollbar-width: none;
}
.aria-suggest::-webkit-scrollbar { display: none; }
.aria-chip {
  padding: 8px 14px; border-radius: 100px; cursor: pointer; white-space: nowrap; flex-shrink: 0;
  background: rgba(255, 255, 255, .07); border: 1px solid var(--border-strong);
  color: var(--text); font-size: .81rem; font-family: var(--font-body);
  transition: color .16s, border-color .16s, background .16s;
}
.aria-chip:hover, .aria-chip:active { background: rgba(87, 211, 255, .12); border-color: rgba(87, 211, 255, .5); }

/* Saisie — collée en bas du chat, toujours accessible */
.aria-saisie {
  display: flex; gap: 9px; padding: 11px 14px; flex-shrink: 0;
  border-top: 1px solid var(--border); background: rgba(0, 0, 0, .25);
}
.aria-saisie input {
  flex: 1; min-width: 0; padding: 12px 16px; border-radius: 100px;
  background: rgba(0, 0, 0, .34); border: 1px solid var(--border-strong);
  color: var(--text); font-family: var(--font-body); font-size: .93rem;
}
.aria-saisie input:focus { outline: none; border-color: rgba(87, 211, 255, .5); }
.aria-saisie input::placeholder { color: var(--muted-2); }
.aria-saisie button[type="submit"] {
  width: 46px; height: 46px; flex-shrink: 0; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--aria-1), var(--aria-2));
  border: 0; color: #06120a;
  transition: filter .16s, transform .16s;
}
.aria-saisie button[type="submit"] svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.aria-saisie button[type="submit"]:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }
.aria-saisie button[type="submit"]:disabled { opacity: .45; cursor: not-allowed; }
.aria-saisie--verrou { justify-content: center; align-items: center; flex-wrap: wrap; gap: 12px; padding: 16px; }
.aria-saisie--verrou span { color: var(--muted); font-size: .88rem; }
.aria-saisie--verrou a {
  padding: 9px 20px; border-radius: 100px; text-decoration: none; font-weight: 600; font-size: .88rem;
  background: linear-gradient(135deg, var(--aria-1), var(--aria-2)); color: #06120a;
}

/* ---------- Aide ---------- */
.aria-section { margin: 34px 0 46px; }
.aria-usage { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 780px) { .aria-usage { grid-template-columns: repeat(2, 1fr); } }
.aria-usage-card {
  padding: 18px 20px; border-radius: 15px;
  background: var(--surface); border: 1px solid var(--border);
}
.aria-usage-card h3 { margin: 0 0 7px; display: flex; align-items: center; gap: 9px; font-size: .96rem; }
.aria-usage-card h3 .nav-ico { color: var(--aria-2); width: 18px; height: 18px; }
.aria-usage-card p { color: var(--muted); margin: 0 0 12px; font-size: .9rem; line-height: 1.6; }
.aria-exemple {
  display: block; padding: 10px 13px; border-radius: 9px;
  background: rgba(0, 0, 0, .3); border: 1px solid var(--border);
  font-family: var(--font-mono); font-size: .93rem; color: #cfe9ff;
}
.aria-exemple b { color: var(--aria-1); }
.aria-note {
  margin-top: 20px; padding: 13px 16px; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); font-size: .83rem; line-height: 1.6;
}

@media (prefers-reduced-motion: reduce) {
  .aria-frappe i, .aria-aurore i { animation: none !important; }
}

/* La page Aria a sa propre ligne directe : le chat flottant global du site ferait
   doublon et brouillerait le propos. Il reste présent partout ailleurs. */
.fw-chatbar { display: none; }