/*
 * GDT Advogadas — aviso de cookies e diálogo de preferências
 * Arquivo: assets/css/consent.css (carregado depois de site.css em todas as páginas)
 * Usado por: assets/js/consent.js
 * "Aceitar" e "Recusar" usam exatamente o mesmo estilo (mesmo destaque).
 */

/* ---------- Aviso (faixa inferior, não modal) ---------- */
.gdt-consent {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  box-sizing: border-box;
  max-width: 980px;
  max-height: 70vh;
  max-height: 70dvh;
  margin: 0 auto;
  padding: 20px 56px 20px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "title   actions"
    "text    actions"
    "links   actions";
  column-gap: 28px;
  row-gap: 6px;
  align-items: center;
  background: #FFFFFF;
  color: #1F2A37;
  border: 1px solid var(--line, #DDDFD8);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(8, 26, 47, .14);
  font-family: var(--font-body, "Golos Text", "Segoe UI", system-ui, -apple-system, Arial, sans-serif);
  font-size: 13px;
  line-height: 1.55;
}
.gdt-consent[hidden] { display: none !important; }
/* Com o aviso aberto, o navegador rola o elemento que recebe o foco para cima do aviso (foco nunca escondido). */
html.has-cookie-banner { scroll-padding-bottom: calc(var(--cookie-banner-h, 0px) + 16px); }
/* Folga no fim da página: os últimos links (rodapé) também podem subir acima do aviso. */
html.has-cookie-banner body { padding-bottom: var(--cookie-banner-h, 0px); }
.gdt-consent *, .gdt-consent-dialog * { box-sizing: border-box; }

.gdt-consent__title {
  grid-area: title;
  margin: 0;
  font-family: var(--font-display, "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--navy-700, #00497C);
}
.gdt-consent__text { grid-area: text; margin: 0; }
.gdt-consent__links { grid-area: links; margin: 0; }
.gdt-consent__links a,
.gdt-consent-dialog__links a {
  color: var(--blue-600, #026BB6);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.gdt-consent__links a:hover,
.gdt-consent-dialog__links a:hover { color: var(--navy-700, #00497C); }
.gdt-consent__sep { margin: 0 8px; color: #5B6670; }

.gdt-consent__actions {
  grid-area: actions;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 260px;
}

/* ---------- Botões ---------- */
.gdt-consent__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0;
  padding: 10px 20px;
  border: 1px solid var(--navy-700, #2C4A58);
  border-radius: 999px;
  font-family: var(--font-display, "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
/* Aceitar e Recusar: estilo idêntico */
.gdt-consent__btn--primary {
  background: var(--navy-700, #00497C);
  color: #FFFFFF;
}
.gdt-consent__btn--primary:hover { background: var(--navy-800, #003154); border-color: var(--navy-800, #003154); }
/* Preferências / Cancelar */
.gdt-consent__btn--secondary {
  background: #FFFFFF;
  color: var(--navy-700, #00497C);
}
.gdt-consent__btn--secondary:hover { background: var(--blue-100, #D4EBF8); }
.gdt-consent__btn:active { transform: translateY(1px); }

.gdt-consent__close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #3A4652;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.gdt-consent__close:hover { background: var(--gray-050, #F7F7F7); color: var(--navy-700, #00497C); }

.gdt-consent :focus-visible,
.gdt-consent-dialog :focus-visible {
  outline: 3px solid var(--blue-600, #026BB6);
  outline-offset: 3px;
}

/* ---------- Diálogo de preferências (modal nativo) ---------- */
.gdt-consent-dialog {
  width: calc(100% - 32px);
  max-width: 580px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 28px 28px 24px;
  overflow-y: auto;
  border: 0;
  border: 1px solid var(--line, #DDDFD8);
  border-radius: 16px;
  background: #FFFFFF;
  color: #1F2A37;
  box-shadow: 0 24px 64px rgba(7, 27, 52, .35);
  font-family: var(--font-body, "Golos Text", "Segoe UI", system-ui, -apple-system, Arial, sans-serif);
  font-size: 15px;
  line-height: 1.55;
}
.gdt-consent-dialog::backdrop { background: rgba(7, 27, 52, .62); }
/* Navegadores sem <dialog>: o atributo "open" mostra o diálogo centralizado */
.gdt-consent-dialog[open]:not(:modal) {
  position: fixed;
  inset: 16px;
  z-index: 1100;
  height: fit-content;
}

.gdt-consent-dialog__title {
  margin: 0 0 16px;
  font-family: var(--font-display, "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--navy-700, #00497C);
}
.gdt-consent-dialog__cat {
  padding: 16px 0;
  border-top: 1px solid var(--gray-300, #D6D6D6);
}
.gdt-consent-dialog__cat-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.gdt-consent-dialog__cat-title {
  flex: 1 1 auto;
  margin: 0;
  font-family: var(--font-display, "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--navy-700, #00497C);
}
.gdt-consent-dialog__cat-title label { cursor: pointer; }
.gdt-consent-dialog__note {
  font-size: 13px;
  font-weight: 600;
  color: #3A4652;
  white-space: nowrap;
}
.gdt-consent-dialog__text { margin: 8px 0 0; color: #3A4652; }
.gdt-consent-dialog__links { margin: 4px 0 0; padding-top: 12px; border-top: 1px solid var(--gray-300, #D6D6D6); }
.gdt-consent-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.gdt-consent-dialog__actions .gdt-consent__btn { flex: 1 1 200px; }

/* Interruptor (checkbox com role="switch") */
.gdt-consent-switch {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: 52px;
  height: 30px;
  margin: 0;
  border: 2px solid #5B6670;
  border-radius: 999px;
  background: #FFFFFF;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.gdt-consent-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #5B6670;
  transition: transform .15s ease, background-color .15s ease;
}
.gdt-consent-switch:checked {
  background: var(--navy-700, #00497C);
  border-color: var(--navy-700, #00497C);
}
.gdt-consent-switch:checked::after { transform: translateX(22px); background: #FFFFFF; }
.gdt-consent-switch:disabled { cursor: not-allowed; opacity: .75; }

/* Região de anúncios para leitores de tela */
.gdt-consent-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Telas menores ---------- */
@media (max-width: 860px) {
  .gdt-consent {
    grid-template-columns: 1fr;
    grid-template-areas: "title" "text" "links" "actions";
    row-gap: 8px;
    padding: 18px 18px 18px;
  }
  .gdt-consent__title { padding-right: 40px; }
  .gdt-consent__actions { min-width: 0; margin-top: 6px; }
}
@media (max-width: 480px) {
  .gdt-consent { left: 8px; right: 8px; bottom: 8px; font-size: 14.5px; }
  .gdt-consent-dialog { padding: 22px 18px 18px; }
  .gdt-consent-dialog__cat-head { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: no-preference) {
  .gdt-consent:not([hidden]) { animation: gdt-consent-in .25s ease-out; }
  @keyframes gdt-consent-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  .gdt-consent__btn, .gdt-consent-switch, .gdt-consent-switch::after { transition: none; }
}
@media print { .gdt-consent, .gdt-consent-dialog { display: none !important; } }
