﻿:root {
    --sidebar-width: 270px;
    --topbar-height: 64px;
    --app-dark: #202428;
    --app-dark-2: #1b1f23;
    --app-border: #343a40;
    --app-text-muted: #b8c0c8;
}

/* =========================================================
   CONFIGURACIÓN GENERAL
   ========================================================= */

html,
body {
    width: 100%;
    max-width: 100%;
    min-height: 100%;
    overflow-x: hidden;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

.app-shell {
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    background: #ffffff;
    overflow-x: hidden;
}

/* =========================================================
   BARRA SUPERIOR
   ========================================================= */

.app-topbar {
    width: 100%;
    max-width: 100%;
    height: var(--topbar-height);
    background: var(--app-dark);
    border-bottom: 1px solid var(--app-border);
    color: #ffffff;
    display: flex;
    align-items: center;
    padding: 0 22px;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.app-menu-button {
    border: none;
    background: transparent;
    color: #ffffff;
    font-size: 1.6rem;
    margin-right: 16px;
    padding: 4px;
    cursor: pointer;
    flex-shrink: 0;
}

    .app-menu-button:hover,
    .app-menu-button:focus {
        color: #ffffff;
        background: rgba(255, 255, 255, .08);
        border-radius: 6px;
        outline: none;
    }

.app-brand {
    min-width: 0;
    color: #ffffff;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

    .app-brand:hover,
    .app-brand:focus {
        color: #ffffff;
        text-decoration: none;
    }

.app-topbar-spacer {
    flex: 1;
    min-width: 8px;
}

/* =========================================================
   BARRA LATERAL
   ========================================================= */

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--app-dark);
    color: #ffffff;
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    z-index: 1020;
    overflow-x: hidden;
    overflow-y: auto;
    border-right: 1px solid var(--app-border);
    transform: translateX(0);
    transition: transform .25s ease-in-out;
    will-change: transform;
    overscroll-behavior: contain;
}

.sidebar-section {
    width: 100%;
    padding: 18px 14px;
}

.sidebar-title {
    color: var(--app-text-muted);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .06rem;
    margin: 10px 12px;
}

.sidebar-link {
    width: 100%;
    color: var(--app-text-muted);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    margin-bottom: 4px;
    border-radius: 10px;
    text-decoration: none;
    overflow: hidden;
}

    .sidebar-link:hover {
        color: #ffffff;
        background: rgba(255, 255, 255, .08);
        text-decoration: none;
    }

    .sidebar-link:focus {
        color: #ffffff;
        text-decoration: none;
        outline: 2px solid rgba(255, 255, 255, .25);
        outline-offset: 1px;
    }

    .sidebar-link.active {
        color: #ffffff;
        background: #0d6efd;
    }

    .sidebar-link i {
        width: 22px;
        min-width: 22px;
        font-size: 1.1rem;
        text-align: center;
        flex-shrink: 0;
    }

    .sidebar-link span {
        min-width: 0;
        overflow-wrap: break-word;
    }

/* =========================================================
   CONTENIDO PRINCIPAL
   ========================================================= */

.app-content {
    width: calc(100% - var(--sidebar-width));
    min-width: 0;
    max-width: calc(100% - var(--sidebar-width));
    margin-left: var(--sidebar-width);
    padding: 26px;
    transition: margin-left .25s ease-in-out, width .25s ease-in-out, max-width .25s ease-in-out;
}

.app-content-inner {
    width: 100%;
    min-width: 0;
    max-width: 1400px;
    margin: 0 auto;
}

/* =========================================================
   BARRA LATERAL CONTRAÍDA EN ESCRITORIO
   ========================================================= */

body.sidebar-collapsed .app-sidebar {
    transform: translateX(-100%);
}

body.sidebar-collapsed .app-content {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
}

/* =========================================================
   VISTAS SIN SESIÓN
   ========================================================= */

.login-layout .app-content {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
}

.login-layout .app-topbar {
    display: none;
}

/* =========================================================
   CAPA OSCURA DE LA BARRA MÓVIL
   ========================================================= */

.sidebar-overlay {
    display: none;
}

/* =========================================================
   PERFIL DEL USUARIO
   ========================================================= */

.profile-menu-wrapper {
    position: relative;
}

.profile-button {
    border: 1px solid rgba(255, 255, 255, .15);
    background: rgba(255, 255, 255, .05);
    color: #ffffff;
    border-radius: 999px;
    padding: 7px 12px;
    display: flex;
    align-items: center;
    gap: 9px;
    flex-shrink: 0;
}

    .profile-button:hover,
    .profile-button:focus {
        background: rgba(255, 255, 255, .12);
        color: #ffffff;
        outline: none;
    }

.profile-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: #0d6efd;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.profile-name {
    max-width: 230px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-chevron {
    font-size: .85rem;
    color: rgba(255, 255, 255, .75);
    flex-shrink: 0;
}

.profile-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 280px;
    max-width: calc(100vw - 20px);
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
    z-index: 2000;
    overflow: hidden;
}

    .profile-menu.show {
        display: block;
    }

.profile-menu-header {
    padding: 14px 16px;
    color: #212529;
}

    .profile-menu-header strong {
        display: block;
        font-size: .95rem;
    }

    .profile-menu-header small {
        display: block;
        color: #6c757d;
        margin-top: 3px;
    }

.profile-menu-divider {
    height: 1px;
    background: #e9ecef;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    color: #212529;
    text-decoration: none;
    font-size: .95rem;
}

    .profile-menu-item:hover {
        background: #f8f9fa;
        color: #212529;
        text-decoration: none;
    }

    .profile-menu-item.text-danger {
        color: #dc3545;
    }

        .profile-menu-item.text-danger:hover {
            color: #dc3545;
            background: #fff5f5;
        }

    .profile-menu-item i {
        width: 20px;
        min-width: 20px;
        text-align: center;
    }

/* =========================================================
   CONTENEDORES RESPONSIVOS PARA TABLAS
   ========================================================= */

.app-table-scroll,
.table-responsive {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

    .app-table-scroll > table,
    .table-responsive > table {
        width: 100%;
        min-width: 950px;
        margin-bottom: 0;
    }

    .app-table-scroll th,
    .table-responsive th {
        white-space: nowrap;
    }

    .app-table-scroll td,
    .table-responsive td {
        vertical-align: middle;
    }

/* =========================================================
   MODAL DE CONFIRMACIÓN
   ========================================================= */

.modal-confirmacion-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

    .modal-confirmacion-overlay.show {
        display: flex;
    }

.modal-confirmacion {
    width: 100%;
    max-width: 480px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, .25);
    overflow: hidden;
    animation: modalConfirmacionEntrada .15s ease-out;
}

.modal-confirmacion-header {
    padding: 22px 24px 12px 24px;
    text-align: center;
}

    .modal-confirmacion-header h4 {
        margin: 10px 0 0 0;
        font-weight: 700;
    }

.modal-icono-advertencia {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: #fff3cd;
    color: #b58100;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
}

.modal-confirmacion-body {
    padding: 10px 24px 20px 24px;
    text-align: center;
}

.modal-confirmacion-footer {
    padding: 16px 24px 22px 24px;
    display: flex;
    justify-content: center;
    gap: 12px;
}

@keyframes modalConfirmacionEntrada {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

body.modal-abierto {
    overflow: hidden;
}

/* =========================================================
   TABLETAS Y CELULARES
   ========================================================= */

@media (max-width: 991.98px) {

    .app-topbar {
        width: 100%;
        height: var(--topbar-height);
        padding-left: 14px;
        padding-right: 14px;
    }

    .app-sidebar {
        width: min(84vw, 280px);
        max-width: 280px;
        transform: translate3d(-100%, 0, 0);
        overflow-x: hidden;
        overflow-y: auto;
        box-shadow: 8px 0 22px rgba(0, 0, 0, .22);
        transition: transform .25s ease-in-out;
        will-change: transform;
    }

    body.sidebar-open .app-sidebar {
        transform: translate3d(0, 0, 0);
    }

    body.sidebar-open {
        overflow: hidden;
    }

        body.sidebar-open .sidebar-overlay {
            display: block;
            position: fixed;
            top: var(--topbar-height);
            right: 0;
            bottom: 0;
            left: 0;
            background: rgba(0, 0, 0, .48);
            z-index: 1010;
            cursor: pointer;
        }

    .app-content,
    body.sidebar-collapsed .app-content {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        margin-left: 0;
        padding: 18px 14px;
        transition: none;
    }

    .app-content-inner {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    .profile-name {
        display: none;
    }
}

/* =========================================================
   CELULARES PEQUEÑOS
   ========================================================= */

@media (max-width: 575.98px) {

    .app-topbar {
        padding-left: 10px;
        padding-right: 10px;
    }

    .app-menu-button {
        margin-right: 8px;
        padding: 4px;
        font-size: 1.45rem;
    }

    .app-brand {
        max-width: 150px;
        font-size: 1rem;
    }

    .profile-button {
        padding: 5px 7px;
        gap: 4px;
    }

    .profile-avatar {
        width: 30px;
        height: 30px;
        min-width: 30px;
        font-size: .85rem;
    }

    .profile-chevron {
        display: none;
    }

    .profile-menu {
        width: 245px;
        max-width: calc(100vw - 20px);
        right: 0;
    }

    .app-content,
    body.sidebar-collapsed .app-content {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        padding: 14px 10px;
    }

    .app-table-scroll,
    .table-responsive {
        border: 1px solid #dee2e6;
        border-radius: 8px;
    }

        .app-table-scroll > table,
        .table-responsive > table {
            min-width: 900px;
        }

    .modal-confirmacion-overlay {
        align-items: flex-end;
        padding: 12px;
    }

    .modal-confirmacion {
        max-width: 100%;
        border-radius: 16px 16px 12px 12px;
    }

    .modal-confirmacion-header {
        padding: 18px 18px 10px 18px;
    }

        .modal-confirmacion-header h4 {
            font-size: 1.15rem;
        }

    .modal-confirmacion-body {
        padding: 8px 18px 16px 18px;
        font-size: .95rem;
    }

    .modal-confirmacion-footer {
        padding: 14px 18px 18px 18px;
        flex-direction: column-reverse;
        gap: 10px;
    }

        .modal-confirmacion-footer .btn {
            width: 100%;
        }

    .modal-icono-advertencia {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
}

/* =========================================================
   IMPRESIÓN
   ========================================================= */

@media print {

    html,
    body,
    .app-shell {
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
    }

    .app-topbar,
    .app-sidebar,
    .sidebar-overlay,
    .no-print,
    footer,
    hr {
        display: none !important;
    }

    .app-content {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .app-content-inner,
    .container,
    .container-fluid,
    .body-content {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .app-table-scroll,
    .table-responsive {
        overflow: visible !important;
        border: none !important;
    }

        .app-table-scroll > table,
        .table-responsive > table {
            width: 100% !important;
            min-width: 0 !important;
        }
}

/* =========================================================
   ENCABEZADO FIJO EN COMPUTADORA Y CELULAR
   ========================================================= */

.app-topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: var(--topbar-height);
    z-index: 1040;
}

/*
 * Como el encabezado está fijo, se reserva su altura
 * dentro del contenido principal.
 */
.app-content {
    padding-top: calc(var(--topbar-height) + 26px);
}

/*
 * La barra lateral permanece debajo del encabezado.
 */
.app-sidebar {
    top: var(--topbar-height);
    bottom: 0;
}

/*
 * En la pantalla de inicio de sesión no existe encabezado,
 * por lo que no se reserva su altura.
 */
.login-layout .app-content {
    padding-top: 26px;
}

/* Tabletas y celulares */
@media (max-width: 991.98px) {

    .app-content,
    body.sidebar-collapsed .app-content {
        padding-top: calc(var(--topbar-height) + 18px);
    }

    .login-layout .app-content {
        padding-top: 18px;
    }

    body.sidebar-open .sidebar-overlay {
        top: var(--topbar-height);
    }
}

/* Celulares pequeños */
@media (max-width: 575.98px) {

    .app-content,
    body.sidebar-collapsed .app-content {
        padding-top: calc(var(--topbar-height) + 14px);
    }

    .login-layout .app-content {
        padding-top: 14px;
    }
}

/* =========================================================
   HERRAMIENTAS, BÚSQUEDA Y PAGINACIÓN DE TABLAS
   ========================================================= */

.tabla-panel {
    width: 100%;
    min-width: 0;
}

.tabla-herramientas {
    width: 100%;
    margin-bottom: 14px;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 14px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 10px;
}

    .tabla-herramientas label {
        display: block;
        margin-bottom: 6px;
        font-weight: 600;
        color: #343a40;
    }

.tabla-busqueda {
    flex: 1 1 320px;
    max-width: 520px;
}

.tabla-busqueda-contenedor {
    position: relative;
}

    .tabla-busqueda-contenedor i {
        position: absolute;
        top: 50%;
        left: 12px;
        transform: translateY(-50%);
        color: #6c757d;
        pointer-events: none;
    }

    .tabla-busqueda-contenedor .form-control {
        width: 100%;
        padding-left: 38px;
    }

.tabla-cantidad-registros {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

    .tabla-cantidad-registros label {
        margin: 0;
    }

    .tabla-cantidad-registros .form-control {
        width: 90px;
        min-width: 90px;
    }

.tabla-paginacion-contenedor {
    width: 100%;
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.tabla-paginacion-resumen {
    color: #6c757d;
    font-size: .95rem;
}

.paginacion-tabla {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

    .paginacion-tabla li {
        margin: 0;
        padding: 0;
    }

        .paginacion-tabla li a,
        .paginacion-tabla li span {
            min-width: 38px;
            height: 38px;
            padding: 7px 11px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            color: #0d6efd;
            background: #ffffff;
            border: 1px solid #dee2e6;
            border-radius: 7px;
            text-decoration: none;
            cursor: pointer;
            transition: background-color .15s ease, border-color .15s ease, color .15s ease;
        }

            .paginacion-tabla li a:hover {
                color: #0a58ca;
                background: #e9ecef;
                border-color: #adb5bd;
                text-decoration: none;
            }

        .paginacion-tabla li.active a {
            color: #ffffff;
            background: #0d6efd;
            border-color: #0d6efd;
            font-weight: 600;
        }

        .paginacion-tabla li.disabled a {
            color: #adb5bd;
            background: #f8f9fa;
            border-color: #dee2e6;
            pointer-events: none;
            cursor: default;
        }

        .paginacion-tabla li.paginacion-puntos span {
            min-width: 28px;
            padding-left: 4px;
            padding-right: 4px;
            color: #6c757d;
            background: transparent;
            border-color: transparent;
            cursor: default;
        }

.acciones-tabla {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

@media (max-width: 767.98px) {

    .tabla-herramientas {
        align-items: stretch;
    }

    .tabla-busqueda {
        flex-basis: 100%;
        max-width: 100%;
    }

    .tabla-cantidad-registros {
        width: 100%;
    }

    .tabla-paginacion-contenedor {
        align-items: flex-start;
        flex-direction: column;
    }

    .paginacion-tabla {
        width: 100%;
    }
}

@media (max-width: 575.98px) {

    .tabla-herramientas {
        padding: 12px;
    }

    .tabla-cantidad-registros .form-control {
        width: 82px;
        min-width: 82px;
    }

    .paginacion-tabla li a,
    .paginacion-tabla li span {
        min-width: 34px;
        height: 34px;
        padding: 5px 8px;
        font-size: .9rem;
    }
}

/* =========================================================
   FORMULARIOS RESPONSIVOS
   ========================================================= */

.formulario-contenedor {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.formulario-tarjeta {
    width: 100%;
    padding: 26px;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, .06);
}

.formulario-seccion {
    margin-bottom: 28px;
}

    .formulario-seccion:last-of-type {
        margin-bottom: 0;
    }

.formulario-seccion-encabezado {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}

    .formulario-seccion-encabezado h4 {
        margin: 0 0 5px 0;
        font-size: 1.1rem;
        font-weight: 700;
        color: #212529;
    }

    .formulario-seccion-encabezado p {
        margin: 0;
        color: #6c757d;
        font-size: .92rem;
    }

.formulario-tarjeta .form-group {
    margin-bottom: 18px;
}

.formulario-tarjeta .control-label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    color: #343a40;
}

.formulario-tarjeta .form-control {
    width: 100%;
}

.formulario-ayuda {
    display: block;
    margin-top: 6px;
    color: #6c757d;
    font-size: .84rem;
}

.formulario-validacion {
    display: block;
    margin-top: 5px;
    font-size: .84rem;
}

.formulario-acciones {
    margin-top: 10px;
    padding-top: 20px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    border-top: 1px solid #e5e7eb;
}

/* Contraseña */

.password-campo-contenedor {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

    .password-campo-contenedor .form-control {
        flex: 1;
        min-width: 0;
    }

    .password-campo-contenedor .btn {
        flex-shrink: 0;
    }

.password-opciones {
    margin-top: 10px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.password-requisitos {
    margin: 12px 0 0 0;
    padding-left: 20px;
    color: #6c757d;
    font-size: .86rem;
}

    .password-requisitos li {
        margin-bottom: 3px;
    }

.password-fortaleza {
    margin-top: 12px;
}

.password-fortaleza-barra {
    width: 100%;
    height: 7px;
    background: #e9ecef;
    border-radius: 999px;
    overflow: hidden;
}

.password-fortaleza-progreso {
    width: 0;
    height: 100%;
    background: #adb5bd;
    border-radius: 999px;
    transition: width .2s ease, background-color .2s ease;
}

    .password-fortaleza-progreso.debil {
        width: 30%;
        background: #dc3545;
    }

    .password-fortaleza-progreso.media {
        width: 65%;
        background: #ffc107;
    }

    .password-fortaleza-progreso.fuerte {
        width: 100%;
        background: #198754;
    }

.password-fortaleza-texto {
    display: block;
    margin-top: 5px;
    color: #6c757d;
    font-size: .84rem;
}

/* Ajuste para pantallas medianas */

@media (max-width: 991.98px) {

    .formulario-tarjeta {
        padding: 22px;
    }
}

/* Ajuste para celulares */

@media (max-width: 575.98px) {

    .formulario-tarjeta {
        padding: 18px 14px;
        border-radius: 10px;
    }

    .formulario-seccion {
        margin-bottom: 22px;
    }

    .password-campo-contenedor {
        flex-wrap: wrap;
    }

        .password-campo-contenedor .form-control {
            flex-basis: 100%;
        }

        .password-campo-contenedor .btn {
            flex: 1;
        }

    .password-opciones {
        align-items: stretch;
        flex-direction: column;
    }

        .password-opciones .btn {
            width: 100%;
        }

    .formulario-acciones {
        align-items: stretch;
        flex-direction: column-reverse;
    }

        .formulario-acciones .btn {
            width: 100%;
        }
}