/* Cookie Consent — banner sticky-bottom + modal preferenze.
   Design neutro: blu primary, grigio secondary, bianco background.
   Adattare colori al brand modificando le costanti --cc-* in :root. */

:root {
  --cc-primary: #2563eb;
  --cc-primary-hover: #1d4ed8;
  --cc-secondary-bg: #f3f4f6;
  --cc-secondary-hover: #e5e7eb;
  --cc-text: #1a2030;
  --cc-text-muted: #4a5568;
  --cc-text-soft: #6b7280;
  --cc-border: #e5e7eb;
  --cc-border-soft: #f3f4f6;
  --cc-bg: #ffffff;
}

/* === Banner sticky in basso === */

#cc-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--cc-bg);
  border-top: 1px solid var(--cc-border);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  z-index: 9998;
  transform: translateY(100%);
  transition: transform .35s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

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

.cc-banner-text {
  flex: 1 1 360px;
  min-width: 0;
}

.cc-banner-text strong {
  display: block;
  font-size: 16px;
  margin-bottom: 6px;
  color: var(--cc-text);
}

.cc-banner-text p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--cc-text-muted);
}

.cc-link {
  color: var(--cc-primary);
  text-decoration: underline;
}

.cc-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* === Bottoni === */

.cc-btn {
  appearance: none;
  border: 0;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s ease, transform .1s ease;
  font-family: inherit;
}

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

.cc-btn-primary {
  background: var(--cc-primary);
  color: #fff;
}
.cc-btn-primary:hover {
  background: var(--cc-primary-hover);
}

.cc-btn-secondary {
  background: var(--cc-secondary-bg);
  color: var(--cc-text);
}
.cc-btn-secondary:hover {
  background: var(--cc-secondary-hover);
}

/* === Overlay + Modal === */

.cc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

.cc-overlay.cc-visible {
  opacity: 1;
  pointer-events: auto;
}

.cc-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.95);
  width: min(640px, 92vw);
  max-height: 86vh;
  background: var(--cc-bg);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}

.cc-modal.cc-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.cc-modal-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.cc-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--cc-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cc-modal-header h2 {
  margin: 0;
  font-size: 18px;
  color: var(--cc-text);
}

.cc-modal-close {
  background: none;
  border: 0;
  font-size: 28px;
  line-height: 1;
  color: var(--cc-text-soft);
  cursor: pointer;
  padding: 0 4px;
}

.cc-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.cc-modal-intro {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--cc-text-muted);
  line-height: 1.5;
}

/* === Categorie === */

.cc-category {
  padding: 14px 0;
  border-bottom: 1px solid var(--cc-border-soft);
}

.cc-category:last-child {
  border-bottom: 0;
}

.cc-category-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.cc-category-info {
  flex: 1;
  min-width: 0;
}

.cc-category-info strong {
  display: inline-block;
  font-size: 15px;
  color: var(--cc-text);
  margin-right: 8px;
}

.cc-required-badge {
  display: inline-block;
  background: var(--cc-secondary-bg);
  color: var(--cc-text-soft);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  vertical-align: middle;
}

.cc-category-desc {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--cc-text-soft);
  line-height: 1.5;
}

/* === Toggle switch === */

.cc-toggle {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}

.cc-toggle input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.cc-toggle input:disabled {
  cursor: not-allowed;
}

.cc-toggle-slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 12px;
  transition: background .2s ease;
}

.cc-toggle-slider::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.cc-toggle input:checked + .cc-toggle-slider {
  background: var(--cc-primary);
}

.cc-toggle input:checked + .cc-toggle-slider::before {
  transform: translateX(18px);
}

.cc-toggle input:disabled + .cc-toggle-slider {
  opacity: .6;
}

.cc-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--cc-border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

body.cc-modal-open {
  overflow: hidden;
}

/* === Mobile === */

@media (max-width: 640px) {
  .cc-banner-inner {
    padding: 16px;
    gap: 14px;
  }

  .cc-banner-actions {
    width: 100%;
  }

  .cc-banner-actions .cc-btn {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
  }

  .cc-modal-footer {
    justify-content: stretch;
  }

  .cc-modal-footer .cc-btn {
    flex: 1;
  }
}
