/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   TEMPO EVENT · COOKIE BANNER GDPR (nativo, zero dipendenze)
   Brand: Forest Green #1E723B + Cream + Gold · Font: Manrope/Lato
   Conforme: Garante Provv. 231/2021 + EDPB dark patterns + Consent Mode v2
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.tecb-hidden { display: none !important; }

/* ───────── Overlay ───────── */
.tecb-overlay {
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: rgba(8, 47, 24, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: tecbFadeIn 240ms ease-out;
}
@keyframes tecbFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ───────── Card ───────── */
.tecb-card {
  width: 100%;
  max-width: 760px;
  max-height: min(86vh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--cream-50, #FDFCF7);
  border: 1px solid var(--forest-200, #B3D6BC);
  border-top: 4px solid var(--forest-600, #1E723B);
  border-radius: var(--r-xl, 1.5rem);
  box-shadow: 0 24px 80px rgba(15, 70, 35, 0.28);
  font-family: var(--font-body, "Lato", system-ui, sans-serif);
  color: var(--stone-800, #252220);
  overflow: hidden;
  animation: tecbSlideUp 320ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes tecbSlideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ───────── Header ───────── */
.tecb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--stone-100, #EDE9E2);
}
.tecb-header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tecb-header__brand img {
  height: 28px;
  width: auto;
  display: block;
}
.tecb-header__title {
  font-family: var(--font-display, "Manrope", system-ui, sans-serif);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--forest-700, #175C2F);
}
.tecb-close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--stone-200, #D6D0C5);
  border-radius: 50%;
  color: var(--stone-600, #4D4940);
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}
.tecb-close:hover,
.tecb-close:focus-visible {
  background: var(--stone-100, #EDE9E2);
  color: var(--stone-900, #161412);
}
.tecb-close:focus-visible,
.tecb-tab:focus-visible,
.tecb-btn:focus-visible,
.tecb-switch input:focus-visible + .tecb-switch__track,
.tecb-cat__head:focus-visible,
.tecb-link:focus-visible,
.tecb-widget:focus-visible {
  outline: 3px solid var(--forest-400, #4D9968);
  outline-offset: 2px;
}

/* ───────── Tabs ───────── */
.tecb-tabs {
  display: flex;
  gap: 2px;
  padding: 0 24px;
  border-bottom: 1px solid var(--stone-100, #EDE9E2);
  background: var(--cream-100, #FAF7F0);
}
.tecb-tab {
  appearance: none;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 12px 14px;
  font-family: var(--font-display, "Manrope", system-ui, sans-serif);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--stone-500, #6B6557);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
  white-space: nowrap;
}
.tecb-tab:hover { color: var(--forest-700, #175C2F); }
.tecb-tab[aria-selected="true"] {
  color: var(--forest-700, #175C2F);
  border-bottom-color: var(--forest-600, #1E723B);
}

/* ───────── Body ───────── */
.tecb-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 20px 24px;
  -webkit-overflow-scrolling: touch;
}
.tecb-body p {
  font-size: 0.9375rem;
  line-height: 1.6;
  margin: 0 0 12px;
}
.tecb-body p:last-child { margin-bottom: 0; }
.tecb-link {
  color: var(--forest-600, #1E723B);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.tecb-link:hover { color: var(--forest-800, #0F4623); }

/* ───────── Categorie (tab Dettagli) ───────── */
.tecb-cat {
  border: 1px solid var(--stone-100, #EDE9E2);
  border-radius: var(--r-md, 0.75rem);
  margin-bottom: 10px;
  background: #fff;
}
.tecb-cat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.tecb-cat__name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display, "Manrope", system-ui, sans-serif);
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--stone-800, #252220);
}
.tecb-cat__chevron {
  transition: transform 200ms ease;
  color: var(--stone-400, #8E8678);
  flex: 0 0 auto;
}
.tecb-cat[data-open="true"] .tecb-cat__chevron { transform: rotate(180deg); }
.tecb-cat__count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--stone-500, #6B6557);
  background: var(--stone-100, #EDE9E2);
  border-radius: 999px;
  padding: 2px 8px;
}
.tecb-cat__always {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--forest-600, #1E723B);
  white-space: nowrap;
}
.tecb-cat__panel {
  padding: 0 16px 14px;
  border-top: 1px dashed var(--stone-100, #EDE9E2);
}
.tecb-cat__desc {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--stone-600, #4D4940);
  margin: 12px 0;
}
.tecb-cookie-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.tecb-cookie-table th,
.tecb-cookie-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--stone-100, #EDE9E2);
  vertical-align: top;
}
.tecb-cookie-table th {
  font-family: var(--font-display, "Manrope", system-ui, sans-serif);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--stone-500, #6B6557);
}
.tecb-cookie-table tr:last-child td { border-bottom: none; }
.tecb-cookie-table code {
  font-size: 0.75rem;
  background: var(--cream-200, #F4EFE2);
  border-radius: 4px;
  padding: 1px 5px;
}

/* ───────── Toggle switch ───────── */
.tecb-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  cursor: pointer;
}
.tecb-switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.tecb-switch__track {
  display: block;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: var(--stone-200, #D6D0C5);
  transition: background 180ms ease;
  position: relative;
}
.tecb-switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 180ms ease;
}
.tecb-switch input:checked + .tecb-switch__track {
  background: var(--forest-600, #1E723B);
}
.tecb-switch input:checked + .tecb-switch__track::after {
  transform: translateX(20px);
}
.tecb-switch input:disabled + .tecb-switch__track {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ───────── Footer: 3 CTA con pari evidenza (EDPB) ───────── */
.tecb-footer {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--stone-100, #EDE9E2);
  background: var(--cream-100, #FAF7F0);
}
/* Stesso identico stile per i 3 bottoni: nessuna gerarchia visiva */
.tecb-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 14px;
  background: #fff;
  border: 2px solid var(--forest-600, #1E723B);
  border-radius: var(--r-full, 9999px);
  font-family: var(--font-display, "Manrope", system-ui, sans-serif);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--forest-700, #175C2F);
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
  text-align: center;
}
.tecb-btn:hover {
  background: var(--forest-600, #1E723B);
  color: var(--cream-50, #FDFCF7);
  transform: translateY(-1px);
}
.tecb-btn:active { transform: translateY(0); }

/* ───────── Meta footer (link policy) ───────── */
.tecb-meta {
  padding: 0 24px 16px;
  background: var(--cream-100, #FAF7F0);
  font-size: 0.75rem;
  color: var(--stone-500, #6B6557);
  text-align: center;
}
.tecb-meta a {
  color: var(--forest-600, #1E723B);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ───────── Widget persistente bottom-left ───────── */
.tecb-widget {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 99980;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--forest-600, #1E723B);
  color: var(--cream-50, #FDFCF7);
  border: 2px solid var(--cream-50, #FDFCF7);
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(15, 70, 35, 0.30);
  cursor: pointer;
  transition: transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1), background 160ms ease;
}
.tecb-widget:hover {
  transform: scale(1.08);
  background: var(--forest-700, #175C2F);
}

/* ───────── Stato consenso (tab Informazioni) ───────── */
.tecb-state {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
}
.tecb-state__item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  background: #fff;
  border: 1px solid var(--stone-100, #EDE9E2);
  border-radius: var(--r-sm, 0.5rem);
  padding: 8px 10px;
}
.tecb-state__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.tecb-state__dot--on { background: var(--success, #3B8A4F); }
.tecb-state__dot--off { background: var(--error, #C44848); }
.tecb-consent-id {
  font-size: 0.6875rem;
  color: var(--stone-400, #8E8678);
  word-break: break-all;
  margin-top: 10px;
}

/* ───────── Mobile ───────── */
@media (max-width: 640px) {
  .tecb-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .tecb-card {
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--r-xl, 1.5rem) var(--r-xl, 1.5rem) 0 0;
  }
  .tecb-tabs {
    overflow-x: auto;
    padding: 0 16px;
  }
  .tecb-header { padding: 14px 16px 12px; }
  .tecb-body { padding: 16px; }
  .tecb-footer {
    grid-template-columns: 1fr;
    padding: 12px 16px 16px;
  }
  .tecb-state { grid-template-columns: 1fr; }
  .tecb-widget {
    width: 44px;
    height: 44px;
    left: 12px;
    bottom: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tecb-overlay,
  .tecb-card {
    animation: none;
  }
}
