/* =========================================================================
   IMPERIO REAL — Modal estandar (.ir-modal)
   -------------------------------------------------------------------------
   Capa de apariencia OPT-IN para los modales de Bootstrap 3: se activa
   agregando la clase `ir-modal` al contenedor `.modal`. No se estiliza
   `.modal` a secas a proposito — el sistema tiene decenas de modales con
   diseno propio (hotel, restaurante, POS) y no deben cambiar solos.

   Estructura esperada (la de Bootstrap, sin inventar nada):
     .modal.ir-modal > .modal-dialog > .modal-content
        > .modal-header  ( .ir-modal-tit > h5.modal-title + .ir-modal-sub ,
                           .ir-modal-x )
        > .modal-body    ( .row > .form-group > label + control )
        > .modal-footer  ( botones )

   Los colores salen de variables-globales.css (--ir-azul y su escala), que
   se carga antes en la misma cabecera.
   ========================================================================= */

.ir-modal .modal-dialog {
    margin-top: 40px;
}

.ir-modal .modal-content {
    border: none;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 22px 55px rgba(15, 23, 42, .22);
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
}

/* ---------- Cabecera -------------------------------------------------
   Sin fondo de color ni icono: el titulo se sostiene solo y el contenido
   del modal gana protagonismo. El azul de marca aparece en los acentos
   (titulo, casillas, boton principal), no como bloque. */
.ir-modal .modal-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px 13px;
    border-bottom: 1px solid #eef2f7;
    background: #fff;
}

.ir-modal .ir-modal-tit {
    flex: 1;
    min-width: 0;
}

.ir-modal .modal-header .modal-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--ir-azul-texto, #123a63);
    line-height: 1.25;
}

.ir-modal .ir-modal-sub {
    display: block;
    margin-top: 3px;
    font-size: 12px;
    color: #64748b;
}

.ir-modal .ir-modal-x {
    border: 0;
    background: transparent;
    color: #c2c9d2;
    font-size: 22px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 6px;
    opacity: 1;
    text-shadow: none;
}

.ir-modal .ir-modal-x:hover {
    background: #f1f5f9;
    color: #6b7280;
}

/* Varias vistas traen el boton de cierre nativo de Bootstrap (.close). */
.ir-modal .modal-header .close {
    color: #c2c9d2;
    opacity: 1;
    text-shadow: none;
    font-size: 24px;
    margin-top: -2px;
}

.ir-modal .modal-header .close:hover {
    color: #6b7280;
    opacity: 1;
}

/* ---------- Cuerpo --------------------------------------------------- */
.ir-modal .modal-body {
    padding: 20px 18px 6px;
    background: #fff;
}

.ir-modal .modal-body label {
    font-size: 12.5px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
}

.ir-modal .modal-body .form-control {
    height: 38px;
    font-size: 13.5px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: none;
    color: #1f2937;
}

.ir-modal .modal-body .form-control:focus {
    border-color: var(--ir-azul);
    box-shadow: 0 0 0 3px rgba(var(--ir-azul-rgb), .12);
}

/* select2 v3 (el que usa la plantilla) alineado con los inputs */
.ir-modal .modal-body .select2-container .select2-choice {
    height: 38px !important;
    line-height: 36px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    background: #fff !important;
    font-size: 13.5px;
}

/* Mensajes de validacion bajo cada campo */
.ir-modal .modal-body .control-label[style*="red"],
.ir-modal .modal-body .ir-modal-msj {
    display: block;
    font-size: 11.5px;
    font-weight: 500;
    margin-top: 4px;
}

/* Fila de casillas: sustituye los `margin-top:30px` sueltos del markup viejo */
.ir-modal .ir-check-fila {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 26px;
    padding: 4px 0 10px;
    margin-top: 4px;
    border-top: 1px solid #eef2f7;
}

.ir-modal .ir-check-fila .checkbox {
    margin: 0;
    padding: 0;
}

.ir-modal .ir-check-fila .cr-styled {
    font-size: 13px;
    color: #374151;
    margin: 0;
}

.ir-modal .ir-nota {
    font-size: 12px;
    color: #64748b;
}

.ir-modal .ir-nota b {
    color: var(--ir-azul-texto);
}

/* ---------- Pie ------------------------------------------------------ */
.ir-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin: 14px 0 0;
    padding: 12px 18px;
    border-top: 1px solid #eef2f7;
    background: #f8fafc;
}

/* Se estiliza por posicion y no por clase de color: el JS de productos y
   servicios reasigna el onclick del boton guardar buscando `.btn-info`
   dentro del footer, asi que esa clase debe permanecer en el markup. */
.ir-modal .modal-footer .btn {
    border-radius: 8px !important;
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 600;
    border: 1px solid transparent;
    box-shadow: none;
    margin: 0;
    transition: background .15s, border-color .15s, filter .15s;
}

.ir-modal .modal-footer .btn-info,
.ir-modal .modal-footer .btn-primary,
.ir-modal .modal-footer .colorBackgroundISIS {
    background: var(--ir-azul) !important;
    border-color: var(--ir-azul) !important;
    color: #fff !important;
}

.ir-modal .modal-footer .btn-info:hover,
.ir-modal .modal-footer .btn-primary:hover,
.ir-modal .modal-footer .colorBackgroundISIS:hover {
    filter: brightness(.93);
}

/* "Regresar" deja de ser rojo: no destruye nada, solo vuelve atras. */
.ir-modal .modal-footer .btn-danger {
    background: #fff !important;
    border-color: #e2e8f0 !important;
    color: #4b5563 !important;
}

.ir-modal .modal-footer .btn-danger:hover {
    background: #f4f6f9 !important;
    border-color: #cbd5e1 !important;
}

@media (max-width: 767px) {
    .ir-modal .modal-dialog { margin: 12px; }
    .ir-modal .modal-footer { flex-direction: column-reverse; }
    .ir-modal .modal-footer .btn { width: 100%; }
}
