/* Scrollable Div para Tablas Responsivas */
.scrollable-div {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #6c757d #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
}

.scrollable-div::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.scrollable-div::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 4px;
}

.scrollable-div::-webkit-scrollbar-thumb {
    background: #6c757d;
    border-radius: 4px;
}

.scrollable-div::-webkit-scrollbar-thumb:hover {
    background: #495057;
}

/* Asegurar que las tablas dentro de scrollable-div tengan scroll horizontal */
.scrollable-div table {
    min-width: 100%;
    white-space: nowrap;
}

/* Responsive Table Container */
.table-responsive-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Asegurar que las tablas mantengan su ancho mínimo */
.table-responsive-container table {
    min-width: 600px;
    width: 100%;
}

/* Media queries para dispositivos móviles */
@media (max-width: 768px) {
    .scrollable-div {
        margin-bottom: 1rem;
    }
    
    .table-responsive-container {
        border-radius: 0.375rem;
        box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    }
}

@media (max-width: 576px) {
    .scrollable-div {
        margin-bottom: 0.5rem;
    }
}

/* Mobile Sidebar Enhancements */
@media (max-width: 991.98px) {
    body.sidebar-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background-color: #343a40 !important;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        background-color: rgba(0, 0, 0, 0.3) !important;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    
    /* Improve sidebar navigation on mobile */
    .sidebar .nav-link {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        border-radius: 0.5rem;
        margin: 0.25rem 0.5rem;
        transition: all 0.2s ease;
        position: relative;
        z-index: 1051;
        color: #ffffff !important;
        background-color: transparent !important;
        border: none !important;
    }
    
    .sidebar .nav-link:hover {
        background-color: rgba(255, 255, 255, 0.1) !important;
        transform: translateX(5px);
        color: #ffffff !important;
    }
    
    .sidebar .nav-link.active {
        background-color: rgba(255, 255, 255, 0.2) !important;
        border-left: 3px solid #fff !important;
        color: #ffffff !important;
    }
    
    /* Sidebar toggle button animation */
    #sidebarToggle {
        transition: all 0.3s ease;
    }
    
    #sidebarToggle:hover {
        transform: scale(1.1);
    }
    
    #sidebarToggle:active {
        transform: scale(0.95);
    }
    
    /* Prevenir que los elementos del sidebar se cierren */
    .sidebar * {
        pointer-events: auto !important;
    }
    
    .sidebar .nav-item {
        position: relative;
        z-index: 1051;
    }
    
    .sidebar .sidebar-heading {
        position: relative;
        z-index: 1051;
        color: #6c757d !important;
    }
    
    /* PREVENIR que el sidebar se cierre pero permitir que los botones funcionen */
    .sidebar.show {
        pointer-events: auto !important;
        z-index: 1050 !important;
    }
    
    .sidebar.show * {
        pointer-events: auto !important;
        z-index: 1051 !important;
    }
    
    .sidebar .nav-link {
        pointer-events: auto !important;
        cursor: pointer !important;
        color: #ffffff !important;
        background-color: transparent !important;
        border: none !important;
        text-decoration: none !important;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }
    
    .sidebar .nav-link:hover {
        pointer-events: auto !important;
        background-color: rgba(255, 255, 255, 0.1) !important;
        color: #ffffff !important;
        text-decoration: none !important;
        transform: translateX(5px);
    }
    
    .sidebar .nav-link:active {
        pointer-events: auto !important;
        background-color: rgba(255, 255, 255, 0.2) !important;
        color: #ffffff !important;
    }
    
    .sidebar .nav-link:focus {
        pointer-events: auto !important;
        background-color: rgba(255, 255, 255, 0.15) !important;
        color: #ffffff !important;
        outline: none !important;
        box-shadow: none !important;
    }
    
    /* Prevenir cualquier comportamiento de cierre automático */
    .sidebar.show .nav-link:active,
    .sidebar.show .nav-link:focus,
    .sidebar.show .nav-link:hover {
        pointer-events: auto !important;
    }
}

/* Smooth transitions for all interactive elements */
.sidebar * {
    transition: all 0.2s ease;
}

/* Ensure proper z-index stacking */
.sidebar {
    z-index: 1050;
}

.sidebar-overlay {
    z-index: 1040;
}

.navbar {
    z-index: 1030;
}

/* PREVENIR GLOBALMENTE que el sidebar se cierre */
body.sidebar-open .sidebar {
    pointer-events: auto !important;
}

body.sidebar-open .sidebar * {
    pointer-events: auto !important;
}

/* Asegurar que los enlaces del sidebar funcionen correctamente */
.sidebar .nav-link {
    display: block !important;
    width: 100% !important;
    text-decoration: none !important;
    color: #ffffff !important;
    background-color: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.sidebar .nav-link:hover {
    text-decoration: none !important;
    color: #ffffff !important;
}

.sidebar .nav-link:visited {
    text-decoration: none !important;
    color: #ffffff !important;
}

.sidebar .nav-link:active {
    text-decoration: none !important;
    color: #ffffff !important;
}

/* Asegurar que el sidebar móvil funcione correctamente */
@media (max-width: 991.98px) {
    .sidebar.show {
        pointer-events: auto !important;
        z-index: 1050 !important;
    }
    
    .sidebar.show * {
        pointer-events: auto !important;
        z-index: 1051 !important;
    }
    
    /* Prevenir cualquier comportamiento de cierre automático */
    .sidebar.show .nav-link:active,
    .sidebar.show .nav-link:focus,
    .sidebar.show .nav-link:hover {
        pointer-events: auto !important;
    }
    
    /* Asegurar que todos los elementos del sidebar sean clickeables */
    .sidebar.show .nav-link,
    .sidebar.show .nav-item,
    .sidebar.show .sidebar-heading,
    .sidebar.show .border-top,
    .sidebar.show .position-sticky {
        pointer-events: auto !important;
        z-index: 1051 !important;
    }
    
    /* Asegurar que los enlaces sean completamente funcionales */
    .sidebar.show .nav-link {
        cursor: pointer !important;
        pointer-events: auto !important;
        user-select: none !important;
        -webkit-user-select: none !important;
        -moz-user-select: none !important;
        -ms-user-select: none !important;
    }
    
    .sidebar.show .nav-link:active {
        pointer-events: auto !important;
        cursor: pointer !important;
    }
    
    .sidebar.show .nav-link:focus {
        pointer-events: auto !important;
        cursor: pointer !important;
    }
}

/* Mejoras adicionales para el sidebar móvil */
@media (max-width: 991.98px) {
    /* Prevenir scroll horizontal */
    .sidebar {
        overflow-x: hidden;
        overflow-y: auto;
    }
    
    /* Mejorar la apariencia de los elementos del sidebar */
    .sidebar .nav-item {
        margin-bottom: 0.25rem;
    }
    
    .sidebar .sidebar-heading {
        font-size: 0.875rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-top: 1.5rem;
        margin-bottom: 0.75rem;
    }
    
    /* Mejorar el footer del sidebar */
    .sidebar .border-top {
        border-color: rgba(255, 255, 255, 0.2) !important;
        margin-top: 2rem;
        padding-top: 1rem;
    }
    
    /* Prevenir que el contenido se desborde */
    .sidebar .position-sticky {
        height: 100vh;
        overflow-y: auto;
        padding-bottom: 2rem;
    }
    
    /* Mejorar la transición del overlay */
    .sidebar-overlay {
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    /* Prevenir que el sidebar se cierre accidentalmente */
    .sidebar.show {
        pointer-events: auto;
    }
    
    .sidebar.show * {
        pointer-events: auto;
    }
} 