/* ══════════════════════════════════════════════════════
   cookie-banner.css — algo-freedom society
   Banner di consenso cookie GDPR (banner + modale preferenze)
   ══════════════════════════════════════════════════════ */

/* ─── Banner principale (bottom-fixed) ─────────────────── */
.afs-cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 9998;
  max-width: 1100px;
  margin: 0 auto;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  color: var(--text, #0f172a);
  border: 1px solid var(--border, rgba(15, 23, 42, .12));
  border-radius: var(--radius, 12px);
  box-shadow: 0 18px 40px rgba(15, 23, 42, .25);
  padding: 18px 22px;
  display: none;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
.afs-cookie-banner.is-visible { display: block; }

.afs-cookie-banner__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
}
.afs-cookie-banner__text {
  flex: 1 1 320px;
  min-width: 260px;
  font-size: .92rem;
  line-height: 1.5;
  color: #334155;
}
.afs-cookie-banner__text strong {
  display: block;
  font-size: 1rem;
  color: #1f3550;
  margin-bottom: 4px;
}
.afs-cookie-banner__text a {
  color: #2f5f86;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.afs-cookie-banner__text a:hover { color: #1f3550; }

.afs-cookie-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* ─── Pulsanti banner ──────────────────────────────────── */
.afs-cookie-btn {
  font: inherit;
  font-weight: 600;
  font-size: .88rem;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
  white-space: nowrap;
}
.afs-cookie-btn:active { transform: translateY(1px); }

.afs-cookie-btn--primary {
  background: linear-gradient(180deg, #2f5f86, #1f3550);
  color: #fff;
  border-color: #1f3550;
}
.afs-cookie-btn--primary:hover { background: linear-gradient(180deg, #356a96, #243d5d); }

.afs-cookie-btn--secondary {
  background: #fff;
  color: #1f3550;
  border-color: #cbd5e1;
}
.afs-cookie-btn--secondary:hover { background: #f1f5f9; border-color: #94a3b8; }

.afs-cookie-btn--ghost {
  background: transparent;
  color: #475569;
  border-color: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 9px 10px;
}
.afs-cookie-btn--ghost:hover { color: #1f3550; }

/* ─── Modale preferenze ────────────────────────────────── */
.afs-cookie-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(3px);
}
.afs-cookie-modal.is-visible { display: flex; }

.afs-cookie-modal__dialog {
  background: #fff;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  border-radius: var(--radius, 12px);
  box-shadow: 0 30px 60px rgba(0, 0, 0, .35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.afs-cookie-modal__header {
  padding: 20px 22px 12px;
  border-bottom: 1px solid #e2e8f0;
}
.afs-cookie-modal__header h2 {
  margin: 0 0 4px;
  font-size: 1.15rem;
  color: #1f3550;
}
.afs-cookie-modal__header p {
  margin: 0;
  font-size: .88rem;
  color: #64748b;
  line-height: 1.5;
}
.afs-cookie-modal__body {
  padding: 16px 22px;
  overflow-y: auto;
}
.afs-cookie-modal__footer {
  padding: 14px 22px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  background: #f8fafc;
}

/* ─── Categoria (riga) ─────────────────────────────────── */
.afs-cookie-cat {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #f8fafc;
}
.afs-cookie-cat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.afs-cookie-cat__title {
  font-weight: 700;
  color: #1f3550;
  font-size: .95rem;
}
.afs-cookie-cat__desc {
  font-size: .82rem;
  color: #64748b;
  margin-top: 6px;
  line-height: 1.45;
}
.afs-cookie-cat__locked {
  font-size: .72rem;
  color: #16a34a;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ─── Toggle switch ────────────────────────────────────── */
.afs-cookie-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
}
.afs-cookie-switch input { opacity: 0; width: 0; height: 0; }
.afs-cookie-switch__slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  border-radius: 24px;
  transition: background .2s;
}
.afs-cookie-switch__slider::before {
  content: "";
  position: absolute;
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.afs-cookie-switch input:checked + .afs-cookie-switch__slider { background-color: #2f5f86; }
.afs-cookie-switch input:checked + .afs-cookie-switch__slider::before { transform: translateX(18px); }
.afs-cookie-switch input:disabled + .afs-cookie-switch__slider { background-color: #16a34a; cursor: not-allowed; opacity: .85; }

/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 640px) {
  .afs-cookie-banner {
    left: 8px; right: 8px; bottom: 8px;
    padding: 16px;
  }
  .afs-cookie-banner__inner { flex-direction: column; align-items: stretch; }
  .afs-cookie-banner__actions { justify-content: flex-end; }
  .afs-cookie-btn { flex: 1 1 auto; text-align: center; }
  .afs-cookie-modal__footer { justify-content: stretch; }
  .afs-cookie-modal__footer .afs-cookie-btn { flex: 1 1 auto; }
}
