/* ══════════════════════════════════════════════
 * SIDEBAR — Menú lateral principal
 * Paleta: --primary-dark como fondo (navy #243A5E)
 * ══════════════════════════════════════════════ */

/* ── Contenedor principal ── */
#sidebar {
    width: var(--sidebar-width);
    background-color: var(--primary-dark);
    color: var(--color-sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width var(--transition-speed) ease;
    overflow: hidden;
    box-shadow: 2px 0 12px rgba(36, 58, 94, 0.25);
}

/* ── Logo / cabecera ── */
.sidebar-logo {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 16px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Ícono de marca cuadrado */
.sidebar-brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border-radius: 8px;
    color: #ffffff;
    flex-shrink: 0;
}

.sidebar-brand-icon svg {
    width: 15px;
    height: 15px;
    stroke-width: 2;
}

.logo-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: hidden;
}

/* ── Navegación ── */
#sidebar-nav {
    flex: 1;
    padding: 10px 10px;
    overflow-y: auto;
    overflow-x: hidden;
}

#sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#sidebar-nav li {
    display: block;
}

#sidebar-nav li.hidden {
    display: none;
}

/* ── Enlace base ── */
#sidebar-nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    color: var(--color-sidebar-text);
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    transition:
        background-color var(--transition-speed),
        color var(--transition-speed),
        transform var(--transition-speed);
}

/* ── Wrapper del ícono ── */
.nav-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--pastel-blue-3);
    transition: color var(--transition-speed);
}

.nav-icon {
    width: 17px;
    height: 17px;
    stroke-width: 1.8;
}

.nav-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Hover ── */
#sidebar-nav a:hover {
    background-color: rgba(255, 255, 255, 0.07);
    color: #ffffff;
    transform: translateX(2px);
}

#sidebar-nav a:hover .nav-icon-wrapper {
    color: var(--accent-light);
}

/* ── Estado activo ── */
#sidebar-nav a.active {
    background-color: rgba(72, 147, 198, 0.18);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 1px 6px rgba(72, 147, 198, 0.14);
    transform: none;
}

/* Línea vertical de acento en el borde izquierdo */
#sidebar-nav a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 58%;
    background: var(--accent-strong);
    border-radius: 0 3px 3px 0;
}

#sidebar-nav a.active .nav-icon-wrapper {
    color: var(--accent-strong);
}

/* ── Focus visible (teclado) ── */
#sidebar-nav a:focus-visible {
    outline: 2px solid var(--accent-light);
    outline-offset: 2px;
}

/* ── Estado colapsado (desktop) ── */
#sidebar.collapsed {
    width: 0;
}


/* ── Logo al pie del sidebar ── */
.sidebar-brand-footer {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-footer-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.78rem;
    font-weight: 500;
    color: rgba(255,255,255,0.65);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.sidebar-logout-btn {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.75rem;
    font-family: inherit;
    font-weight: 500;
    color: rgba(255,255,255,0.55);
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius);
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sidebar-logout-btn:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.9);
    border-color: rgba(255,255,255,0.3);
}

.sidebar-brand-logo {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.sidebar-brand-footer:hover .sidebar-brand-logo {
    stroke: rgba(255,255,255,0.9);
}
