/* Custom CSS para el sistema de control de acceso - SOLUCIÓN DEFINITIVA */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
}

/* Estructura principal - CORREGIDO */
html, body {
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Navbar fixed */
.navbar-fixed-top {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1030;
    height: 56px;
}

/* Contenedor principal - CORREGIDO */
.main-container {
    display: flex;
    flex-direction: row;
    flex-grow: 1;
    margin-top: 56px; /* Altura del navbar */
    min-height: calc(100vh - 56px);
    width: 100%;
}

/* Sidebar - CORREGIDO DEFINITIVAMENTE */
.sidebar {
    width: 250px;
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
    padding: 20px 0;
    overflow-y: auto;
    height: calc(100vh - 56px);
    position: fixed;
    z-index: 100;
    transition: transform 0.3s ease;
}

/* Contenido principal - CORREGIDO DEFINITIVAMENTE */
.main-content {
    flex: 1;
    padding: 20px;
    margin-left: 250px;
    min-height: calc(100vh - 156px);
    width: calc(100% - 250px);
    transition: margin-left 0.3s ease;
}

/* Footer - CORREGIDO DEFINITIVAMENTE */
.footer {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 1rem 0;
    margin-top: auto;
    width: 100%;
    position: relative;
    z-index: 101;
    margin-left: 0;
}

/* Aseguramos que el footer esté debajo del contenido */
body > .container-fluid {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 56px);
}

/* Estilos para el contenido dentro del main */
.content-wrapper {
    flex: 1;
}

/* Navbar brand */
.navbar-brand {
    font-weight: 700;
}

/* Sidebar navigation */
.sidebar .nav-link {
    color: #333;
    padding: 10px 15px;
    border-radius: 5px;
    margin: 5px 10px;
    transition: all 0.3s;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background-color: #0d6efd;
    color: white;
}

/* Card enhancements */
.card {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    font-weight: 600;
}

/* Dashboard stats */
.stat-card {
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Responsive adjustments - MEJORADO */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 3px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }
    
    .overlay.show {
        display: block;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 15px;
    }
    
    .stat-card .display-6 {
        font-size: 1.8rem;
    }
}

/* Botón para toggle del sidebar en móviles */
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 102;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #0d6efd;
    color: white;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

@media (max-width: 992px) {
    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Estilos para mejorar la responsividad */
.table-responsive {
    max-width: 100%;
    overflow-x: auto;
}

/* Asegurar que las tablas no excedan el ancho */
.table {
    width: 100% !important;
    max-width: 100%;
}

/* Mejorar visualización en móviles */
@media (max-width: 768px) {
    .footer .col-md-6 {
        text-align: center !important;
        margin-bottom: 0.5rem;
    }
    
    .footer .text-muted {
        font-size: 0.8rem;
    }
}

/* Evitar desbordamiento horizontal */
body {
    overflow-x: hidden;
}