/*
 * Caruso AI - stile della chat incorporata.
 * Usa i colori, i caratteri e i raggi del sito (variabili di style.css),
 * con valori di riserva per poterlo usare anche in altre pagine.
 */
.cc-section {
  --cc-green: var(--color-dark-green, #0b5b4a);
  --cc-deep: var(--color-deep-green, #06342b);
  --cc-wine: var(--color-wine, #7a1416);
  --cc-gold: var(--color-gold, #d9b26a);
  --cc-paper: var(--color-paper, #fffdf9);
  --cc-sand: var(--color-sand, #f2e9da);
  --cc-line: var(--color-line, #e6dccb);
  --cc-text: var(--color-text, #211c18);
  --cc-muted: var(--color-muted, #6a6158);
  background: var(--color-cream, #faf5ec);
  padding: 0 0 clamp(56px, 8vw, 104px);
  scroll-margin-top: 100px;
}

.cc-section[hidden],
.cc-chips[hidden],
.cc-turnstile[hidden],
[data-caruso-chat-open][hidden] { display: none; }

.cc-panel {
  display: flex;
  flex-direction: column;
  max-width: 880px;
  height: min(640px, 78vh);
  margin: 0 auto;
  background: var(--cc-paper);
  border-radius: var(--radius-lg, 24px);
  box-shadow: var(--shadow-lift, 0 28px 48px -18px rgba(33, 28, 24, 0.32));
  overflow: hidden;
}

/* Testata: stesso verde del riquadro "Book or Order Online" */
.cc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px clamp(18px, 3vw, 28px);
  color: #fff;
  background: var(--cc-deep);
  background-image: radial-gradient(120% 160% at 100% 0%, #0d6a56 0%, var(--cc-deep) 70%);
}

.cc-head-text { flex: 1; min-width: 0; }

.cc-title {
  font-family: var(--font-head, Georgia, serif);
  font-size: 1.5rem;
  line-height: 1.15;
  color: #fff;
}

.cc-sub {
  margin-top: 3px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.78);
}

.cc-head-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.cc-head-btn:hover { background: #fff; border-color: #fff; color: var(--cc-deep); }
.cc-close { width: 40px; padding: 0; }
.cc-close svg { width: 18px; height: 18px; display: block; }

.cc-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: clamp(16px, 3vw, 26px);
}

.cc-msg {
  max-width: min(84%, 62ch);
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 1rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.cc-bot {
  align-self: flex-start;
  background: var(--cc-sand);
  color: var(--cc-text);
  border-bottom-left-radius: 6px;
}

.cc-user {
  align-self: flex-end;
  background: var(--cc-green);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.cc-error { background: #fdecea; color: var(--cc-wine); }

.cc-link {
  color: var(--cc-wine);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cc-dots { display: inline-flex; gap: 5px; padding: 6px 2px; }
.cc-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cc-muted);
  animation: cc-blink 1.2s infinite both;
}
.cc-dots i:nth-child(2) { animation-delay: 0.2s; }
.cc-dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes cc-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.cc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 clamp(16px, 3vw, 26px) 14px;
}

.cc-chip {
  padding: 9px 16px;
  border: 1.5px solid var(--cc-line);
  border-radius: 999px;
  background: #fff;
  color: var(--cc-text);
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.cc-chip:hover { border-color: var(--cc-green); color: var(--cc-green); }

.cc-turnstile { padding: 0 clamp(16px, 3vw, 26px) 12px; }

.cc-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px clamp(16px, 3vw, 26px);
  border-top: 1px solid var(--cc-line);
  background: var(--cc-paper);
}

.cc-input {
  flex: 1;
  min-width: 0;
  min-height: 50px;
  max-height: 132px;
  padding: 12px 16px;
  resize: none;
  border: 1.5px solid var(--cc-line);
  border-radius: 12px;
  background: #fff;
  color: var(--cc-text);
  font-family: var(--font-body, system-ui, sans-serif);
  font-size: 1rem;
  line-height: 1.5;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.cc-input:focus {
  outline: none;
  border-color: var(--cc-green);
  box-shadow: 0 0 0 4px rgba(11, 91, 74, 0.14);
}

.cc-send { min-height: 50px; }
.cc-send:disabled,
.cc-head-btn:disabled { opacity: 0.55; cursor: progress; transform: none; }

.cc-note {
  padding: 0 clamp(16px, 3vw, 26px) 16px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--cc-muted);
  background: var(--cc-paper);
}

.cc-note a { color: var(--cc-wine); font-weight: 700; }

/* Avviso mostrato solo quando la registrazione delle conversazioni e' attiva */
.cc-recording {
  padding-top: 12px;
  padding-bottom: 8px;
  border-top: 1px solid var(--cc-line);
  color: var(--cc-text);
}
.cc-recording[hidden],
.cc-recording [hidden] { display: none; }

.cc-head-btn:focus-visible,
.cc-chip:focus-visible,
.cc-log:focus-visible {
  outline: 2px solid var(--cc-gold);
  outline-offset: 2px;
}

/* Testo solo per i lettori di schermo */
.cc-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Pulsante "Ask Caruso AI": sotto titolo e sottotitolo della pagina Location,
   allineato a sinistra, con lo stile rosso dei pulsanti del sito (classe btn-accent) */
.location-ask {
  display: flex;
  width: fit-content;
  max-width: 100%;
  margin: -4px 0 32px;
  font-family: var(--font-body, system-ui, sans-serif);
}

/* sotto i 900px l'header del sito e' su due righe */
@media (max-width: 900px) {
  .cc-section { scroll-margin-top: 132px; }
}

@media (max-width: 768px) {
  .cc-panel { height: min(600px, 82vh); border-radius: 20px; }
  .cc-msg { max-width: 92%; }
  .cc-reset-label { display: none; }
}

@media (max-width: 480px) {
  .cc-head { padding: 14px 16px; }
  .cc-title { font-size: 1.3rem; }
  .cc-head-btn { padding: 8px 12px; }
  .cc-form { flex-wrap: wrap; }
  .cc-send { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .cc-dots i { animation: none; opacity: 0.6; }
}
