/**
 * @file
 * Global styles for CHF2 module.
 * 
 * Customizes Bootstrap button colors and link colors throughout the system.
 */

/* Botones primarios de Bootstrap - Color personalizado #6592e6 */
.btn-primary {
  background-color: #6592e6;
  border-color: #6592e6;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active {
  background-color: #4d7bd9;
  border-color: #4d7bd9;
}

.btn-primary:focus-visible {
  box-shadow: 0 0 0 0.25rem rgba(101, 146, 230, 0.5);
}

.btn-check:checked + .btn-primary,
.btn-check:active + .btn-primary,
.btn-primary:active,
.btn-primary.active,
.show > .btn-primary.dropdown-toggle {
  background-color: #4d7bd9;
  border-color: #4d7bd9;
}

/* Enlaces - Color personalizado #6592e6 */
/* Aplicar a enlaces de navegación y UI, manteniendo especificidad para sobrescribir Bootstrap */
body a {
  color: #6592e6;
}

body a:hover,
body a:focus {
  color: #4d7bd9;
}

body a:active,
body a.active {
  color: #4d7bd9;
}

/* Enlaces dentro de elementos específicos */
.btn-link {
  color: #6592e6;
}

.btn-link:hover,
.btn-link:focus {
  color: #4d7bd9;
}

/* Asegurar que los enlaces en tablas y otros elementos también usen el color */
table a,
.list-group-item a,
.card a,
.nav-link {
  color: #6592e6;
}

table a:hover,
.list-group-item a:hover,
.card a:hover,
.nav-link:hover {
  color: #4d7bd9;
}

/* Enlaces activos en navegación */
.nav-link.active,
.nav-link.active:hover {
  color: #6592e6;
}

/* Paginación y otros elementos que usan enlaces */
.pagination .page-link {
  color: #6592e6;
}

.pagination .page-link:hover {
  color: #4d7bd9;
}

.pagination .page-item.active .page-link {
  background-color: #6592e6;
  border-color: #6592e6;
}

/* ============================================
   BUTTON DANGER - Texto blanco para mejor contraste
   ============================================ */

/* Asegurar que todos los botones button--danger tengan texto blanco en todo el sistema */
.button.button--danger,
a.button.button--danger,
button.button--danger,
input.button--danger[type="submit"],
input.button--danger[type="button"] {
  color: #ffffff !important;
}

.button.button--danger:hover,
.button.button--danger:focus,
.button.button--danger:active,
a.button.button--danger:hover,
a.button.button--danger:focus,
a.button.button--danger:active,
button.button--danger:hover,
button.button--danger:focus,
button.button--danger:active,
input.button--danger[type="submit"]:hover,
input.button--danger[type="submit"]:focus,
input.button--danger[type="submit"]:active,
input.button--danger[type="button"]:hover,
input.button--danger[type="button"]:focus,
input.button--danger[type="button"]:active {
  color: #ffffff !important;
}

/* ============================================
   HEADER STICKY - Asegurar que siempre esté visible
   ============================================ */

/* SOLUCIÓN ROBUSTA: Mantener header navbar de Bootstrap5 siempre visible cuando tiene clase sticky-top */
/* Aplicar cuando el usuario hace scroll */
html body header[role="banner"] nav.navbar.sticky-top,
html body nav.navbar.sticky-top,
html body header nav.navbar.sticky-top {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  z-index: 1030 !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  transform: translateY(0) !important;
  -webkit-transform: translateY(0) !important;
  will-change: transform !important;
  box-shadow: 0 2px 4px rgba(0,0,0,.1) !important;
}

/* Asegurar que el navbar siempre tenga z-index alto cuando es sticky */
html body nav.navbar.sticky-top {
  z-index: 1030 !important;
}

/* SOLUCIÓN ROBUSTA: Mantener header sticky siempre visible cuando tiene clase affix */
/* Aplicar cuando el usuario hace scroll (clase affix presente) - para compatibilidad con dxpr_theme */
html body .dxpr-theme-header--sticky.affix,
html body .dxpr-theme-header--top.affix,
html body .dxpr-theme-header--sticky.dxpr-theme-header--fixed,
html body .dxpr-theme-header--top.dxpr-theme-header--fixed {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  z-index: 99999 !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  transform: translateY(0) !important;
  -webkit-transform: translateY(0) !important;
  will-change: transform !important;
}

/* Cuando tiene la clase affix, asegurar que siga visible */
.dxpr-theme-header--sticky.affix,
.dxpr-theme-header--top.affix,
.dxpr-theme-header--sticky.dxpr-theme-header--fixed,
.dxpr-theme-header--top.dxpr-theme-header--fixed {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  z-index: 99999 !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  transform: translateY(0) !important;
  -webkit-transform: translateY(0) !important;
  will-change: transform !important;
}

/* Asegurar que el header sticky siempre tenga un z-index alto */
.dxpr-theme-header--sticky,
.dxpr-theme-header--top.dxpr-theme-header--fixed,
.dxpr-theme-header--top.affix {
  z-index: 99999 !important;
}

/* Prevenir que cualquier elemento oculte el header o sus hijos */
.dxpr-theme-header--sticky,
.dxpr-theme-header--sticky.affix,
.dxpr-theme-header--top.affix {
  visibility: visible !important;
}

.dxpr-theme-header--sticky *,
.dxpr-theme-header--sticky.affix *,
.dxpr-theme-header--top.affix * {
  visibility: visible !important;
}

/* Asegurar que el header siempre esté en la parte superior del viewport */
html body .dxpr-theme-header--sticky,
body .dxpr-theme-header--sticky.affix,
body .dxpr-theme-header--top.affix {
  position: fixed !important;
  top: 0 !important;
}

/* Prevenir que otros elementos con z-index alto cubran el header */
.dxpr-theme-header--sticky,
.dxpr-theme-header--sticky.affix,
.dxpr-theme-header--top.affix {
  z-index: 99999 !important;
}

/* Asegurar que el header no se mueva fuera del viewport - máxima especificidad */
html body .dxpr-theme-header--sticky,
html body .dxpr-theme-header--sticky.affix,
html body .dxpr-theme-header--top.affix {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
}

/* Prevenir que el header se oculte con display none o visibility hidden */
html body .dxpr-theme-header--sticky[style*="display: none"],
html body .dxpr-theme-header--sticky[style*="visibility: hidden"],
html body .dxpr-theme-header--top.affix[style*="display: none"],
html body .dxpr-theme-header--top.affix[style*="visibility: hidden"] {
  display: block !important;
  visibility: visible !important;
}

/* Prevenir que el header se mueva fuera del viewport con transform negativo */
html body .dxpr-theme-header--sticky.affix,
html body .dxpr-theme-header--top.affix {
  transform: translateY(0) !important;
  -webkit-transform: translateY(0) !important;
  -moz-transform: translateY(0) !important;
  -ms-transform: translateY(0) !important;
  -o-transform: translateY(0) !important;
}

/* Asegurar que ningún elemento padre oculte el header */
html body #navbar.dxpr-theme-header--sticky.affix,
html body #navbar.dxpr-theme-header--top.affix {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  z-index: 99999 !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  transform: translateY(0) !important;
  -webkit-transform: translateY(0) !important;
}

/* Prevenir overflow hidden en elementos padre que puedan ocultar el header */
body:not(.toolbar-fixed) .dxpr-theme-header--sticky.affix,
body:not(.toolbar-fixed) .dxpr-theme-header--top.affix {
  overflow: visible !important;
}

