/* ============================================================
   demokratian — bootstrap-compat.css
   Protege los componentes Bootstrap (cookie banner, modales,
   formularios de login heredados) del reset CSS nuevo.
   Carga DESPUÉS de components.css + espacio.css.
   ============================================================ */

/* Cookie banner y modal de preferencias — restaurar estilos Bootstrap */
#cb-cookie-banner,
#cb-preferences-modal,
#cb-preferences-modal .modal-dialog,
#cb-preferences-modal .modal-content {
  font-family: var(--font-body);
}

/* Posicionamiento del banner. Estaba en un style= inline en el footer.
   Ojo: el banner se muestra y se oculta quitando y poniendo la clase .d-none
   de Bootstrap (display:none!important), no tocando display aquí. */
#cb-cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9998;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
}

/* Con un modal de Bootstrap abierto (clase .modal-open en <body>), el banner
   quedaba POR ENCIMA del modal (z-index 9998 contra ~1055 del modal) y podía
   tapar contenido o botones cerca del borde inferior, como el "Aceptar" del
   final de un documento en #modalTerms. Más simple que subir el z-index del
   modal por encima de 9998 (arriesga taparlo TODO, incluido el propio banner
   de cookies si algún día hay que mostrarlo a la vez): el banner no pinta
   nada mientras haya un modal abierto. */
body.modal-open #cb-cookie-banner {
  display: none !important;
}

#cb-cookie-banner .btn,
#cb-preferences-modal .btn {
  display: inline-block;
  font-weight: 400;
  text-align: center;
  vertical-align: middle;
  border: 1px solid transparent;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out;
}

#cb-cookie-banner .btn-primary,
#cb-preferences-modal .btn-primary {
  color: #fff;
  background-color: var(--green-deep);
  border-color: var(--green-deep);
}
#cb-cookie-banner .btn-primary:hover,
#cb-preferences-modal .btn-primary:hover {
  background-color: var(--green);
  border-color: var(--green);
  color: var(--ink); /* blanco sobre lima daba 1,9:1 */
}

/* Modal de preferencias: sin el azul ni el gris de Bootstrap */
#cb-preferences-modal .form-check-input:checked {
  background-color: var(--green-deep);
  border-color: var(--green-deep);
}
#cb-preferences-modal .form-check-input:focus {
  border-color: var(--green-deep);
  box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--green) 35%, transparent);
}
#cb-preferences-modal .btn-secondary {
  color: var(--ink);
  background-color: transparent;
  border-color: var(--line);
}
#cb-preferences-modal .btn-secondary:hover {
  border-color: var(--ink);
}
#cb-cookie-banner .btn:focus-visible,
#cb-preferences-modal .btn:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
  box-shadow: none;
}

#cb-cookie-banner .btn-outline-secondary {
  color: #fff;
  border-color: rgba(255,255,255,0.4);
}
#cb-cookie-banner .btn-outline-secondary:hover {
  background-color: rgba(255,255,255,0.15);
}

#cb-cookie-banner .btn-outline-light {
  color: #fff;
  border-color: rgba(255,255,255,0.3);
}
#cb-cookie-banner .btn-outline-light:hover {
  background-color: rgba(255,255,255,0.1);
}

/* Cookie banner — styling coherent with new design */
#cb-cookie-banner {
  background-color: var(--ink) !important;
  border: none !important;
  border-top: 1px solid rgba(255,255,255,0.1) !important;
  color: rgba(255,255,255,0.85);
}
/* Bootstrap (.alert-dark .alert-link) pinta el enlace casi negro:
   invisible sobre el fondo --ink del banner */
#cb-cookie-banner .alert-link {
  color: var(--green);
  text-decoration: underline;
}

/* Modal — ensure Bootstrap modal behavior works */
#cb-preferences-modal .modal-content {
  border-radius: 16px;
  border: 1px solid var(--line);
}
#cb-preferences-modal .modal-header {
  border-bottom-color: var(--line-soft);
}
#cb-preferences-modal .modal-footer {
  border-top-color: var(--line-soft);
}

/* Performance stats overlay — keep visible */
[style*="position:fixed"][style*="bottom:0"][style*="right:0"][style*="background:#333"] {
  z-index: 9999 !important;
}

/* SweetAlert2 — ensure it works above the new design */
.swal2-container {
  z-index: 10000 !important;
}
