/* ===== Menú lateral Glassmorphism - diseño premium ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --sidebar-width: 270px;
    --glass-bg: rgba(255, 255, 255, 0.78);
    --glass-border: rgba(255, 255, 255, 0.55);
    --glass-highlight: rgba(255, 255, 255, 0.95);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;
    --accent: #1e3a5f;
    --accent-light: rgba(30,58,95, 0.10);
    --accent-medium: rgba(30,58,95, 0.18);
    --accent-glow: rgba(30,58,95, 0.35);
    --fondo: #eef1f7;
    --sombra: 0 8px 32px rgba(30, 58, 95, 0.12);
    --sombra-intensa: 0 12px 40px rgba(30, 58, 95, 0.18);
    --radio: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--fondo);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(30,58,95,0.08) 0%, transparent 25%),
        radial-gradient(circle at 90% 80%, rgba(244,162,97,0.07) 0%, transparent 25%);
    background-attachment: fixed;
    display: flex;
    min-height: 100vh;
    color: var(--text-main);
}

/* ===== SIDEBAR GLASS ===== */
.sidebar {
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    background: var(--glass-bg);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-right: 1px solid var(--glass-border);
    box-shadow: var(--sombra);
    overflow: hidden;
}

/* Reflejo sutil superior */
.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.5) 0%, transparent 100%);
    pointer-events: none;
}

/* Logo / Encabezado */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 26px 20px 22px;
    position: relative;
    z-index: 2;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.logo-icono {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    object-fit: contain;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    padding: 5px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.logo-icono:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.1);
}

.logo-icono:not(.logo-empresa) {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: #1e3a5f;
}

.sidebar-logo h1 {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.4px;
    line-height: 1.2;
}

.sidebar-logo p {
    font-size: 10.5px;
    color: var(--text-muted);
    margin-top: 3px;
    letter-spacing: 0.4px;
    font-weight: 500;
}

/* Navegación */
.sidebar-nav {
    flex: 1;
    padding: 18px 14px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(15,23,42,0.12) transparent;
    position: relative;
    z-index: 2;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radio);
    margin-bottom: 4px;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 1px solid transparent;
}

.nav-item:hover {
    background: var(--glass-highlight);
    color: var(--accent);
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    border-color: rgba(255,255,255,0.8);
    transform: translateX(2px);
}

.nav-item.activo {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
    border: 1px solid var(--accent-medium);
    box-shadow: 0 0 20px var(--accent-glow);
}

.nav-item.activo::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 22px;
    background: var(--accent);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px var(--accent-glow);
}

.nav-icono {
    font-size: 16px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.85;
    transition: transform 0.25s;
}

.nav-item:hover .nav-icono,
.nav-item.activo .nav-icono {
    opacity: 1;
    transform: scale(1.08);
}

/* ===== Grupos y subgrupos colapsables ===== */
.nav-grupo,
.nav-subgrupo {
    margin-bottom: 4px;
}

.nav-grupo-header,
.nav-subgrupo-titulo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    cursor: pointer;
    list-style: none;
    border-radius: var(--radio);
    border: 1px solid transparent;
    user-select: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-grupo-header {
    padding: 11px 14px;
    font-size: 13.5px;
    font-weight: 600;
}

.nav-subgrupo-titulo {
    padding: 9px 12px 9px 22px;
    font-size: 12.5px;
    font-weight: 600;
    margin-left: 8px;
}

.nav-grupo-header::-webkit-details-marker,
.nav-subgrupo-titulo::-webkit-details-marker { display: none; }

.nav-grupo-header:hover,
.nav-subgrupo-titulo:hover {
    background: var(--glass-highlight);
    color: var(--accent);
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    border-color: rgba(255,255,255,0.8);
}

.nav-colapsable[open] > summary {
    color: var(--accent);
}

.nav-flecha {
    margin-left: auto;
    font-size: 11px;
    opacity: 0.55;
    transition: transform 0.25s ease, opacity 0.2s;
}

summary:hover .nav-flecha,
.nav-colapsable[open] > summary .nav-flecha {
    opacity: 1;
}

.nav-colapsable[open] > summary .nav-flecha {
    transform: rotate(90deg);
}

.nav-subgrupo .nav-item {
    padding: 8px 12px 8px 26px;
    font-size: 12.5px;
    margin-left: 10px;
    margin-bottom: 2px;
    border-left: 2px solid rgba(30,58,95,0.08);
    border-radius: 0 var(--radio) var(--radio) 0;
}

.nav-subgrupo .nav-item.activo {
    border-left-color: var(--accent);
}

.nav-subgrupo .nav-item.activo::before {
    display: none;
}

.nav-subgrupo .nav-icono {
    font-size: 14px;
    width: 20px;
}

/* Footer del sidebar */
.sidebar-footer {
    padding: 14px 14px 18px;
    border-top: 1px solid rgba(0,0,0,0.05);
    background: rgba(255,255,255,0.35);
    position: relative;
    z-index: 2;
    backdrop-filter: blur(8px);
}

.usuario-info {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 14px;
    padding: 10px;
    background: rgba(255,255,255,0.55);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.7);
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}

.usuario-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(30,58,95,0.9), rgba(224,118,46,0.9));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px var(--accent-glow);
    border: 1px solid rgba(255,255,255,0.35);
}

.usuario-datos { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.usuario-datos strong {
    font-size: 13px;
    color: var(--text-main);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.usuario-datos small {
    font-size: 10.5px;
    color: var(--text-muted);
    margin-top: 1px;
}

.btn-salir {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: rgba(239,68,68,0.08);
    color: #dc2626;
    text-decoration: none;
    padding: 9px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid rgba(239,68,68,0.15);
    transition: all 0.2s;
    cursor: pointer;
    width: 100%;
    font-family: inherit;
}

.btn-salir:hover {
    background: rgba(239,68,68,0.14);
    border-color: rgba(239,68,68,0.25);
    color: #b91c1c;
    box-shadow: 0 2px 8px rgba(239,68,68,0.08);
}

.enlace-privacidad {
    display: block;
    text-align: center;
    color: var(--text-subtle);
    font-size: 10px;
    margin-top: 10px;
    text-decoration: none;
    transition: color 0.2s;
}
.enlace-privacidad:hover { color: var(--accent); }

/* Botón hamburguesa (móvil) */
.menu-movil {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 200;
    background: var(--glass-bg);
    color: var(--accent);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    width: 42px;
    height: 42px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: var(--sombra);
    backdrop-filter: blur(12px);
    transition: all 0.2s;
}

.menu-movil:hover {
    background: var(--glass-highlight);
    box-shadow: var(--sombra-intensa);
}

/* Overlay móvil */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.25);
    z-index: 99;
    backdrop-filter: blur(6px);
}

/* ===== CONTENIDO PRINCIPAL ===== */
.contenido {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 32px 36px;
    min-height: 100vh;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .contenido { padding: 24px 24px; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
        box-shadow: var(--sombra-intensa);
    }
    .sidebar.abierto { transform: translateX(0); }
    .sidebar-overlay.visible { display: block; }
    .menu-movil { display: flex; align-items: center; justify-content: center; }
    .contenido { margin-left: 0; padding: 70px 16px 24px; }
}
