/**
 * SIGR – Estilos transversales + bloque reutilizable de formularios compactos
 * ------------------------------------------------------------
 * Cargar después de: style.css, dark-style.css, select2-custom.css
 *
 * .sigr-compact-forms
 *   Aplicar en el contenedor del modal/sección donde se quiera densidad tipo sm,
 *   bordes un poco más marcados en modo claro y Select2 alineado.
 *   El resto del sitio mantiene tamaños estándar del template.
 */

/* Tooltips dentro de modales por encima del backdrop */
.modal .tooltip,
.tooltip-modal-incidente {
  z-index: 10900 !important;
}

/* =============================================================================
 * .sigr-compact-forms — compacto + bordes (solo donde se use la clase)
 *
 * Integración con assets/css/font-control.css (clases body.font-small|normal|large|xlarge):
 * no usar tamaños fijos en px/rem; usar var(--font-size-small) en controles compactos
 * para que el modal siga el mismo control de texto que el resto del sitio.
 * ============================================================================= */

/* Base del bloque = misma variable que el sitio (supera body div/span con herencia) */
body .sigr-compact-forms {
  font-size: var(--font-size-base) !important;
}

body .sigr-compact-forms div:not(.sigr-puntaje-display):not(#puntaje),
body .sigr-compact-forms span,
body .sigr-compact-forms p,
body .sigr-compact-forms li {
  font-size: inherit !important;
}

/*
 * Puntaje: refuerzo; la regla definitiva está en font-control.css (carga después en admin_template).
 */
body #modal_full #puntaje.sigr-puntaje-display {
  font-size: clamp(2.1rem, 3vw + 1.25rem, 3rem) !important;
  line-height: 1.05 !important;
  font-weight: 700 !important;
}

body:not(.dark-mode) .sigr-compact-forms .form-control,
body:not(.dark-mode) .sigr-compact-forms .form-select,
body:not(.dark-mode) .sigr-compact-forms .select2-container--default .select2-selection--single,
body:not(.dark-mode) .sigr-compact-forms .select2-container--default .select2-selection--multiple {
  border-color: #bcc6d8 !important;
}

body:not(.dark-mode) .sigr-compact-forms .card,
body:not(.dark-mode) .sigr-compact-forms .expanel,
body:not(.dark-mode) .sigr-compact-forms .expanel-default {
  border-color: #b7c2d6 !important;
}

.sigr-compact-forms .form-control:not(.form-control-lg):not(.form-control-sm) {
  min-height: calc(1.5em + 0.5rem + 2px);
  padding: 0.25rem 0.5rem;
  /* Escala con font-control (compacto ≈ un paso bajo la base del sitio) */
  font-size: var(--font-size-small) !important;
  border-radius: 0.2rem;
}

.sigr-compact-forms textarea.form-control:not(.form-control-lg):not(.form-control-sm) {
  min-height: calc(1.5em + 0.5rem + 2px);
}

.sigr-compact-forms select.form-control:not(.form-control-lg):not(.form-control-sm),
.sigr-compact-forms select.form-select:not(.form-select-lg):not(.form-select-sm) {
  height: auto !important;
  min-height: calc(1.5em + 0.5rem + 2px) !important;
  padding: 0.25rem 2rem 0.25rem 0.5rem !important;
  font-size: var(--font-size-small) !important;
  line-height: 1.5 !important;
  border-radius: 0.2rem !important;
  background-position: right 0.5rem center !important;
  background-size: 14px 10px !important;
  vertical-align: middle !important;
}

body:not(.dark-mode) .sigr-compact-forms select.form-control:not(.form-control-lg):not(.form-control-sm),
body:not(.dark-mode) .sigr-compact-forms select.form-select:not(.form-select-lg):not(.form-select-sm) {
  color: #4d5875 !important;
}

.sigr-compact-forms .form-label {
  font-size: var(--font-size-small) !important;
  margin-bottom: 0.25rem;
}

.sigr-compact-forms .form-group {
  margin-bottom: 0.5rem;
}

.sigr-compact-forms .select2-container .select2-selection--single {
  min-height: calc(1.5em + 0.5rem + 2px) !important;
  height: auto !important;
  padding: 0.125rem 0.25rem;
}

.sigr-compact-forms .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 1.5 !important;
  font-size: var(--font-size-small) !important;
  padding-left: 0.25rem !important;
}

.sigr-compact-forms .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: calc(1.5em + 0.5rem + 2px) !important;
  right: 6px !important;
}

.sigr-compact-forms .modal-footer .btn {
  padding: 0.25rem 0.5rem;
  font-size: var(--font-size-small) !important;
  border-radius: 0.2rem;
}

/* Multiple select (wenzhixin) dentro del bloque compacto */
.sigr-compact-forms .ms-parent .ms-drop {
  z-index: 3000;
}

.sigr-compact-forms .ms-drop ul > li.multiple,
.sigr-compact-forms .ms-drop ul > li.ms-select-all {
  float: none !important;
  width: 100% !important;
  max-width: 100% !important;
  display: block !important;
  clear: both;
}

.sigr-compact-forms .ms-drop ul > li.multiple label {
  white-space: normal;
}

.sigr-compact-forms .ms-drop ul > li.multiple {
  min-height: 2.25em;
}

.sigr-compact-forms .sigr-info-eventos-grid {
  --sigr-info-evento-cols: 8;
}

.sigr-compact-forms .sigr-info-eventos-grid > .sigr-info-evento-item {
  flex: 0 0 calc(100% / var(--sigr-info-evento-cols));
  max-width: calc(100% / var(--sigr-info-evento-cols));
  width: calc(100% / var(--sigr-info-evento-cols));
  min-width: 0;
}

@media (max-width: 1199.98px) {
  .sigr-compact-forms .sigr-info-eventos-grid {
    --sigr-info-evento-cols: 6;
  }
}

@media (max-width: 991.98px) {
  .sigr-compact-forms .sigr-info-eventos-grid {
    --sigr-info-evento-cols: 4;
  }
}

@media (max-width: 575.98px) {
  .sigr-compact-forms .sigr-info-eventos-grid {
    --sigr-info-evento-cols: 2;
  }
}

/* =============================================================================
   Utilidades de color custom SIGR
   bg-secondary-soft: mismo fondo que expanel-default heading (var --primary005,
   color primario al 5% de opacidad, calculado en themeColors.js).
   ============================================================================= */

.sigr-compact-forms .bg-secondary-soft,
.bg-secondary-soft {
  background-color: var(--primary005) !important;
}

body.dark-mode .sigr-compact-forms .bg-secondary-soft,
body.dark-mode .bg-secondary-soft {
  background-color: rgba(255, 255, 255, 0.04) !important;
}

/* =============================================================================
   Modal fullscreen (#modal_full): header/tabs + footer fijos, scroll solo en
   .panel-body.tabs-menu-body (incidente y regulación con la misma clase).
   ============================================================================= */

#modal_full.modal .modal-content.modal-full-sigr {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100vh;
  min-height: 0;
  overflow: hidden;
}

/* Incidente: shell .sigr-compact-forms ocupa el alto entre header de página y footer */
#modal_full.modal .modal-content.modal-full-sigr > .sigr-compact-forms {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#modal_full.modal .modal-header {
  flex-shrink: 0;
}

#modal_full.modal .modal-content.modal-full-sigr > .modal-footer,
#modal_full.modal .modal-content.modal-full-sigr > .sigr-compact-forms > .modal-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--bs-border-color, #dee2e6);
}

#modal_full.modal .modal-content.modal-full-sigr > .modal-body,
#modal_full.modal .modal-content.modal-full-sigr > .sigr-compact-forms > .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#modal_full.modal .modal-body > .panel.panel-primary {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 0;
}

#modal_full.modal .modal-body > .panel.panel-primary > .tab-menu-heading {
  flex-shrink: 0;
}

#modal_full.modal .panel-body.tabs-menu-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

#modal_full.modal .modal-body > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

#modal_full.modal .modal-body > form > .panel.panel-primary {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  margin-bottom: 0;
}

/* ============================================================
   TOASTR — Colores del sistema SIGR
   toast-success  → verde (toastr nativo)
   toast-error    → rojo  (toastr nativo)
   toast-warning  → naranja (toastr nativo)
   toast-info     → azul  (toastr nativo)
   .toast-primary → color primario del sistema (#6c5ffc)
   ============================================================ */
#toast-container > .toast-primary {
  background-color: #6c5ffc;
  background-image: none;
}
#toast-container > .toast-primary:hover {
  background-color: #5a4ee0;
}
/* .toast-primary disponible si se necesita en el futuro */
