/* ============================================================
 * COOKIE BANNER CSS - Analisi e Prove S.r.l.
 * Sito: www.analisieprove.it
 * ============================================================ */

/* ============================================================
   OVERLAY BANNER
   ============================================================ */
#aepp-cookie-overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  background: rgba(30, 30, 30, 0.97);
  color: #fff;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  font-family: "Poppins", Arial, sans-serif;
  transform: translateY(100%);
  transition: transform 0.4s ease;
}

#aepp-cookie-overlay.aepp-visible {
  transform: translateY(0);
}

/* ============================================================
   CONTAINER E TESTO DEL BANNER
   ============================================================ */
.aepp-cookie-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 15px;
}

.aepp-cookie-text {
  flex: 1;
  min-width: 280px;
  font-size: 14px;
  line-height: 1.6;
}

.aepp-cookie-text a {
  color: #e74c3c;
  text-decoration: underline;
}

.aepp-cookie-text a:hover {
  color: #ff6b5b;
}

.aepp-cookie-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* ============================================================
   PULSANTI PRINCIPALI (Accetta / Rifiuta / Personalizza / Salva)
   ============================================================ */
.aepp-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.aepp-btn-accept {
  background: #e74c3c;
  color: #fff;
}

.aepp-btn-accept:hover {
  background: #c0392b;
}

.aepp-btn-reject,
.aepp-btn-customize {
  background: transparent;
  color: #fff;
  border: 1px solid #888;
}

.aepp-btn-reject:hover,
.aepp-btn-customize:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Pulsante cambio lingua nel banner */
.aepp-lang-btn {
  background: transparent;
  color: #ccc;
  border: 1px solid #666;
  border-radius: 4px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.aepp-lang-btn:hover {
  color: #fff;
  border-color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

/* ============================================================
   PANNELLO DETTAGLI (Personalizza)
   ============================================================ */
#aepp-cookie-details {
  display: none;
  border-top: 1px solid #444;
  padding: 15px 20px;
  max-width: 1200px;
  margin: 0 auto;
  font-size: 13px;
  line-height: 1.5;
}

#aepp-cookie-details.aepp-open {
  display: block;
}

.aepp-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #333;
  flex-wrap: wrap;
}

.aepp-detail-row:last-child {
  border-bottom: none;
}

.aepp-detail-info {
  flex: 1;
  min-width: 220px;
}

.aepp-detail-info strong {
  display: block;
  color: #fff;
  margin-bottom: 3px;
}

.aepp-detail-info span {
  color: #aaa;
  font-size: 12px;
}

.aepp-detail-info a {
  color: #e74c3c;
  text-decoration: underline;
}

/* Toggle switch */
.aepp-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}

.aepp-toggle input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}

.aepp-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #555;
  border-radius: 24px;
  transition: 0.3s;
}

.aepp-toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
}

.aepp-toggle input:checked + .aepp-toggle-slider {
  background: #e74c3c;
}

.aepp-toggle input:checked + .aepp-toggle-slider:before {
  transform: translateX(20px);
}

.aepp-toggle input:disabled + .aepp-toggle-slider {
  opacity: 0.7;
  cursor: not-allowed;
}

.aepp-badge-always {
  font-size: 11px;
  color: #27ae60;
  font-weight: 600;
  text-transform: uppercase;
}

/* ============================================================
   PULSANTI "X" (chiudi banner)
   ============================================================ */
.aepp-close-btn {
  position: absolute;
  top: 6px;
  right: 10px;
  background: transparent;
  border: none;
  color: #aaa;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s ease;
  z-index: 3;
}

.aepp-close-btn:hover {
  color: #fff;
}

/* ============================================================
   PULSANTE "GESTISCI COOKIE" — 2 VARIANTI
   - Variante A: dentro .chatbot-badge (index.html) → stile link testuale
   - Variante B: figlio diretto del body (pagine legali) → pill fisso a destra
   ============================================================ */

/* --- Variante A: dentro il badge del chatbot ---
   Stesso stile del testo "💬 Hai domande?" (14px, 600, niente sottolineatura) */
.chatbot-badge .aepp-cookie-link,
.chatbot-badge #aepp-reopen-btn {
  display: none;
  background: transparent;
  border: none;
  color: #667eea;          /* stesso colore di "Hai domande?" */
  font-size: 14px;         /* stessa grandezza di "Hai domande?" */
  font-weight: 600;        /* stesso peso di "Hai domande?" */
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  margin-top: 2px;
  text-decoration: none;   /* NIENTE sottolineatura */
  white-space: nowrap;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.chatbot-badge .aepp-cookie-link.aepp-visible,
.chatbot-badge #aepp-reopen-btn.aepp-visible {
  display: inline-block;
}

.chatbot-badge .aepp-cookie-link:hover,
.chatbot-badge #aepp-reopen-btn:hover {
  color: #764ba2;
}

/* Icona cookie davanti al testo (solo dentro il badge) */
.chatbot-badge #aepp-reopen-btn::before {
  content: "🍪 ";
}

/* --- Variante B: pulsante fisso nelle pagine legali (senza chatbot) --- */
body > #aepp-reopen-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  left: auto;
  z-index: 9990;
  background: white;
  color: #667eea;
  border: 1px solid #667eea;
  border-radius: 20px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: none;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.3s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

body > #aepp-reopen-btn::before {
  content: "🍪";
  font-size: 14px;
}

body > #aepp-reopen-btn:hover {
  background: #667eea;
  color: white;
}

body > #aepp-reopen-btn.aepp-visible {
  display: flex;
}

/* Nasconde "Gestisci cookie" quando la chat è aperta (solo in index.html) */
body:has(#chatbot-window.active) #aepp-reopen-btn,
body.chatbot-open #aepp-reopen-btn {
  display: none !important;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Mobile piccolo: banner con pulsanti in colonna */
@media (max-width: 600px) {
  .aepp-cookie-container {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  
  .aepp-cookie-buttons {
    justify-content: center;
  }
}

/* Mobile: "Gestisci cookie" nelle pagine legali più compatto */
@media (max-width: 480px) {
  body > #aepp-reopen-btn {
    bottom: 15px;
    right: 15px;
    padding: 6px 12px;
    font-size: 11px;
  }
}