/* ============================================================
   BLUGARAGE COOKIE BANNER — Stile ispirato a IVAC Grafica
   Conforme GDPR + Provv. Garante italiano 10/06/2021
   Design: panel bianco in basso, compatto, pulsanti inline
   Colore brand: #227FFB  |  Font: Inter / Outfit
   ============================================================ */

:root {
  --bcb-primary:        #227FFB;
  --bcb-primary-dark:   #1668E3;
  --bcb-primary-rgb:    34, 127, 251;
  --bcb-bg-banner:      #ffffff;
  --bcb-bg-modal:       #ffffff;
  --bcb-bg-header:      #f7f9ff;
  --bcb-bg-footer:      #f7f9ff;
  --bcb-bg-category:    #f7f9ff;
  --bcb-text-dark:      #1a202c;
  --bcb-text-body:      #4a5568;
  --bcb-text-muted:     #718096;
  --bcb-border:         #e2e8f0;
  --bcb-border-focus:   #227FFB;
  --bcb-shadow:         0 -4px 24px rgba(0,0,0,0.10), 0 -1px 6px rgba(0,0,0,0.06);
  --bcb-shadow-modal:   0 20px 60px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08);
  --bcb-radius:         12px;
  --bcb-radius-sm:      8px;
  --bcb-radius-xs:      6px;
  --bcb-transition:     0.2s ease;
  --bcb-z-banner:       99990;
  --bcb-z-overlay:      99980;
  --bcb-z-modal:        99995;
  --bcb-font:           'Inter', 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Overlay scuro dietro il modal ──────────────────────── */
.blugarage-cookie-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: var(--bcb-z-overlay);
}
.blugarage-cookie-overlay.bcb-visible {
  display: block;
  animation: bcbFade .2s ease forwards;
}

/* ═══════════════════════════════════════════════════════════
   BANNER PRINCIPALE — barra compatta in basso
   ═══════════════════════════════════════════════════════════ */
.blugarage-cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--bcb-z-banner);
  background: var(--bcb-bg-banner);
  border-top: 3px solid var(--bcb-primary);
  box-shadow: var(--bcb-shadow);
  font-family: var(--bcb-font);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
}
.blugarage-cookie-banner.bcb-visible {
  transform: translateY(0);
}

.bcb-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* ── Icona cookie ───────────────────────────────────────── */
.bcb-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: rgba(var(--bcb-primary-rgb), 0.08);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bcb-primary);
}

/* ── Testo ──────────────────────────────────────────────── */
.bcb-text {
  flex: 1;
  min-width: 200px;
}
.bcb-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--bcb-text-dark);
  margin-bottom: 3px;
  line-height: 1.3;
}
.bcb-description {
  font-size: 12.5px;
  color: var(--bcb-text-body);
  line-height: 1.55;
}
.bcb-link {
  color: var(--bcb-primary);
  text-decoration: none;
  font-weight: 500;
}
.bcb-link:hover {
  text-decoration: underline;
}

/* ── Pulsanti banner ────────────────────────────────────── */
.bcb-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* Base pulsante */
.bcb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  font-family: var(--bcb-font);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--bcb-radius-xs);
  border: 1.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--bcb-transition);
  text-decoration: none;
  line-height: 1;
}
.bcb-btn:focus-visible {
  outline: 2px solid var(--bcb-primary);
  outline-offset: 2px;
}

/* Accetta tutti → pieno blu */
.bcb-btn--primary {
  background: var(--bcb-primary);
  color: #fff;
  border-color: var(--bcb-primary);
}
.bcb-btn--primary:hover {
  background: var(--bcb-primary-dark);
  border-color: var(--bcb-primary-dark);
}

/* Preferenze → bordo blu, sfondo trasparente */
.bcb-btn--outline {
  background: transparent;
  color: var(--bcb-primary);
  border-color: var(--bcb-primary);
}
.bcb-btn--outline:hover {
  background: rgba(var(--bcb-primary-rgb), 0.06);
}

/* Continua senza accettare → solo testo, grigio */
.bcb-btn--ghost {
  background: transparent;
  color: var(--bcb-text-muted);
  border-color: transparent;
  font-size: 12px;
  font-weight: 500;
  padding: 9px 10px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.bcb-btn--ghost:hover {
  color: var(--bcb-text-dark);
}

/* Secondario (nel modal) */
.bcb-btn--secondary {
  background: transparent;
  color: var(--bcb-primary);
  border-color: rgba(var(--bcb-primary-rgb), 0.4);
}
.bcb-btn--secondary:hover {
  background: rgba(var(--bcb-primary-rgb), 0.06);
  border-color: var(--bcb-primary);
}

/* ═══════════════════════════════════════════════════════════
   MODAL PREFERENZE — card centrata con overlay
   ═══════════════════════════════════════════════════════════ */
.bcb-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--bcb-z-modal);
  align-items: center;
  justify-content: center;
  padding: 20px;
  font-family: var(--bcb-font);
}
.bcb-modal.bcb-visible {
  display: flex;
}

.bcb-modal-box {
  background: var(--bcb-bg-modal);
  border-radius: var(--bcb-radius);
  box-shadow: var(--bcb-shadow-modal);
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: bcbSlideUp .25s cubic-bezier(0.4,0,0.2,1) forwards;
  border: 1px solid var(--bcb-border);
}

/* Animazioni */
@keyframes bcbSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes bcbFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Header modal */
.bcb-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  background: var(--bcb-bg-header);
  border-bottom: 1px solid var(--bcb-border);
  flex-shrink: 0;
}
.bcb-modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--bcb-text-dark);
}
.bcb-modal-title svg {
  color: var(--bcb-primary);
  flex-shrink: 0;
}
.bcb-modal-close {
  background: none;
  border: 1px solid var(--bcb-border);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--bcb-text-muted);
  transition: all var(--bcb-transition);
  flex-shrink: 0;
}
.bcb-modal-close:hover {
  background: var(--bcb-border);
  color: var(--bcb-text-dark);
}
.bcb-modal-close:focus-visible {
  outline: 2px solid var(--bcb-primary);
  outline-offset: 2px;
}

/* Body modal */
.bcb-modal-body {
  overflow-y: auto;
  padding: 20px 22px;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e0 transparent;
}
.bcb-modal-body::-webkit-scrollbar { width: 4px; }
.bcb-modal-body::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 4px; }

.bcb-modal-intro {
  font-size: 12.5px;
  color: var(--bcb-text-body);
  line-height: 1.7;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--bcb-border);
}

/* ── Categorie cookie ───────────────────────────────────── */
.bcb-category {
  border: 1px solid var(--bcb-border);
  border-radius: var(--bcb-radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color var(--bcb-transition), box-shadow var(--bcb-transition);
}
.bcb-category:last-child { margin-bottom: 0; }
.bcb-category:hover { border-color: rgba(var(--bcb-primary-rgb), 0.35); }
.bcb-category--locked {
  background: rgba(var(--bcb-primary-rgb), 0.03);
  border-color: rgba(var(--bcb-primary-rgb), 0.2);
}

.bcb-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  gap: 10px;
}
.bcb-category-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.bcb-category-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--bcb-text-dark);
}

.bcb-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.bcb-badge--always {
  background: rgba(var(--bcb-primary-rgb), 0.1);
  color: var(--bcb-primary);
}

.bcb-category-desc {
  font-size: 12px;
  color: var(--bcb-text-muted);
  line-height: 1.65;
  padding: 0 14px 12px;
}

/* ── Toggle switch ──────────────────────────────────────── */
.bcb-toggle-wrapper { flex-shrink: 0; position: relative; }

.bcb-toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.bcb-toggle-label {
  display: block;
  width: 42px;
  height: 23px;
  background: #d1d5db;
  border-radius: 100px;
  cursor: pointer;
  position: relative;
  transition: background var(--bcb-transition);
}
.bcb-toggle-label::after {
  content: '';
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform var(--bcb-transition);
}
.bcb-toggle-input:checked + .bcb-toggle-label {
  background: var(--bcb-primary);
}
.bcb-toggle-input:checked + .bcb-toggle-label::after {
  transform: translateX(19px);
}
.bcb-toggle-input:focus-visible + .bcb-toggle-label {
  outline: 2px solid var(--bcb-primary);
  outline-offset: 2px;
}
.bcb-toggle-label--locked {
  cursor: not-allowed;
  opacity: 0.65;
}

/* ── Footer modal ───────────────────────────────────────── */
.bcb-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px;
  background: var(--bcb-bg-footer);
  border-top: 1px solid var(--bcb-border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 760px) {
  .bcb-inner {
    padding: 14px 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .bcb-icon { display: none; }
  .bcb-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .bcb-actions .bcb-btn {
    width: 100%;
    justify-content: center;
  }
  #bcb-btn-accept-all { order: 1; }
  #bcb-btn-preferences { order: 2; }
  #bcb-btn-reject { order: 3; }

  .bcb-modal { padding: 12px; }
  .bcb-modal-box { max-height: 92vh; border-radius: var(--bcb-radius-sm); }
  .bcb-modal-header { padding: 14px 16px; }
  .bcb-modal-body { padding: 14px 16px; }
  .bcb-modal-footer {
    flex-direction: column;
    padding: 12px 16px;
  }
  .bcb-modal-footer .bcb-btn {
    width: 100%;
    justify-content: center;
  }
  #bcb-modal-accept-all { order: 1; }
  #bcb-modal-save { order: 2; }
  #bcb-modal-reject { order: 3; }
}
