/* ============================================
   SIDEBAR — Navegacion lateral
   ============================================ */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 1.25rem 1.25rem 1rem;
    background: #263548;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

.sidebar-logo-icono {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-logo-texto {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #f0f0f5;
}

/* --- Nav items --- */
.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.sidebar-section {
    padding: 0.5rem 0.75rem;
    margin-top: 0.5rem;
}

.sidebar-section-title {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.35);
    padding: 0 0.5rem;
    margin-bottom: 0.35rem;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0.85rem;
    margin: 0.1rem 0.75rem;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid transparent;
}

.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sidebar-item.activo {
    background: rgba(250, 204, 21, 0.15);
    color: #fbbf24;
    border-color: rgba(250, 204, 21, 0.25);
}

.sidebar-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-item.activo svg {
    opacity: 1;
}

/* --- Footer del sidebar --- */
.sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem;
    border-radius: 8px;
    margin-bottom: 0.35rem;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sidebar-user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.sidebar-user-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #facc15;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #0f172a;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.5rem 0.65rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.82rem;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-logout:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
    border-color: rgba(248, 113, 113, 0.15);
}

/* --- Main content con sidebar --- */
.main-con-sidebar {
    margin-left: 240px;
    flex: 1;
    min-height: 100vh;
    background: #ffffff;
}

/* --- Mobile toggle --- */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 60;
    width: 40px;
    height: 40px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    color: #0f172a;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.sidebar-toggle:hover {
    border-color: #3b82f6;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.abierto {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: flex;
    }

    .sidebar-overlay.visible {
        display: block;
    }

    .main-con-sidebar {
        margin-left: 0;
    }
}
