/* =====================================================================
   cogito ergo crypto — Cookie Consent — stili
   Banner + preferenze con blocco reale pre-consenso (logica in cookie-consent.js).
   Palette del sito (oro/bronzo/nero). Prefisso cs-cc- per evitare collisioni.
   ===================================================================== */

:root {
  --cs-primary: #9C7A22;      /* oro (azioni principali) */
  --cs-primary-dark: #866619; /* oro scuro (hover) */
  --cs-accent: #8A5A32;       /* bronzo (focus/accento) */
  --cs-text: #3B362B;
  --cs-muted: #7C7360;
  --cs-border: #E9E1CF;
  --cs-bg: #F7F3E9;
  --cs-white: #FFFFFF;
  --cs-ink: #171410;
}

.cs-cc-root { position: relative; z-index: 2147483000; }
.cs-cc-root *,
.cs-cc-root *::before,
.cs-cc-root *::after { box-sizing: border-box; }

/* ---------- Banner (livello 1) ---------- */
.cs-cc-banner-wrap {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(23, 20, 16, 0.5);
  backdrop-filter: blur(3px);
  padding: 16px;
  animation: cs-fade 0.2s ease;
}

.cs-cc-banner {
  position: relative;
  width: 100%;
  max-width: 1040px;
  background: var(--cs-white);
  border: 1px solid var(--cs-border);
  border-radius: 20px;
  padding: 30px 34px 26px;
  box-shadow: 0 24px 60px rgba(23, 20, 16, 0.3);
  font-family: var(--font-body);
  color: var(--cs-text);
}

.cs-cc-continue {
  position: absolute;
  top: 14px;
  right: 22px;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 13px;
  color: var(--cs-primary);
  text-decoration: underline;
  cursor: pointer;
}
.cs-cc-continue:hover { color: var(--cs-primary-dark); }

/* Logo (cubo + wordmark) */
.cs-cc-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 4px 0 18px;
}
.cs-cc-logo-img {
  height: 46px; width: auto;
  filter: drop-shadow(0 4px 10px rgba(191, 138, 24, 0.35));
}
.cs-cc-logo-txt {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--cs-ink);
}
.cs-cc-logo-txt b {
  font-weight: 800;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.cs-cc-text {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--cs-muted);
  text-align: left;
}
.cs-cc-text a,
.cs-cc-modal-intro a {
  color: var(--cs-primary);
  font-weight: 700;
  text-decoration: none;
}
.cs-cc-text a:hover,
.cs-cc-modal-intro a:hover { color: var(--cs-accent); text-decoration: underline; }

.cs-cc-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

/* ---------- Pulsanti ---------- */
.cs-cc-btn {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 100px;
  padding: 12px 24px;
  border: 1.5px solid transparent;
  transition: background 0.16s ease, color 0.16s ease, transform 0.12s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.cs-cc-btn:active { transform: translateY(1px); }

.cs-cc-btn-primary {
  background: var(--cs-primary);
  color: var(--cs-white);
  border-color: var(--cs-primary);
  box-shadow: 0 8px 20px rgba(156, 122, 34, 0.28);
}
.cs-cc-btn-primary:hover {
  background: var(--cs-primary-dark);
  border-color: var(--cs-primary-dark);
  transform: translateY(-2px);
}

.cs-cc-btn-link {
  background: none;
  color: var(--cs-primary);
  border: none;
  text-decoration: underline;
  padding: 12px 10px;
  box-shadow: none;
}
.cs-cc-btn-link:hover { color: var(--cs-primary-dark); }

/* ---------- Modale preferenze (livello 2) ---------- */
.cs-cc-modal-wrap {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(23, 20, 16, 0.55);
  backdrop-filter: blur(3px);
  padding: 16px;
  z-index: 2147483001;
  animation: cs-fade 0.2s ease;
}

.cs-cc-modal {
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  background: var(--cs-white);
  border-radius: 24px;
  box-shadow: 0 24px 70px rgba(23, 20, 16, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-body);
  color: var(--cs-text);
}

.cs-cc-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 22px 8px;
  flex: 0 0 auto;
}
.cs-cc-logo-sm { margin: 0; justify-content: flex-start; }
.cs-cc-logo-sm .cs-cc-logo-img { height: 36px; }
.cs-cc-logo-sm .cs-cc-logo-txt { font-size: 1.05rem; }

.cs-cc-close {
  width: 40px;
  height: 40px;
  border: 1px solid var(--cs-border);
  background: var(--cs-white);
  border-radius: 12px;
  font-size: 24px;
  line-height: 1;
  color: var(--cs-text);
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
}
.cs-cc-close:hover { background: var(--cs-bg); border-color: var(--cs-primary); }

.cs-cc-modal-scroll {
  overflow-y: auto;
  padding: 4px 26px 8px;
  flex: 1 1 auto;
}

.cs-cc-modal-title {
  margin: 8px 0 12px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--cs-ink);
}

.cs-cc-modal-intro {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--cs-muted);
}

.cs-cc-allow-all { display: inline-block; margin: 0 0 22px; }

.cs-cc-manage {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--cs-ink);
}

/* ---------- Categoria (accordion) ---------- */
.cs-cc-cat { border-bottom: 1px solid var(--cs-border); }
.cs-cc-cat:first-of-type { border-top: 1px solid var(--cs-border); }

.cs-cc-cat-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: none;
  border: none;
  padding: 16px 2px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.cs-cc-cat-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--cs-ink);
  display: flex;
  align-items: center;
  gap: 10px;
}
.cs-cc-caret {
  display: inline-block;
  width: 16px; height: 16px;
  line-height: 16px;
  text-align: center;
  color: var(--cs-white);
  background: var(--cs-primary);
  border-radius: 5px;
  font-weight: 700;
  font-size: 13px;
}

.cs-cc-always {
  font-size: 12px;
  font-weight: 700;
  color: var(--cs-primary);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cs-cc-cat-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.cs-cc-cat.cs-open .cs-cc-cat-body { max-height: 640px; }
.cs-cc-cat-body p {
  margin: 0;
  padding: 0 2px 18px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--cs-muted);
}

/* ---------- Toggle switch ---------- */
.cs-cc-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
  flex: 0 0 auto;
}
.cs-cc-switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}
.cs-cc-slider {
  position: absolute;
  inset: 0;
  background: #d8d0bf;
  border-radius: 24px;
  transition: background 0.2s ease;
}
.cs-cc-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  background: var(--cs-white);
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.cs-cc-switch input:checked + .cs-cc-slider { background: var(--cs-primary); }
.cs-cc-switch input:checked + .cs-cc-slider::before { transform: translateX(22px); }
.cs-cc-switch input:focus-visible + .cs-cc-slider {
  outline: 2px solid var(--cs-accent);
  outline-offset: 2px;
}

/* ---------- Footer modale ---------- */
.cs-cc-modal-footer {
  flex: 0 0 auto;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 16px 22px;
  border-top: 1px solid var(--cs-border);
  background: var(--cs-bg);
}
.cs-cc-modal-footer .cs-cc-btn { flex: 0 1 auto; }

/* ---------- Focus visibile (accessibilità) ---------- */
.cs-cc-root button:focus-visible,
.cs-cc-root a:focus-visible {
  outline: 2px solid var(--cs-accent);
  outline-offset: 2px;
}

@keyframes cs-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .cs-cc-banner-wrap, .cs-cc-modal-wrap, .cs-cc-cat-body,
  .cs-cc-slider, .cs-cc-slider::before, .cs-cc-btn { animation: none; transition: none; }
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .cs-cc-banner { padding: 46px 20px 22px; border-radius: 18px; }
  .cs-cc-continue { top: 16px; right: 16px; }
  .cs-cc-logo-txt { font-size: 1.1rem; }
  .cs-cc-actions { flex-direction: column; gap: 10px; }
  .cs-cc-actions .cs-cc-btn { width: 100%; }
  .cs-cc-modal-footer { flex-direction: column; }
  .cs-cc-modal-footer .cs-cc-btn { width: 100%; }
}
