/* 1. PERSONALIZZAZIONE COLORI E FONT DI BOOTSTRAP */
:root {
  --bs-primary: #5D1A2A;
  --bs-primary-rgb: 93, 26, 42;
  --bs-body-bg: #F8F5F0;
  --bs-body-color: #3D352E;
  --bs-link-color: #4B5320;
  --bs-link-hover-color: #2e3214;
  --bs-border-color: #EAE0C8;
  
  /* Definiamo i nostri font */
  --font-titoli: 'Playfair Display', serif;
  --font-testo: 'Lato', sans-serif;
}

/* Applichiamo i font */
body {
  font-family: var(--font-testo);
}
h1, h2, h3, h4, h5, h6, .display-6 {
  font-family: var(--font-titoli);
  font-weight: 700;
}


/* 2. STILI SPECIFICI PER I NOSTRI COMPONENTI */

.prodotto-dettaglio .prodotto-img {
  max-height: 150px;
  width: auto;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.pdf-allegato-link {
    color: var(--bs-link-color);
}
.pdf-allegato-link:hover {
    color: var(--bs-link-hover-color);
    background-color: rgba(0,0,0,0.05);
    border-radius: 4px;
}

#chat-container {
  height: 70vh;
  min-height: 500px;
}
#chat-log {
  flex-grow: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.chat-bubble {
  max-width: 85%;
  padding: 0.8rem 1.2rem;
  border-radius: 1.25rem;
  margin-bottom: 1rem;
  line-height: 1.6;
}
.user-bubble {
  background-color: #EAE0C8;
  color: var(--bs-body-color);
  border-bottom-right-radius: 0.25rem;
  margin-left: auto;
}
.ai-bubble {
  background-color: #f1f1f1;
  border: 1px solid var(--bs-border-color);
  border-bottom-left-radius: 0.25rem;
  margin-right: auto;
}
.ai-bubble.loading {
  font-style: italic;
  color: #777;
  animation: chatloading 1.5s infinite;
}
@keyframes chatloading {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

#suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.suggestion-btn {
  --bs-btn-color: var(--bs-primary);
  --bs-btn-border-color: #D1C7B7;
  --bs-btn-hover-bg: var(--bs-primary);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-border-color: var(--bs-primary);
  font-weight: 700 !important;
  font-size: 0.9rem !important;
}

::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #D1C7B7;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: #bcae97;
}

/* --- 3. STILI PER LA HOME PAGE / GRIGLIA PRODOTTI --- */

.prodotto-card {
  display: block;
  border: 1px solid var(--bs-border-color);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.prodotto-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 10px 30px rgba(93, 26, 42, 0.15);
}

.prodotto-img-wrapper {
  background-color: #fff;
  height: 280px;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.prodotto-card .card-img-top {
  max-height: 100%;
  max-width: 100%;
  width: auto;
  object-fit: contain;
}

.prodotto-card .card-body {
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
}

.prodotto-card .card-title {
  color: var(--bs-primary);
  font-family: var(--font-titoli);
  font-size: 1.5rem;
}

/* --- 4. STILI PER SUGGERIMENTI COLLASSABILI --- */

#suggestionsCollapse:not(.show) + #chat-form {
  border-top: none !important;
}

#suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (max-width: 767.98px) {
  #suggestions {
    justify-content: center;
  }
}

.btn-outline-primary[data-bs-toggle="collapse"] {
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-fluid {
  max-width: 100%;
  max-height: 350px;
}

/* --- 5. STILI PER I TAG VISIVI DEI PRODOTTI --- */

.prodotto-tags {
  /* Contenitore per i tag */
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.prodotto-tags .badge {
  /* Stile base per tutti i tag */
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.4em 0.8em;
  border-radius: 50rem; /* Pill-shape */
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Stili specifici per ogni tipo di tag */
.tag-vino-rosso { background-color: #A3333D; color: white; }
.tag-vino-bianco { background-color: #F0E68C; color: #5a5223; }
.tag-spumante { background-color: #D4AF37; color: white; }
.tag-vino-rosato { background-color: #FBC6A4; color: #794a37; }
.tag-vino-dolce { background-color: #6A0DAD; color: white; }

.tag-docg { background-color: #C9B037; color: white; border: 1px solid #a78d1e;}
.tag-doc { background-color: #007bff; color: white; }

.tag-passito,
.tag-amarone,
.tag-millesimato,
.tag-superiore,
.tag-franciacorta,
.tag-selezione { 
  background-color: #6c757d;
  color: white;
}

.tag-novita { background-color: #28a745; color: white; }
.tag-sicilia { background-color: #FFD700; color: #a58100; }


/* --- 7. STILI PER LO STATO DI ATTESA (LOADING) DELLA CHAT --- */
.form-loading,
.suggestions-loading {
  opacity: 0.6;
  cursor: wait;
  pointer-events: none; 
}

/* Animazione "Sta scrivendo..." */
.ai-bubble.loading .typing-indicator {
  display: flex;
  align-items: center;
  padding: 0.5rem 0;
}
.typing-indicator span {
  height: 8px;
  width: 8px;
  background-color: #999;
  border-radius: 50%;
  display: inline-block;
  margin: 0 2px;
  animation: typing-bounce 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
  0%, 80%, 100% {
    transform: scale(0);
  } 40% {
    transform: scale(1.0);
  }
}