/* Banner de consentimento de cookies — auto-hospedado, sem script de
   terceiros. Reaproveita os tokens de cor/raio/sombra e as classes
   .btn-primary/.btn-secondary já definidas em legado-os.css e admin.css,
   pra ficar visualmente igual ao resto do Design System sem duplicar
   estilo de botão aqui. */

.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 400;
  background: var(--surface, #fff);
  border-top: 1px solid var(--border, #e2e8f0);
  box-shadow: var(--shadow-lg, 0 16px 40px rgba(15, 23, 42, .14));
  padding: 18px 20px;
}
.cookie-banner[hidden] { display: none; }

.cookie-banner-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.cookie-banner-texto { flex: 1 1 380px; }
.cookie-banner-texto p {
  margin: 0;
  font-size: .92rem;
  line-height: 1.55;
  color: var(--text-700, #334155);
}
.cookie-banner-texto a {
  color: var(--teal-700, #0b7d72);
  font-weight: 600;
  text-decoration: underline;
}

.cookie-banner-acoes {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}
.cookie-banner-acoes button {
  white-space: nowrap;
}

/* ---------- Painel de personalização (2ª camada) ---------- */
.cookie-painel {
  position: fixed;
  z-index: 401;
  right: 20px;
  bottom: 20px;
  width: 420px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 40px);
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius, 14px);
  box-shadow: var(--shadow-lg, 0 16px 40px rgba(15, 23, 42, .14));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cookie-painel[hidden] { display: none; }

.cookie-painel-cabecalho {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.cookie-painel-cabecalho h2 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-900, #0f172a);
  margin: 0;
}
.cookie-painel-fechar {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm, 10px);
  cursor: pointer;
  color: var(--text-700, #334155);
}
.cookie-painel-fechar:hover { background: var(--teal-50, #f0fdfa); }
.cookie-painel-fechar:focus-visible { outline: 2px solid var(--teal-600, #0d9488); outline-offset: 1px; }
.cookie-painel-fechar svg { width: 18px; height: 18px; fill: currentColor; }

.cookie-painel-corpo {
  padding: 14px 16px;
  overflow-y: auto;
}
.cookie-painel-intro {
  font-size: .88rem;
  color: var(--text-700, #334155);
  line-height: 1.5;
  margin: 0 0 14px;
}
.cookie-painel-intro a { color: var(--teal-700, #0b7d72); font-weight: 600; }

.cookie-categoria {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius-sm, 10px);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.cookie-categoria:last-child { margin-bottom: 0; }
.cookie-categoria-cabecalho {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.cookie-categoria-cabecalho h3 {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text-900, #0f172a);
  margin: 0;
}
.cookie-categoria-desc {
  font-size: .82rem;
  color: var(--text-500, #64748b);
  line-height: 1.5;
  margin: 6px 0 0;
}
.cookie-categoria-tag {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.cookie-categoria-tag-obrigatoria {
  background: var(--teal-50, #f0fdfa);
  color: var(--teal-700, #0b7d72);
}

/* Interruptor simples (toggle) pra categorias não essenciais */
.cookie-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--border, #e2e8f0);
  cursor: pointer;
  flex: 0 0 auto;
  padding: 0;
}
.cookie-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(15, 23, 42, .06));
  transition: transform .15s ease;
}
.cookie-toggle[aria-checked="true"] {
  background: var(--teal-600, #0d9488);
  border-color: var(--teal-600, #0d9488);
}
.cookie-toggle[aria-checked="true"]::after { transform: translateX(18px); }
.cookie-toggle:focus-visible { outline: 2px solid var(--teal-600, #0d9488); outline-offset: 2px; }
.cookie-toggle:disabled { cursor: not-allowed; opacity: .7; }

.cookie-painel-rodape {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border, #e2e8f0);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.cookie-painel-rodape button { flex: 1 1 auto; }

/* Quando o banner está visível, sobe o botão flutuante de acessibilidade
   pra eles nunca ficarem sobrepostos. */
html.tem-cookie-banner .a11y-widget-btn {
  bottom: 104px;
}

@media (max-width: 720px) {
  .cookie-banner { padding: 16px; }
  .cookie-banner-inner { gap: 14px; }
  .cookie-banner-acoes { width: 100%; }
  .cookie-banner-acoes button { flex: 1 1 auto; }
  .cookie-painel { left: 12px; right: 12px; bottom: 12px; width: auto; max-width: none; }
  html.tem-cookie-banner .a11y-widget-btn { bottom: 12px; left: auto; right: 12px; }
}
