:root {
    --primary-color: #0f172a;
    /* Azul oscuro elegante */
    --secondary-color: #a92c2c;
    /* Rojo institucional (heredado) */
    --accent-color: #3b82f6;
    /* Azul brillante para acciones */
    --bg-color: #f1f5f9;
    /* Gris muy claro para fondos */
    --text-color: #334155;
    /* Gris oscuro para texto */
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.85rem;
}

/* --- LOGIN STYLES --- */
.login-container {
    background-color: var(--white);
    padding: 2.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-header {
    /* margin-bottom: 2rem; */
    margin-bottom: 1.5rem;
}

.login-header img {
    max-width: 180px;
    /* margin-bottom: 0.85rem; */
    margin-bottom: 1.2rem;
}

.login-header h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 600;
}

.form-group {
    margin-bottom: 1.2rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-login {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: 1rem;
}

.btn-login:hover {
    background-color: #1e293b;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    border: 1px solid #fca5a5;
}

.footer-login {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: #94a3b8;
}


/* --- LAYOUT PRINCIPAL --- */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--white);
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    z-index: 100;
}

.sidebar-header {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.logo-img {
    width: 185px;
    /* height: 32px; Ajustar según tu logo */
}

.btn-close-sidebar {
    display: none;
    /* Solo visible en móvil */
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background-color: #f8fafc;
    color: var(--accent-color);
    border-right: 3px solid var(--accent-color);
}

.section-title {
    padding: 1.5rem 1.5rem 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* Colores especiales (Legacy features) */
.highlight-pink {
    color: #d946ef !important;
    font-weight: 600;
}

.highlight-green {
    color: #22c55e !important;
    font-weight: 600;
}

.highlight-blue {
    color: #3b82f6 !important;
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #f8fafc;
    overflow: hidden;
}

.top-header {
    height: 64px;
    background-color: var(--white);
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.btn-hamburger {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    margin-right: 1rem;
    color: var(--text-color);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    display: inline-block;
}

.content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

/* User Profile in Header */
.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar-circle {
    width: 35px;
    height: 35px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
}

.badge {
    background-color: #e2e8f0;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        height: 100%;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
    }

    .sidebar.open {
        left: 0;
    }

    .btn-close-sidebar {
        display: block;
        background: none;
        border: none;
        font-size: 1.5rem;
        margin-left: auto;
        cursor: pointer;
    }
}



/* PARA SIDEBAR */

/* =========================================
   SIDEBAR ACORDEÓN MEJORADO (Module System)
   ========================================= */

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-module {
    border-bottom: 1px solid #f1f5f9;
    /* Línea sutil separadora */
}

/* Estilo del botón cabecera del módulo */
.module-header {
    width: 100%;
    padding: 16px 24px;
    background: transparent;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    text-align: left;
    color: #64748b;
    /* Gris texto suave */
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    outline: none;
}

.module-header:hover {
    background-color: #f8fafc;
    color: var(--primary-color);
}

/* Estilo activo del header (cuando está abierto) */
.module-header.active {
    color: var(--accent-color);
    /* Azul corporativo */
    background-color: #eff6ff;
    /* Fondo azul muy claro */
}

/* Flechita con animación */
.module-header .arrow {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    /* Rotación suave */
}

/* Rotar flecha cuando está activo */
.module-header.active .arrow {
    transform: rotate(180deg);
}

/* Contenedor del contenido (Links) */
.module-content {
    /* Oculto por defecto */
    display: none;
    background-color: #ffffff;
}

/* Cuando tiene la clase open, se muestra */
.module-content.open {
    display: block;
    /* Opcional: Si quieres animación, requeriría max-height, pero display:block es más seguro para tu checkbox */
}

.module-content ul {
    list-style: none;
    padding: 5px 0;
    margin: 0;
}

/* Estilos de los links internos */
.module-content a {
    display: block;
    padding: 10px 24px 10px 35px !important;
    /* Indentación para jerarquía */
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem !important;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.module-content a:hover {
    background-color: #f8fafc;
    color: var(--accent-color);
}

.module-content a.active {
    background-color: #f1f5f9;
    color: var(--accent-color);
    border-left-color: var(--accent-color);
    font-weight: 600;
}

/* Enlaces sueltos (Dashboard, Cerrar sesión) */
.nav-link-single {
    display: block;
    padding: 14px 24px;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-link-single:hover,
.nav-link-single.active {
    background-color: #f8fafc;
    color: var(--accent-color);
    border-left-color: var(--accent-color);
}

.nav-link-single .icon {
    margin-right: 10px;
    display: inline-block;
    width: 20px;
    text-align: center;
}






/* =======================================================
   SISTEMA DE COLAPSO DE SIDEBAR (ESCRITORIO)
   ======================================================= */
@media (min-width: 769px) {

    /* 1. ESTADO NORMAL (ABIERTO) */
    .sidebar {
        width: 250px;
        left: 0;
        top: 0;
        bottom: 0;
        position: fixed;
        transition: transform 0.3s ease;
        /* Animación suave */
        z-index: 1000;
        /* Aseguramos que se vea */
        transform: translateX(0);
    }

    /* El contenido y el header respetan el espacio del sidebar */
    .main-content {
        width: calc(100% - 250px);
        margin-left: 250px;
        /* Empujado a la derecha */
        transition: margin-left 0.3s ease, width 0.3s ease;
    }

    /* 2. ESTADO COLAPSADO (CUANDO DAS CLICK A LA HAMBURGUESA) */
    body.sidebar-collapsed .sidebar {
        /* Se mueve 250px a la izquierda, desapareciendo completamente */
        transform: translateX(-250px);
    }

    /* El contenido y el header se expanden para ocupar todo */
    body.sidebar-collapsed .main-content,
    body.sidebar-collapsed header.top-header {
        width: 100%;
        margin-left: 0;
    }

    body{
        padding: 0;
    }

    /* Ajuste para que el botón hamburguesa no se mueva */
    header.top-header .header-left {
        display: flex;
        align-items: center;
        gap: 15px;
    }
}

/* 
.bglogin{
    background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
} */