/* === MAIN STYLESHEET FOR SUITE EMPRESARIAL === */

/* --- General & Utility Styles --- */
body { 
    font-family: 'Inter', sans-serif; 
    overflow-x: hidden;
}
.transition-all { 
    transition: all 0.3s ease-in-out; 
}
button:disabled { 
    opacity: 0.5; 
    cursor: not-allowed; 
}

/* --- Sidebar & Main Content Wrapper (REVISED FOR RESPONSIVENESS) --- */
#sidebar { 
    width: 16rem; 
    transform: translateX(-100%); 
    transition: transform 0.3s ease-in-out;
}
#sidebar.expanded { 
    transform: translateX(0); 
}
#sidebar .sidebar-text {
    opacity: 1; 
    margin-left: 0.75rem;
    white-space: nowrap; 
}
#main-content-wrapper { 
    transition: margin-left 0.3s ease-in-out; 
    margin-left: 0; 
}
@media (min-width: 768px) {
    #sidebar { 
        width: 5rem; 
        transform: translateX(0); 
        transition: width 0.3s ease-in-out; 
    }
    #sidebar.expanded { 
        width: 16rem; 
    }
    #sidebar .sidebar-text {
        opacity: 0; 
        width: 0; 
        transition: opacity 0.2s ease, width 0.2s ease;
        overflow: hidden;
    }
    #sidebar.expanded .sidebar-text { 
        opacity: 1; 
        width: auto; 
    }
    #main-content-wrapper { 
        margin-left: 5rem; 
    }
    #sidebar.expanded ~ #main-content-wrapper { 
        margin-left: 16rem; 
    }
}

/* --- Theme Toggle Switch --- */
#theme-toggle {
    position: relative; 
    width: 52px; 
    height: 28px; 
    border-radius: 9999px;
    background-color: #e2e8f0; 
    transition: background-color 0.3s ease-in-out;
    cursor: pointer; 
    border: none; 
    padding: 0; 
    display: flex; 
    align-items: center;
}
.dark #theme-toggle { 
    background-color: #3b82f6; 
}
#theme-toggle-circle {
    position: absolute; 
    top: 2px; 
    left: 2px; 
    width: 24px; 
    height: 24px;
    background-color: white; 
    border-radius: 9999px;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    transform: translateX(0); 
    transition: transform 0.3s ease-in-out;
}
.dark #theme-toggle-circle { 
    transform: translateX(24px); 
}

/* **NUEVA REGLA PARA OCULTAR BOTÓN EN MÓVIL** */
@media (max-width: 767px) {
    #main-content-wrapper header #theme-toggle {
        display: none;
    }
}

/* --- Modals, Toasts & Tabs --- */
.modal-backdrop { 
    background-color: rgba(0, 0, 0, 0.5); 
}
.toast { 
    position: fixed; 
    top: 5rem; 
    right: 1.5rem; 
    transform: translateX(200%); 
    transition: transform 0.5s ease-in-out; 
    z-index: 1000; 
}
.toast.show { 
    transform: translateX(0); 
}
.tab-btn {
    white-space: nowrap; 
    padding: 0.75rem 1.25rem; 
    border-bottom: 3px solid transparent; 
    font-weight: 500; 
}
.tab-btn.active { 
    border-color: #2563eb; 
    color: #2563eb; 
    background-color: #eff6ff; 
}
.dark .tab-btn.active { 
    background-color: #1e3a8a; 
    color: #bfdbfe; 
    border-color: #3b82f6;
}

/* --- Module-Specific Styles --- */
.kpi-card:hover { 
    transform: translateY(-4px); 
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); 
}
.dark .kpi-card:hover { 
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2); 
}
.filter-btn.active { 
    background-color: #2563eb; 
    color: white; 
}
.sortable { 
    cursor: pointer; 
    user-select: none; 
}

/* === REGLAS RESPONSIVE PARA PANELES === */
.panel-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}
.panel-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
}
.pagination-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

/* A partir de 640px (sm) los controles se ponen en fila */
@media (min-width: 640px) {
    .panel-header {
        flex-direction: row;
        justify-content: space-between;
    }
    .panel-controls {
        flex-direction: row;
        width: auto;
    }
    .pagination-controls {
        flex-direction: row;
        justify-content: space-between;
    }
}