/* ============================================
   COOKIE BANNER - GDPR Compliant
   ============================================ */

/* Overlay sfondo quando il banner è aperto */
.cookie-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  z-index: 9998;
  display: none;
  animation: fadeIn 0.3s ease;
}

.cookie-overlay.show {
  display: block;
}

/* Container principale del banner */
.cookie-banner {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(150%);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  padding: 24px 28px;
  max-width: 480px;
  width: calc(100% - 40px);
  z-index: 9999;
  transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.cookie-banner.show {
  transform: translateX(-50%) translateY(0);
}

/* Header del banner */
.cookie-banner-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.cookie-icon {
  font-size: 28px;
  line-height: 1;
}

.cookie-banner h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
}

/* Contenuto del banner */
.cookie-banner-content {
  margin-bottom: 20px;
}

.cookie-banner p {
  margin: 0 0 12px 0;
  font-size: 14px;
  line-height: 1.6;
  color: #4a4a4a;
}

.cookie-banner a {
  color: #fb1e1e;
  text-decoration: underline;
  font-weight: 500;
  transition: color 0.2s;
}

.cookie-banner a:hover {
  color: #d01515;
}

/* Opzioni cookie */
.cookie-options {
  margin: 16px 0;
  display: none;
}

.cookie-options.show {
  display: block;
  animation: slideDown 0.3s ease;
}

.cookie-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #efefef;
}

.cookie-option:last-child {
  border-bottom: none;
}

.cookie-option-info {
  flex: 1;
}

.cookie-option-title {
  font-weight: 600;
  font-size: 14px;
  color: #1a1a1a;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cookie-required {
  font-size: 11px;
  color: #888;
  font-weight: 400;
  background: #f5f5f5;
  padding: 2px 8px;
  border-radius: 4px;
}

.cookie-option-desc {
  font-size: 12px;
  color: #666;
  line-height: 1.4;
}

/* Toggle switch */
.cookie-toggle {
  position: relative;
  width: 48px;
  height: 26px;
}

.cookie-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 26px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.cookie-toggle input:checked + .toggle-slider {
  background-color: #fb1e1e;
}

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

.cookie-toggle input:disabled + .toggle-slider {
  background-color: #4caf50;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Pulsanti */
.cookie-banner-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.cookie-btn {
  flex: 1;
  min-width: 120px;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
}

.cookie-btn-primary {
  background: #fb1e1e;
  color: white;
}

.cookie-btn-primary:hover {
  background: #d01515;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(251, 30, 30, 0.3);
}

.cookie-btn-secondary {
  background: #f5f5f5;
  color: #333;
}

.cookie-btn-secondary:hover {
  background: #e0e0e0;
}

.cookie-btn-settings {
  flex-basis: 100%;
  background: transparent;
  color: #666;
  font-size: 13px;
  padding: 8px;
  text-decoration: underline;
}

.cookie-btn-settings:hover {
  color: #fb1e1e;
}

/* Bottone gestisci impostazioni (in footer) */
.cookie-settings-trigger {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: #ffffff;
  border: 2px solid #fb1e1e;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 9997;
  transition: all 0.3s;
  font-size: 24px;
}

.cookie-settings-trigger:hover {
  transform: scale(1.1) rotate(20deg);
  box-shadow: 0 6px 20px rgba(251, 30, 30, 0.3);
}

.cookie-settings-trigger.hidden {
  display: none;
}

/* Animazioni */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 500px;
  }
}

/* Responsive */
@media (max-width: 600px) {
  .cookie-banner {
    bottom: 0;
    left: 0;
    right: 0;
    transform: translateY(150%);
    border-radius: 16px 16px 0 0;
    max-width: 100%;
    width: 100%;
    padding: 20px;
  }

  .cookie-banner.show {
    transform: translateY(0);
  }

  .cookie-banner h3 {
    font-size: 18px;
  }

  .cookie-banner-actions {
    flex-direction: column;
  }

  .cookie-btn {
    width: 100%;
    min-width: auto;
  }

  .cookie-settings-trigger {
    width: 48px;
    height: 48px;
    font-size: 20px;
    bottom: 15px;
    left: 15px;
  }
}
