/* =========================================================
   NeroStay – Banner Cookie
   Layout mobile-first, 3 pulsanti con eguale enfasi visiva
   ========================================================= */

#cookie-banner {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

#cookie-banner .cb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 26, 0.4);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

#cookie-banner.cb-visible .cb-overlay {
  opacity: 1;
}

#cookie-banner .cb-banner {
  position: relative;
  width: 100%;
  max-width: 640px;
  background: #faf6ee;
  color: #2c2c2c;
  border-top: 3px solid #c9a96e;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -20px 60px -10px rgba(26, 26, 26, 0.25);
  transform: translateY(20px);
  opacity: 0;
  transition:
    transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.35s ease;
  pointer-events: auto;
  max-height: 90vh;
  overflow-y: auto;
}

@media (min-width: 768px) {
  #cookie-banner {
    align-items: center;
    padding: 24px;
  }
  #cookie-banner .cb-banner {
    border-radius: 24px;
    max-height: 85vh;
  }
}

#cookie-banner.cb-visible .cb-banner {
  transform: translateY(0);
  opacity: 1;
}

/* Contenuto */
.cb-content {
  padding: 24px 22px 22px;
  font-family: 'Inter', system-ui, sans-serif;
}

@media (min-width: 768px) {
  .cb-content { padding: 32px 36px 28px; }
}

.cb-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.cb-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

@media (min-width: 768px) {
  .cb-title { font-size: 1.85rem; }
}

.cb-body {
  font-size: 14px;
  line-height: 1.55;
  color: #4a4a4a;
  margin: 0 0 18px;
}

@media (min-width: 768px) {
  .cb-body { font-size: 15px; }
}

.cb-body a {
  color: #b08a4e;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cb-body a:hover {
  color: #1a1a1a;
}

/* Pannello preferenze (secondo livello) */
.cb-prefs {
  border: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cb-prefs[hidden] { display: none; }

.cb-cat {
  border: 1px solid rgba(217, 200, 163, 0.6);
  background: rgba(255, 255, 255, 0.5);
  border-radius: 14px;
  padding: 14px 16px;
  margin: 0;
}

.cb-cat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.cb-cat-row label[for] {
  cursor: pointer;
  flex: 1;
}

.cb-cat-name {
  font-size: 14.5px;
  font-weight: 500;
  color: #1a1a1a;
}

.cb-cat-tag {
  display: inline-block;
  margin-left: 8px;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #b08a4e;
  background: rgba(201, 169, 110, 0.12);
  padding: 2px 8px;
  border-radius: 999px;
}

.cb-cat-desc {
  font-size: 12.5px;
  line-height: 1.55;
  color: #6a6a6a;
  margin: 8px 0 0;
}

/* Toggle switch */
.cb-toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.cb-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.cb-toggle > span {
  position: absolute;
  inset: 0;
  background: #d9c8a3;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.25s ease;
}

.cb-toggle > span::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #faf6ee;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cb-toggle input:checked + span {
  background: #b08a4e;
}

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

.cb-toggle input:focus-visible + span {
  outline: 2px solid #c9a96e;
  outline-offset: 2px;
}

.cb-toggle--locked {
  opacity: 0.6;
  pointer-events: none;
}

.cb-toggle--locked > span {
  background: #b08a4e;
}

.cb-toggle--locked > span::before {
  transform: translateX(18px);
}

/* Azioni: 3 pulsanti EGUALI in enfasi visiva (Garante 2021) */
.cb-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 640px) {
  .cb-actions {
    flex-direction: row;
  }
}

.cb-actions[hidden] { display: none; }

.cb-btn {
  flex: 1;
  appearance: none;
  border: 1px solid #1a1a1a;
  background: #1a1a1a;
  color: #faf6ee;
  font-family: 'Inter', sans-serif;
  font-size: 14.5px;
  font-weight: 500;
  padding: 13px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition:
    background-color 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease,
    transform 0.15s ease;
  text-align: center;
  letter-spacing: 0.005em;
}

.cb-btn:hover {
  background: #2c2c2c;
  border-color: #2c2c2c;
}

.cb-btn:active {
  transform: scale(0.98);
}

.cb-btn:focus-visible {
  outline: 2px solid #c9a96e;
  outline-offset: 3px;
}

.cb-btn--secondary {
  background: transparent;
  color: #1a1a1a;
  border-color: rgba(26, 26, 26, 0.3);
}

.cb-btn--secondary:hover {
  background: rgba(26, 26, 26, 0.05);
  border-color: #1a1a1a;
  color: #1a1a1a;
}

/* Riduzione movimento */
@media (prefers-reduced-motion: reduce) {
  #cookie-banner .cb-banner,
  #cookie-banner .cb-overlay,
  .cb-toggle > span,
  .cb-toggle > span::before,
  .cb-btn {
    transition: none !important;
  }
}
