/**
 * SindiPrivacy — Banner de Cookies e Central de Preferências
 * Design System Ultraleve e Acessível (WCAG 2.2 AA)
 */

:root {
  --sdp-brand: #C5172E;
  --sdp-brand-dark: #8F1022;
  --sdp-surface: #FFFFFF;
  --sdp-surface-subtle: #F7F7F5;
  --sdp-ink: #17191C;
  --sdp-muted: #667085;
  --sdp-border: #E5E7EB;
  --sdp-radius: 8px;
  --sdp-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* 1. Contêiner do Banner (Nível 1) */
.sdp-banner-overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999990;
  padding: 16px;
  pointer-events: none;
  display: none;
}

.sdp-banner-overlay.is-visible {
  display: block;
}

.sdp-banner-box {
  pointer-events: auto;
  max-width: 1100px;
  margin: 0 auto;
  background-color: var(--sdp-surface);
  border: 1px solid var(--sdp-border);
  border-radius: var(--sdp-radius);
  padding: 24px;
  box-shadow: var(--sdp-shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: var(--sdp-ink);
  font-family: inherit;
  line-height: 1.5;
}

@media (min-width: 860px) {
  .sdp-banner-box {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
  }
}

.sdp-banner-content h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 6px 0;
  color: var(--sdp-ink);
}

.sdp-banner-content p {
  font-size: 13.5px;
  color: var(--sdp-muted);
  margin: 0;
}

.sdp-banner-content a {
  color: var(--sdp-brand);
  text-decoration: underline;
  font-weight: 600;
}

.sdp-banner-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

@media (min-width: 600px) {
  .sdp-banner-actions {
    flex-direction: row;
    align-items: center;
  }
}

/* 2. Botões Padronizados com Destaque Visual Equivalente (#12, #13) */
.sdp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  border: 1.5px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s ease;
  min-height: 42px;
}

.sdp-btn-primary {
  background-color: var(--sdp-brand);
  color: #FFFFFF !important;
}

.sdp-btn-primary:hover {
  background-color: var(--sdp-brand-dark);
}

.sdp-btn-secondary {
  background-color: var(--sdp-surface);
  border-color: var(--sdp-border);
  color: var(--sdp-ink) !important;
}

.sdp-btn-secondary:hover {
  background-color: var(--sdp-surface-subtle);
  border-color: #CBD5E1;
}

.sdp-btn-outline {
  background-color: transparent;
  border-color: var(--sdp-brand);
  color: var(--sdp-brand) !important;
}

.sdp-btn-outline:hover {
  background-color: #FFF5F5;
}

.sdp-btn:focus-visible {
  outline: 3px solid var(--sdp-brand) !important;
  outline-offset: 2px;
}

/* 3. Modal de Preferências (Nível 2) */
.sdp-modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  z-index: 999995;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.sdp-modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.sdp-modal-dialog {
  background: var(--sdp-surface);
  border-radius: var(--sdp-radius);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--sdp-shadow);
  overflow: hidden;
}

.sdp-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--sdp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sdp-modal-header h2 {
  font-size: 18px;
  font-weight: 800;
  margin: 0;
  color: var(--sdp-ink);
}

.sdp-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--sdp-muted);
  padding: 4px;
  line-height: 1;
}

.sdp-modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sdp-cat-item {
  background: var(--sdp-surface-subtle);
  border: 1px solid var(--sdp-border);
  border-radius: 6px;
  padding: 16px;
}

.sdp-cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.sdp-cat-header strong {
  font-size: 15px;
  color: var(--sdp-ink);
}

.sdp-cat-item p {
  font-size: 12.5px;
  color: var(--sdp-muted);
  margin: 0;
  line-height: 1.4;
}

/* Switch Toggle Acessível */
.sdp-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.sdp-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.sdp-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #CBD5E1;
  transition: 0.2s;
  border-radius: 24px;
}

.sdp-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
}

input:checked + .sdp-slider {
  background-color: var(--sdp-brand);
}

input:focus-visible + .sdp-slider {
  box-shadow: 0 0 0 3px rgba(197, 23, 46, 0.4);
}

input:checked + .sdp-slider:before {
  transform: translateX(20px);
}

input:disabled + .sdp-slider {
  background-color: #15803D;
  cursor: not-allowed;
  opacity: 0.8;
}

.sdp-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--sdp-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--sdp-surface-subtle);
}

/* 4. Gatilho Fixo do Rodapé */
.sdp-footer-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: inherit;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  text-decoration: underline;
}

.sdp-footer-trigger-btn:hover {
  color: var(--sdp-brand);
}

@media (prefers-reduced-motion: reduce) {
  .sdp-modal-backdrop,
  .sdp-slider,
  .sdp-slider:before {
    transition: none !important;
  }
}
