/*
 * site-layout.css
 * Layout propio basado en Bootstrap 5.3 que reemplaza al tema color-admin (Bootstrap 3).
 * Replica el aspecto original: header azul corporativo + sidebar claro colapsable.
 * Colores tomados de css/theme/default.css y css/style.min.css del tema original.
 * No depende de apps.min.js, slimscroll, jquery-cookie ni jquery-ui.
 */

:root {
    --app-header-height: 54px;
    --app-sidebar-width: 220px;
    --app-sidebar-width-minified: 60px;
    /* Azul corporativo del tema (theme/default.css: .navbar.navbar-default) */
    --app-header-bg: #00049E;
    /* El sidebar del tema es claro (style.min.css: .sidebar { background: #fff }) */
    --app-sidebar-bg: #fff;
    --app-sidebar-color: #2d353c;
    --app-sidebar-hover-bg: #2d353c;
    --app-sidebar-active-bg: #00049E;
    --app-sidebar-active-color: #fff;
    --app-sidebar-profile-bg: #1a2229;
    --app-sidebar-border: #e5e8eb;
    --app-content-bg: #d9e0e7;
}

body {
    background: var(--app-content-bg);
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: .875rem;
    color: #2d353c;
}

/* ================= HEADER ================= */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--app-header-height);
    background: var(--app-header-bg);
    z-index: 1030;
}

/* El header usa el azul corporativo: todo su texto va en blanco. */
.app-header,
.app-header a,
.app-header .navbar-text {
    color: #fff;
}

.app-header .navbar-brand {
    color: #fff;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.app-header .nav-link {
    color: #fff;
}

.app-header .nav-link:hover,
.app-header .nav-link:focus {
    color: rgba(255, 255, 255, .75);
}

/* ================= SIDEBAR ================= */
.app-sidebar {
    position: fixed;
    top: var(--app-header-height);
    bottom: 0;
    left: 0;
    width: var(--app-sidebar-width);
    background: var(--app-sidebar-bg);
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 1020;
    transition: width .2s ease-in-out, transform .2s ease-in-out;
    border-right: 1px solid var(--app-sidebar-border);
    /* Reemplaza a slimscroll con scrollbar nativa estilizada */
    scrollbar-width: thin;
    scrollbar-color: #b1b9c0 transparent;
}

.app-sidebar::-webkit-scrollbar {
    width: 8px;
}

.app-sidebar::-webkit-scrollbar-thumb {
    background: #b1b9c0;
    border-radius: 4px;
}

.app-sidebar .nav {
    flex-direction: column;
    padding: 0;
    margin: 0;
    list-style: none;
}

.app-sidebar .nav-header {
    padding: 10px 20px;
    font-size: .6875rem;
    text-transform: uppercase;
    color: #a9acae;
    letter-spacing: .5px;
}

/* Perfil de usuario en el sidebar.
   Estructura: icono + nombre en una fila, y el correo completo debajo. */
.app-sidebar .nav-profile {
    padding: 20px;
    background: var(--app-sidebar-profile-bg);
    color: var(--app-sidebar-color);
}

.app-sidebar .nav-profile .identity {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.app-sidebar .nav-profile img {
    width: 45px;
    height: 45px;
    flex-shrink: 0;
}

.app-sidebar .nav-profile .name {
    font-weight: 600;
    line-height: 1.3;
    min-width: 0;
    overflow-wrap: anywhere;
    color: white;
}

.app-sidebar .nav-profile .mail {
    display: block;
    margin-top: .5rem;
    font-weight: 400;
    color: #6c757d;
    font-size: .7rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

/* Enlaces del menu */
.app-sidebar .nav > li > a {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: 8px 20px;
    color: var(--app-sidebar-color);
    text-decoration: none;
    white-space: nowrap;
}

.app-sidebar .nav > li > a:hover,
.app-sidebar .nav > li > a:focus {
    background: var(--app-sidebar-hover-bg);
    color: #fff;
}

/* El item activo se resalta en el azul corporativo */
.app-sidebar .nav > li.active > a,
.app-sidebar .nav > li.active > a:hover,
.app-sidebar .nav > li.active > a:focus {
    background: var(--app-sidebar-active-bg);
    color: var(--app-sidebar-active-color);
}

.app-sidebar .nav > li > a > i {
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

/* Submenus: se despliegan con JS propio, sin dependencia del tema */
.app-sidebar .sub-menu {
    list-style: none;
    padding: 5px 0 5px 38px;
    margin: 0;
    background: #1a2229;
    display: none;
}

.app-sidebar li.has-sub.expand > .sub-menu {
    display: block;
}

.app-sidebar .sub-menu > li > a {
    display: block;
    padding: 5px 20px;
    color: #575d63;
    text-decoration: none;
    font-size: .8125rem;
}

/* Mismo hover que los items principales: fondo gris oscuro y letra blanca.
   Los subelementos no reciben estado activo: solo cambian al pasar el cursor. */
.app-sidebar .sub-menu > li > a:hover,
.app-sidebar .sub-menu > li > a:focus {
    background: var(--app-sidebar-hover-bg);
    color: #fff;
}

/* Flecha indicadora de submenu (reemplaza a b.caret de BS3) */
.app-sidebar li.has-sub > a .caret-icon {
    margin-left: auto;
    transition: transform .2s ease-in-out;
    font-size: .75rem;
}

.app-sidebar li.has-sub.expand > a .caret-icon {
    transform: rotate(90deg);
}

/* El boton flotante es hijo directo del sidebar: se limpia el float
   para que no se solape con el contenido del menu. */
.app-sidebar::after {
    content: "";
    display: table;
    clear: both;
}

/* ================= BOTON MINIMIZAR SIDEBAR ================= */
/* Replica el original: pildora flotante pegada al borde derecho del sidebar. */
.app-sidebar .sidebar-minify-btn {
    display: none;
    float: right;
    clear: both;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 26px;
    margin: 10px 0;
    padding: 0;
    background: #1b1f24;
    color: #fff;
    border-radius: 20px 0 0 20px;
    text-decoration: none;
    line-height: 1;
}

.app-sidebar .sidebar-minify-btn:hover,
.app-sidebar .sidebar-minify-btn:focus {
    background: #2d353c;
    color: #fff;
}

.app-sidebar .sidebar-minify-btn > i {
    margin: 0;
}

/* ================= CONTENIDO ================= */
.app-content {
    margin-left: var(--app-sidebar-width);
    padding: 20px 25px;
    padding-top: calc(var(--app-header-height) + 20px);
    min-height: 100vh;
    transition: margin-left .2s ease-in-out;
    color: #2d353c;
}

/* El contenido va sobre fondo claro: se reafirma el color de texto para
   que las vistas no hereden los colores claros del sidebar/header. */
.app-content .card {
    color: #2d353c;
}

/* La fuente es la mitad de la original (1.75rem -> 0.875rem). Se conserva la
   altura previa del bloque con min-height + padding, para que la distancia
   entre el borde superior y el card no cambie. */
.app-content .page-header {
    font-size: 0.875rem;
    margin: 0 0 20px;
    padding: 0;
    border: 0;
    font-weight: 700;
    min-height: 2.1rem;
    display: flex;
    align-items: center;
}

/* Vistas sin cabecera de usuario (Consulta, Copiar, Configuracion): ocupa el
   mismo espacio que .page-header para alinear todos los card. */
.app-content .page-header-spacer {
    min-height: 2.1rem;
    margin: 0 0 20px;
}

.app-content .page-header small {
    font-size: 60%;
    color: #6c757d;
}

/* Cabecera del card principal (el que dibuja _LayoutBs5 cuando la vista define
   ViewData["PanelTitle"]): fondo gris oscuro y texto blanco. Se usa el selector
   de hijo directo para no afectar a los card anidados dentro de las vistas. */
.app-content > .card > .card-header {
    background-color: #2d353c;
    color: #fff;
    border-bottom: 0;
}

.app-content > .card > .card-header .card-title {
    color: #fff;
}

/* ================= BOTONES Y ETIQUETAS DE ESTADO ================= */
/* Boton de accion con el azul corporativo del header y del item activo del
   menu. Es opt-in: se aplica anadiendo .btn-nav junto a .btn, para no alterar
   los .btn-primary del resto de las vistas. */
.btn.btn-nav {
    background-color: var(--app-header-bg);
    border-color: var(--app-header-bg);
    color: #fff;
}

.btn.btn-nav:hover,
.btn.btn-nav:focus,
.btn.btn-nav:active {
    background-color: #000377;
    border-color: #000377;
    color: #fff;
}

/* Etiquetas Si/No de las tablas: se muestran como un boton inerte.
   "No" usa el azul del nav; "Si" una variante mas clara. */
.badge-estado {
    display: inline-block;
    min-width: 34px;
    padding: .35em .6em;
    border-radius: .25rem;
    background-color: var(--app-header-bg);
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    cursor: default;
    pointer-events: none;
}

.badge-estado-si {
    background-color: #3b3fd6;
}

/* ================= MODALES ================= */
/* En BS3 el ancho se daba con .modal-dialog{width}; en BS5 el contenedor usa
   max-width, por eso estas utilidades se redefinen aqui. */
.modal-80p {
    max-width: 80%;
}

.modal-body-scroll {
    max-height: 70vh;
    overflow-y: auto;
}

/* ================= SIDEBAR MINIFICADO (escritorio) ================= */
@media (min-width: 992px) {
    /* La pildora solo existe en escritorio, donde el sidebar se minifica */
    .app-sidebar .sidebar-minify-btn {
        display: flex;
    }

    body.sidebar-minified .app-sidebar {
        width: var(--app-sidebar-width-minified);
    }

    body.sidebar-minified .app-content {
        margin-left: var(--app-sidebar-width-minified);
    }

    body.sidebar-minified .app-sidebar .nav > li > a > span,
    body.sidebar-minified .app-sidebar .nav-profile .name,
    body.sidebar-minified .app-sidebar .nav-profile .mail,
    body.sidebar-minified .app-sidebar .nav-header,
    body.sidebar-minified .app-sidebar .sub-menu,
    body.sidebar-minified .app-sidebar .caret-icon {
        display: none;
    }

    body.sidebar-minified .app-sidebar .nav-profile {
        padding: 12px 0;
    }

    body.sidebar-minified .app-sidebar .nav-profile .identity {
        justify-content: center;
    }

    /* Al minificar, la pildora se centra y la flecha apunta al lado contrario */
    body.sidebar-minified .app-sidebar .sidebar-minify-btn {
        float: none;
        margin: 10px auto;
        border-radius: 20px;
    }

    body.sidebar-minified .app-sidebar .sidebar-minify-btn > i {
        transform: rotate(180deg);
    }
}

/* ================= RESPONSIVE (movil) ================= */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    body.sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    .app-content {
        margin-left: 0;
    }

    /* Fondo oscuro al abrir el sidebar en movil */
    body.sidebar-open::after {
        content: '';
        position: fixed;
        inset: var(--app-header-height) 0 0 0;
        background: rgba(0, 0, 0, .5);
        z-index: 1010;
    }
}

/* ================= BOTON VOLVER ARRIBA ================= */
.btn-scroll-to-top {
    position: fixed;
    right: 25px;
    bottom: 25px;
    z-index: 1040;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btn-scroll-to-top.show {
    display: flex;
}

/* =================================================================
 * COMPATIBILIDAD CON UTILIDADES DEL TEMA color-admin (Bootstrap 3)
 * Estas clases las usan las vistas heredadas. Se mantienen aqui para
 * no tener que editarlas una por una. Al migrar cada vista conviene
 * sustituirlas por las utilidades equivalentes de Bootstrap 5
 * (m-0, mt-2, pe-2, fs-5, ...) y luego eliminar este bloque.
 * ================================================================= */
.no-margin { margin: 0 !important; }

.m-t-0 { margin-top: 0 !important; }
.m-t-10 { margin-top: 10px !important; }
.m-b-8 { margin-bottom: 8px !important; }
.m-b-12 { margin-bottom: 12px !important; }
.m-r-3 { margin-right: 3px !important; }

.p-r-10 { padding-right: 10px !important; }

.f-s-15 { font-size: 15px !important; }

/* =================================================================
 * PASO 4 MIGRACION: widgets de estadisticas del Dashboard.
 * Las clases .widget-stats provenian del tema color-admin (Bootstrap 3),
 * que ya no se carga en _LayoutBs5. Se replican aqui lo minimo
 * necesario para que el Dashboard mantenga su aspecto.
 * ================================================================= */
.widget.widget-stats {
    position: relative;
    color: #fff;
    padding: 15px;
    border-radius: .375rem;
    margin-bottom: 0;
    min-height: 100%;
    background-color: #6c757d;
    overflow: hidden;
}

.widget.widget-stats .stats-icon {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 42px;
    opacity: .2;
    line-height: 1;
}

.widget.widget-stats .stats-info h4 {
    font-size: 12px;
    margin: 0 0 5px;
    color: rgba(255, 255, 255, .85);
    text-transform: uppercase;
    font-weight: 600;
}

.widget.widget-stats .stats-info p {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 0;
}

.widget.widget-stats .stats-link {
    margin: 15px -15px -15px;
}

.widget.widget-stats .stats-link a {
    display: block;
    padding: 8px 15px;
    background: rgba(0, 0, 0, .2);
    color: rgba(255, 255, 255, .9);
    text-decoration: none;
    font-weight: 500;
}

.widget.widget-stats .stats-link a:hover {
    background: rgba(0, 0, 0, .3);
    color: #fff;
}

.widget.widget-stats .stats-link a i {
    margin-left: 5px;
}

.widget.widget-stats.bg-red { background-color: #dc3545 !important; }

/* ================= TABLAS DENTRO DE MODALES ================= */
/* Paleta gris solicitada para las grillas de actividades/documentos que se
   muestran en los modales del calendario. Bootstrap 5 pinta el striping y los
   bordes con variables propias (--bs-table-*), por lo que se sobrescriben esas
   variables en vez de las reglas individuales de <td>/<tr>.
   Los selectores incluyen table.dataTable porque datatables.min.css se carga
   DESPUES de esta hoja y, ante igual especificidad, ganaria por orden. */
.modal .table,
.modal table.dataTable {
    --bs-table-striped-bg: #e4e7e9;
    --bs-table-border-color: #e4e7e9;
    border-color: #e4e7e9;
}

.modal .table > :not(caption) > * > *,
.modal table.dataTable > :not(caption) > * > * {
    border-color: #e4e7e9;
}

/* Filas alternas: DataTables aplica sus propias clases odd/even. */
.modal table.dataTable.table-striped > tbody > tr:nth-of-type(odd) > *,
.modal table.dataTable > tbody > tr.odd > * {
    --bs-table-accent-bg: #e4e7e9;
    background-color: #e4e7e9;
}

/* Lineas entre filas: datatables.min.css pinta los bordes de thead/tbody con un
   gris muy oscuro (se ven negros) mediante reglas propias sobre th/td, que esta
   hoja no alcanzaba solo con --bs-table-border-color. Se fuerzan aqui todos los
   bordes de la grilla al gris pedido. */
.modal .table th,
.modal .table td,
.modal table.dataTable th,
.modal table.dataTable td,
.modal table.dataTable thead th,
.modal table.dataTable thead td,
.modal table.dataTable tbody th,
.modal table.dataTable tbody td,
.modal table.dataTable.no-footer {
    border-color: #e4e7e9 !important;
}

/* Texto de las filas en el gris solicitado. */
.modal .table > tbody > tr > td,
.modal table.dataTable > tbody > tr > td {
    color: #707c7e;
}

/* Los <th> de DataTables heredan font-weight: bold del navegador. */
.modal .table > thead th,
.modal table.dataTable > thead th,
.modal table.dataTable > thead > tr > th {
    font-weight: 400;
}

/* Botones de accion de las grillas (Editar/Reagendar/Evidencia/Descargar).
   Se usa .btn-secondary porque es la clase con la que los render de DataTables
   generan los <a>. Los iconos (<i> de font-awesome) van en blanco. */
.modal .table .btn-secondary,
.modal table.dataTable .btn-secondary {
    background-color: #b6c2c9;
    border-color: #b6c2c9;
    color: #fff;
}

.modal .table .btn-secondary i,
.modal table.dataTable .btn-secondary i {
    color: #fff;
}

.modal .table .btn-secondary:hover,
.modal .table .btn-secondary:focus,
.modal .table .btn-secondary:active,
.modal table.dataTable .btn-secondary:hover,
.modal table.dataTable .btn-secondary:focus,
.modal table.dataTable .btn-secondary:active {
    background-color: #a5b3bb;
    border-color: #a5b3bb;
    color: #fff;
}


