/* =====================================================================
 * RRHH Analytics — Estilos personalizados (app.css)
 *
 * Uso de Bootstrap 5 como base. Este CSS complementa el grid system
 * de Bootstrap con comportamientos responsivos específicos.
 * ===================================================================== */

/* ===================== */
/* ESTRUCTURA GENERAL    */
/* ===================== */

/* Body: flexbox column para sticky footer */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;

    
    font-family: "Montserrat", sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
}

/* Header: fixed, always visible on scroll */
header {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    height: 3.8rem !important;
    flex-shrink: 0;
    z-index: 1050;
}

/* Wrapper: push content below fixed header */
.main-wrapper {
    display: flex;
    flex: 1 1 auto;
    margin-top: 56px;
    overflow-x: hidden;
}


/* ===================== */
/* SIDEBAR (DESKTOP)     */
/* ===================== */

/* Sidebar base */
.sidebar {
    width: 250px;
    flex-shrink: 0;
    background-color: #212529;
}

/* Desktop: fixed, flush with header bottom */
@media (min-width: 768px) {
    .sidebar {
        position: fixed !important;
        top: 56px;
        left: 0;
        width: 250px;
        height: calc(100vh - 56px);
        overflow-y: auto;
        z-index: 1000;
    }

    /* Make room for the fixed sidebar */
    .main-content {
        margin-left: 250px;
    }

    /* Hide backdrop and hamburger on desktop */
    .backdrop {
        display: none !important;
    }

    #sidebar-toggle {
        display: none !important;
    }
}

/* ===================== */
/* SIDEBAR (MOBILE)      */
/* ===================== */

@media (max-width: 767.98px) {
    /* Mobile sidebar: overlay, uses dvh to auto-adjust to browser UI */
    .sidebar {
        position: fixed !important;
        top: 56px;
        left: 0;
        width: 250px;
        height: calc(100dvh - 56px);
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        z-index: 1030;
        overflow-y: auto;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    /* Lock body scroll when sidebar is open */
    body.sidebar-open {
        overflow: hidden;
    }

    /* Backdrop */
    .backdrop {
        height: calc(100dvh - 56px);
    }

    /* Bottom padding for browser nav bar / safe area */
    .sidebar .sidebar-user-mobile {
        padding-bottom: calc(env(safe-area-inset-bottom, 0) + 48px);
    }
}

/* ===================== */
/* BACKDROP (MOBILE)      */
/* ===================== */

.backdrop {
    display: none;
}

@media (max-width: 767.98px) {
    .backdrop {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        width: 100%;
        height: calc(100dvh - 56px);
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1020;
    }

    .backdrop.show {
        display: block;
    }
}

/* ===================== */
/* CONTENIDO PRINCIPAL   */
/* ===================== */

.main-content {
    flex: 1 1 auto;
    min-width: 0;
    overflow-y: auto;
}

/* ===================== */
/* FOOTER                 */
/* ===================== */

footer {
    flex-shrink: 0;
    width: 100%;
}

/* Desktop: align footer with main-content (skip fixed sidebar) */
@media (min-width: 768px) {
    footer {
        margin-left: 250px;
    }
}

/* ===================== */
/* SIDEBAR LINKS          */
/* ===================== */

/* Inner scrollable area — only scroll menu, not user block */
.sidebar .sidebar-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
}

.sidebar .nav-link {
    color: #adb5bd !important;
    padding: 0.5rem 1rem;
    border-radius: 0;
    white-space: nowrap;
}

.sidebar .nav-link:hover {
    color: #ffffff !important;
    background-color: #495057;
}

.sidebar .nav-link.active {
    color: #ffffff !important;
    background-color: #0d6efd;
}

/* ===================== */
/* COMPONENTES EXISTENTES */
/* ===================== */

.alert-dismissible {
    min-width: 300px;
}

/* Semáforo de riesgo */
.semaphore-verde { background-color: #d1e7dd !important; color: #15521e !important; }
.semaphore-amarillo { background-color: #fff3cd !important; color: #664d03 !important; }
.semaphore-rojo { background-color: #f8d7da !important; color: #7a1f23 !important; }

.qr-code-img { max-width: 150px; max-height: 150px; }

.kpi-card { transition: transform 0.2s; }
.kpi-card:hover { transform: translateY(-3px); }

/* ===================== */
/* PANEL DE PERMISOS     */
/* ===================== */

/* Resaltar filas con permisos pendientes */
.table-warning {
    background-color: rgba(255, 193, 7, 0.1) !important;
}

/* Badge de estado en tabla de permisos */
.permiso-estado-badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
}

/* Alerta de solicitud de información */
.req-info-alert {
    border-left: 4px solid #0dcaf0;
}

/* Badge de tipo de permiso */
.permiso-tipo-badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
    white-space: nowrap;
}

/* Preview de imagen de documento adjunto */
#image-preview {
    max-width: 200px;
    max-height: 200px;
    object-fit: cover;
    border: 1px dashed #ced4da;
}

#preview-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ===================== */
/* COMPROBANTE IMPRIMIBLE  */
/* ===================== */

.comprobante {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.comprobante-header h3 {
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 10px;
}

.comprobante table th {
    color: #6c757d;
    font-weight: 600;
}

@media print {
    .comprobante {
        padding: 0;
    }

    .comprobante-header h3 {
        border-bottom: 1px solid #dee2e6;
    }
}

#toast-container {
    max-width: 400px;
}

.toast .toast-body {
    font-size: 0.9rem;
}

/* Comprobante printable: URL wrapping */
.word-break {
    word-break: break-all;
    word-wrap: break-word;
}

/* Modo impresión: elementos del sistema que nunca deben imprimirse */
@media print {
    header,
    .sidebar,
    #sidebar-toggle,
    footer,
    .backdrop,
    .no-print,
    .d-print-none {
        display: none !important;
    }

    body {
        margin: 0;
        background: white;
    }

    @page {
        margin: 0.5cm;
        size: auto;
    }

    .carnet-container {
        max-width: 500px;
        margin: 0 auto;
    }
}


/* .bg-primary {
    background-color: #02B1A2 !important;
}

.bg-dark {
    background-color: #042E57 !important;
}