/* agent-feature.css — concierge IA (page /assistant/). Scopé, chargé sur cette page seule. */

.agent-shell {
  display: flex;
  flex-direction: column;
  height: min(72vh, 720px);
  border: 1px solid var(--grid-border, rgba(0, 0, 0, 0.1));
  border-radius: 14px;
  background: var(--neu-light, rgba(255, 255, 255, 0.75));
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 18px 40px -28px rgba(0, 0, 0, 0.45);
}
:root[data-theme='dark'] .agent-shell {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(236, 238, 243, 0.12);
}

/* Journal scrollable */
.agent-log { flex: 1; overflow-y: auto; padding: 1.4rem; display: flex; flex-direction: column; gap: 0.9rem; scroll-behavior: smooth; }

/* Intro + chips de démarrage */
.agent-intro { max-width: 38rem; }
.agent-intro-hi { font-family: var(--font-title, 'Space Grotesk', sans-serif); font-size: 1.25rem; font-weight: 700; margin: 0 0 0.5rem; }
.agent-intro-sub { font-size: 0.95rem; line-height: 1.55; color: rgba(0, 0, 0, 0.65); margin: 0 0 1.2rem; }
:root[data-theme='dark'] .agent-intro-sub { color: rgba(236, 238, 243, 0.7); }
.agent-starters { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.agent-chip {
  border: 1px solid var(--grid-border, rgba(0, 0, 0, 0.14));
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.84rem;
  line-height: 1.3;
  text-align: left;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.agent-chip:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.agent-chip:active { transform: translateY(1px); }
:root[data-theme='dark'] .agent-chip { border-color: rgba(236, 238, 243, 0.18); }

/* Bulles */
.agent-msg { display: flex; }
.agent-msg--user { justify-content: flex-end; }
.agent-msg--bot { justify-content: flex-start; }
.agent-bubble {
  max-width: 84%;
  padding: 0.7rem 0.95rem;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.55;
  word-wrap: break-word;
}
.agent-msg--user .agent-bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.agent-msg--bot .agent-bubble {
  background: rgba(0, 0, 0, 0.05);
  border-bottom-left-radius: 4px;
}
:root[data-theme='dark'] .agent-msg--bot .agent-bubble { background: rgba(236, 238, 243, 0.08); }
.agent-bubble a { color: var(--accent); font-weight: 600; text-decoration: none; }
.agent-msg--user .agent-bubble a { color: #fff; text-decoration: underline; }
.agent-bubble a:hover { text-decoration: underline; }

/* Indicateur de saisie */
.agent-typing { display: inline-flex; gap: 4px; align-items: center; }
.agent-typing span { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.4; animation: agent-blink 1.2s infinite both; }
.agent-typing span:nth-child(2) { animation-delay: 0.2s; }
.agent-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes agent-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 0.9; } }
@media (prefers-reduced-motion: reduce) { .agent-typing span { animation: none; } }

/* Saisie */
.agent-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.8rem;
  border-top: 1px solid var(--grid-border, rgba(0, 0, 0, 0.1));
  background: rgba(0, 0, 0, 0.015);
}
:root[data-theme='dark'] .agent-form { border-top-color: rgba(236, 238, 243, 0.12); background: rgba(255, 255, 255, 0.02); }
.agent-input {
  flex: 1;
  border: 1px solid var(--grid-border, rgba(0, 0, 0, 0.15));
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  font: inherit;
  font-size: 0.95rem;
  background: var(--bg-main);
  color: inherit;
}
.agent-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.agent-input:disabled { opacity: 0.6; }
.agent-send {
  flex-shrink: 0;
  width: 2.9rem;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}
.agent-send:hover:not(:disabled) { filter: brightness(1.05); }
.agent-send:active:not(:disabled) { transform: translateY(1px); }
.agent-send:disabled { opacity: 0.5; cursor: default; }

.agent-disclaimer {
  margin: 0;
  padding: 0.55rem 1rem;
  font-size: 0.72rem;
  line-height: 1.4;
  color: rgba(0, 0, 0, 0.5);
  border-top: 1px solid var(--grid-border, rgba(0, 0, 0, 0.08));
  text-align: center;
}
:root[data-theme='dark'] .agent-disclaimer { color: rgba(236, 238, 243, 0.5); border-top-color: rgba(236, 238, 243, 0.1); }

/* Label masqué visuellement (a11y input) */
.agent-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Pièces jointes d'une réponse (cartes / CTA / suivis), alignées côté bot */
.agent-attach { max-width: 92%; }
.agent-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0.6rem;
}
.agent-card {
  display: flex; flex-direction: column; gap: 0.3rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--grid-border, rgba(0, 0, 0, 0.12));
  border-radius: 12px;
  background: var(--bg-main, #fff);
  color: inherit; text-decoration: none;
  transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}
.agent-card:hover { border-color: var(--accent); box-shadow: 0 6px 18px -12px rgba(0, 0, 0, 0.4); }
.agent-card:active { transform: translateY(1px); }
:root[data-theme='dark'] .agent-card { background: rgba(236, 238, 243, 0.04); border-color: rgba(236, 238, 243, 0.14); }
.agent-card--doc { background: color-mix(in srgb, var(--accent) 5%, var(--bg-main, #fff)); }
.agent-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.4rem; }
.agent-card-name { font-family: var(--font-title, sans-serif); font-weight: 700; font-size: 0.92rem; line-height: 1.2; }
.agent-card-meta { margin: 0; font-size: 0.76rem; opacity: 0.6; }
.agent-card-pro { margin: 0; font-size: 0.8rem; line-height: 1.35; color: #1a7f4b; }
.agent-card-con { margin: 0; font-size: 0.8rem; line-height: 1.35; color: rgba(0, 0, 0, 0.55); }
:root[data-theme='dark'] .agent-card-pro { color: #56c98a; }
:root[data-theme='dark'] .agent-card-con { color: rgba(236, 238, 243, 0.6); }
.agent-card-link { margin-top: 0.2rem; font-size: 0.8rem; font-weight: 600; color: var(--accent); }
.agent-card-sov { flex-shrink: 0; font-size: 0.68rem; font-weight: 600; color: #1a7f4b; white-space: nowrap; }
:root[data-theme='dark'] .agent-card-sov { color: #56c98a; }

/* CTA Roméo (parité : à côté des cartes, jamais à leur place) */
.agent-cta {
  display: flex; flex-direction: column; gap: 0.25rem;
  margin-top: 0.6rem; padding: 0.75rem 0.85rem;
  border: 1px solid var(--accent); border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: inherit; text-decoration: none;
}
.agent-cta:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.agent-cta-head { font-size: 0.95rem; }
.agent-cta-body { font-size: 0.82rem; line-height: 1.4; opacity: 0.8; }
.agent-card-ours {
  display: inline-block; font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.1rem 0.4rem; border-radius: 999px; vertical-align: middle;
  background: var(--accent); color: #fff;
}

/* Quick-replies de suivi */
.agent-suivis { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Bulle d'erreur distincte + bouton Réessayer */
.agent-bubble--error {
  background: color-mix(in srgb, #d93636 12%, var(--bg-main, #fff)) !important;
  border: 1px solid color-mix(in srgb, #d93636 40%, transparent);
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem;
}
:root[data-theme='dark'] .agent-bubble--error { background: rgba(217, 54, 54, 0.16) !important; }
.agent-retry {
  font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer;
  padding: 0.25rem 0.7rem; border-radius: 999px;
  border: 1px solid var(--accent); background: transparent; color: var(--accent);
}
.agent-retry:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
