/* =============================================================================
   Cookie Consent — Stili
   Versione: 1.0
   Compatibilità: tutti i browser moderni
   ============================================================================= */

/* ─── Reset base ─────────────────────────────────────────────────────────── */
#cc-banner *,
#cc-overlay * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: inherit;
}

/* ─── Banner (barra fissa in basso, full-width) ─────────────────────────── */
#cc-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99998;
  background: #ffffff;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.10);
  transform: translateY(110%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#cc-banner.cc-visible {
  transform: translateY(0);
}

#cc-banner .cc-banner-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 40px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cc-banner-top {
  text-align: center;
}

.cc-banner-title {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.01em;
}

.cc-banner-text {
  font-size: 13.5px;
  line-height: 1.65;
  color: #4b5563;
  text-align: center;
}

.cc-banner-text strong {
  color: #111827;
}

.cc-banner-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  padding-top: 4px;
}

/* Forza "Personalizza" a sinistra, "Accetto" a destra */
.cc-banner-actions #cc-open-modal {
  margin-right: auto;
}

/* ─── Pulsanti ───────────────────────────────────────────────────────────── */
#cc-banner .cc-btn,
#cc-overlay .cc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding: 0 52px;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-decoration: none;
  box-sizing: border-box;
}

.cc-btn svg {
  flex-shrink: 0;
}

.cc-btn:active {
  transform: scale(0.97);
}

/* Accetto — azzurro pieno */
.cc-btn-primary {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

.cc-btn-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

/* Personalizza — bianco con bordo scuro */
.cc-btn-outline {
  background: #ffffff;
  color: #1f2937;
  border-color: #6b7280;
}

.cc-btn-outline:hover {
  border-color: #374151;
  background: #f9fafb;
}

/* Rifiuta tutto — grigio neutro (solo nel modale) */
.cc-btn-reject {
  background: #ffffff;
  color: #6b7280;
  border-color: #d1d5db;
}

.cc-btn-reject:hover {
  background: #f9fafb;
  border-color: #9ca3af;
  color: #374151;
}

/* ─── Overlay modale ─────────────────────────────────────────────────────── */
#cc-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.50);
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#cc-overlay.cc-visible {
  display: flex;
}

/* ─── Modale ─────────────────────────────────────────────────────────────── */
#cc-modal {
  background: #ffffff;
  border-radius: 12px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
}

.cc-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 18px;
  border-bottom: 1px solid #e5e7eb;
}

.cc-modal-head h2 {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  letter-spacing: -0.01em;
}

.cc-close-btn {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #9ca3af;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.cc-close-btn:hover {
  color: #111827;
  background: #f3f4f6;
}

.cc-modal-body {
  padding: 20px 24px;
}

.cc-modal-body > p {
  font-size: 13.5px;
  color: #6b7280;
  line-height: 1.55;
  margin-bottom: 8px;
}

/* ─── Righe categorie cookie ─────────────────────────────────────────────── */
.cc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid #f3f4f6;
}

.cc-row-info {
  flex: 1;
}

.cc-row-info strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 3px;
}

.cc-row-info span {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.45;
}

.cc-always-on {
  font-size: 12px;
  font-weight: 600;
  color: #16a34a;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── Toggle switch ──────────────────────────────────────────────────────── */
.cc-switch {
  flex-shrink: 0;
  cursor: pointer;
  display: inline-block;
}

.cc-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.cc-track {
  display: flex;
  align-items: center;
  width: 46px;
  height: 26px;
  background: #d1d5db;
  border-radius: 13px;
  padding: 3px;
  transition: background 0.22s ease;
}

.cc-switch input:checked + .cc-track {
  background: #2563eb;
}

.cc-thumb {
  width: 20px;
  height: 20px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
  transition: transform 0.22s ease;
  flex-shrink: 0;
}

.cc-switch input:checked + .cc-track .cc-thumb {
  transform: translateX(20px);
}

/* Focus visibile per accessibilità */
.cc-switch input:focus-visible + .cc-track {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* ─── Footer modale ──────────────────────────────────────────────────────── */
.cc-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  flex-wrap: wrap;
}

.cc-modal-foot-right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ─── Responsive mobile ──────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .cc-banner-inner {
    padding: 20px 20px 18px;
  }

  .cc-banner-title {
    font-size: 17px;
  }

  .cc-banner-actions {
    flex-direction: column;
    gap: 10px;
  }

  .cc-banner-actions #cc-open-modal {
    margin-right: 0;
  }

  .cc-btn {
    width: 100%;
    justify-content: center;
  }

  .cc-modal-foot {
    flex-direction: column;
    align-items: stretch;
  }

  .cc-modal-foot-right {
    flex-direction: column;
  }

  .cc-modal-foot .cc-btn {
    width: 100%;
  }
}
