﻿/* --- Sidebar fijo a la izquierda --- */
.sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    height: 100vh !important;
    width: 12rem;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid rgba(200, 200, 200, 0.4);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    z-index: 900;
    transition: width 0.3s ease;
    padding-top: 0.8rem;
}

    .sidebar.collapsed {
        width: 4.375rem !important;
        overflow-x: hidden;
    }

.navbar-nav-menu {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    padding: 0;
    margin: 0;
    gap: 0.2rem;
}

.nav-item-menu {
    display: block;
    width: 100%;
    line-height: 1.2;
}

.nav-link-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #1a1a2e !important;
    font-weight: 600;
    text-decoration: none;
    padding: 0.6rem 0.8rem;
    white-space: nowrap;
    font-size: 0.9rem;
    border-radius: 8px;
    margin: 0 4px;
    transition: background 0.15s;
}

    .nav-link-menu:hover {
        background: rgba(95, 188, 188, 0.18);
        color: #1a1a2e !important;
    }

    .nav-link-menu i {
        font-size: 1rem;
        color: #5FBCBC;
    }

.sidebar.collapsed .menu-text {
    opacity: 0;
    pointer-events: none;
    width: 0;
    overflow: hidden;
}

.submenu {
    display: none;
    background: rgba(240, 248, 248, 0.5);
    padding: 0.25rem 0;
    border-radius: 0 0 8px 8px;
    margin: 0 4px;
}

    .submenu a {
        color: #2c3e50 !important;
        font-weight: 500;
        font-size: 0.85rem;
        padding: 0.4rem 1.8rem;
        display: block;
        text-decoration: none;
        border-radius: 6px;
        margin: 1px 4px;
        transition: background 0.15s;
    }

    .submenu a:hover {
        background: rgba(95, 188, 188, 0.15);
    }

.nav-item-menu.open > .submenu {
    display: block;
}

.sidebar.collapsed .submenu {
    display: none !important;
}

/* ===============================
   Layout: empujar contenido + topbar
   =============================== */

.main-container {
    margin-left: 4.375rem;
    margin-top: 66px;
    transition: margin-left 0.3s ease;
}

.main-container.sidebar-expanded {
    margin-left: 12rem;
}

.toggle-button {
    background: none !important;
    border: none !important;
    color: #1a1a2e !important;
    font-size: 1.2rem;
    padding: 0.3rem 0;
    margin: 0 auto 1rem auto;
    display: block;
    cursor: pointer;
    transition: color 0.2s ease;
    width: auto !important;
    height: auto !important;
    box-shadow: none !important;
}

    .toggle-button:hover {
        color: #5FBCBC;
    }

.sidebar.collapsed .toggle-button {
    text-align: center;
    width: 100%;
}

/* Chevron del submenú */
.submenu-icon {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.2s;
    color: #5FBCBC;
}

.nav-item-menu.open .submenu-icon {
    transform: rotate(180deg);
}

.sidebar.collapsed .submenu-icon {
    display: none;
}

/* ===============================
   RESPONSIVE
   =============================== */

@media (max-width: 768px) {
    .sidebar {
        width: 4.375rem !important;
    }

    .sidebar .menu-text {
        opacity: 0;
        pointer-events: none;
        width: 0;
        overflow: hidden;
    }

    .sidebar .submenu {
        display: none !important;
    }

    .sidebar .submenu-icon {
        display: none;
    }

    .main-container {
        margin-left: 4.375rem !important;
    }
}

@media (max-width: 576px) {
    .sidebar {
        width: 0 !important;
        overflow: hidden;
        border: none;
    }

    .main-container {
        margin-left: 0 !important;
    }

    .toggle-button {
        position: fixed;
        top: 8px;
        left: 8px;
        z-index: 1000;
        background: rgba(255, 255, 255, 0.8) !important;
        backdrop-filter: blur(8px);
        border-radius: 8px;
        padding: 6px 10px;
        color: #1a1a2e !important;
    }
}

/* ===== Laboratorio destacado en sidebar ===== */
.nav-lab-highlight > a {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff !important;
    border-radius: 8px;
    margin: 4px 8px;
    position: relative;
}
.nav-lab-highlight > a:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff !important;
}
.nav-lab-highlight > a i { color: #fff !important; }
.lab-badge-new {
    margin-left: auto;
    background: #fbbf24;
    color: #78350f;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    letter-spacing: 0.5px;
}
.sidebar.collapsed .lab-badge-new { display: none; }
