/* Stili specifici della pagina /assistente */

.assistant-layout {
  display: grid;
  gap: 32px;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

@media (min-width: 900px) {
  .assistant-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; }
}

/* ---------- box conversazione ---------- */

.chat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat__log {
  min-height: 300px;
  max-height: 62vh;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
}

.chat__empty {
  color: var(--muted);
  font-size: 15px;
  margin: 0;
}

.msg { display: flex; flex-direction: column; gap: 6px; max-width: 100%; }

.msg__who {
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
}

.msg__body {
  border-radius: 9px;
  padding: 12px 15px;
  font-size: 15.5px;
  line-height: 1.62;
  overflow-wrap: anywhere;
}

.msg--user { align-items: flex-end; }
.msg--user .msg__body {
  background: var(--wine-soft);
  color: var(--ink);
  max-width: 85%;
}

.msg--assistant .msg__body {
  background: var(--surface-alt);
  border: 1px solid var(--line);
}

.msg--error .msg__body {
  background: #fdf0ee;
  border: 1px solid #e9c4bd;
  color: #8a2f22;
}

@media (prefers-color-scheme: dark) {
  .msg--error .msg__body { background: #3a2320; border-color: #6b3c34; color: #f0b3a8; }
}

/* contenuto formattato della risposta */
.msg__body p { margin: 0 0 .7em; }
.msg__body p:last-child { margin-bottom: 0; }
.msg__body ul, .msg__body ol { margin: 0 0 .7em; padding-left: 1.3em; }
.msg__body li { margin-bottom: .25em; }
.msg__body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em;
  background: rgba(107, 39, 55, .09);
  padding: 1px 5px;
  border-radius: 4px;
}
@media (prefers-color-scheme: dark) {
  .msg__body code { background: rgba(255, 255, 255, .09); }
}
.msg__body strong { font-weight: 650; }

/* indicatore di attesa */
.thinking { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: 14.5px; }
.thinking__dots { display: inline-flex; gap: 3px; }
.thinking__dots i {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--wine);
  animation: vc-pulse 1.15s infinite ease-in-out;
}
.thinking__dots i:nth-child(2) { animation-delay: .16s; }
.thinking__dots i:nth-child(3) { animation-delay: .32s; }

@keyframes vc-pulse {
  0%, 70%, 100% { opacity: .28; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-2px); }
}

@media (prefers-reduced-motion: reduce) {
  .thinking__dots i { animation: none; opacity: .6; }
  .chat__log { scroll-behavior: auto; }
}

/* ---------- area di scrittura ---------- */

.chat__form {
  border-top: 1px solid var(--line);
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--surface);
}

.chat__input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  padding: 10px 12px;
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  min-height: 44px;
  max-height: 160px;
  overflow-y: auto;
}

.chat__input::placeholder { color: var(--muted); }
.chat__send { white-space: nowrap; }
.chat__send[disabled] { opacity: .5; cursor: not-allowed; }

.chat__note {
  border-top: 1px solid var(--line);
  padding: 9px 14px;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--surface-alt);
  margin: 0;
}

/* ---------- esempi ---------- */

.examples { margin: 0 0 22px; }
.examples__title { font-size: 13px; color: var(--muted); margin: 0 0 9px; }
.examples__list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }

.chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.chip:hover { border-color: var(--wine); background: var(--wine-soft); }

/* ---------- colonna laterale ---------- */

.aside-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  font-size: 14.5px;
}
.aside-card h2 { font-size: 16px; margin: 0 0 .6em; font-family: var(--sans); font-weight: 700; }
.aside-card ul { margin: 0; padding-left: 1.15em; color: var(--muted); }
.aside-card li { margin-bottom: .34em; }
.aside-card p { color: var(--muted); margin-bottom: 0; }
.aside-card + .aside-card { margin-top: 18px; }

/* ---------- modale avviso ---------- */

.modal[hidden] { display: none; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(24, 16, 18, .62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 100;
}

.modal__box {
  background: var(--surface);
  color: var(--ink);
  border-radius: 12px;
  max-width: 560px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 26px 28px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, .3);
}

.modal__box h2 {
  margin-top: 0;
  font-size: 21px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.modal__box p { font-size: 14.7px; }
.modal__box p:last-of-type { margin-bottom: 0; }
.modal__actions { margin-top: 20px; display: flex; justify-content: flex-end; }
