.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 70px;                        /* collapsed width */
    height: 100vh;
    background-color: #191970;          /* midnight blue */
    overflow: hidden;
    transition: width 0.25s ease;
    padding-top: 20px;
    z-index: 999;
}

/* Expanded on hover */
.sidebar:hover {
    width: 240px;
}

/* === LOGO AREA === */
.sidebar-logo {
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
}

.sidebar-logo img {
    width: 40px;
    height: auto;
    transition: 0.25s ease;
    opacity: 1;
}

/* === MENU STRUCTURE === */
.sidebar ul {
    padding: 0;
    margin: 0;
    list-style: none;
}

.sidebar li {
    position: relative;
}

/* === LINKS === */
.sidebar a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    text-decoration: none;
    color: white;
    font-size: 15px;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease;
}

/* Hover effect */
.sidebar a:hover {
    background-color: #11224f;
    color: white;
}

/* === ICONS === */
.icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    margin-right: 0;
    filter: brightness(0) invert(1);    /* ensures icons appear white */
    transition: margin-right 0.25s ease, opacity 0.25s ease;
}

/* Move icon slightly when expanded */
.sidebar:hover .icon {
    margin-right: 12px;
}

/* === LABELS (text) === */
.label {
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Show labels when expanded */
.sidebar:hover .label {
    opacity: 1;
    transform: translateX(0);
}

/* ======================================
   SUBMENU — Now Animated!
   ====================================== */

/* Start hidden but measurable */
.submenu {
    max-height: 0;
    overflow: hidden;
    background-color: #0f1e40;

    opacity: 0;
    transform: translateY(-6px);

    display: flex;
    flex-direction: column;

    transition:
        max-height 0.3s ease,
        opacity 0.3s ease,
        transform 0.3s ease;
}

/* Open submenu on hover */
.has-submenu:hover .submenu {
    max-height: 500px;   /* sufficiently large */
    opacity: 1;
    transform: translateY(0);
}

.submenu a {
    padding-left: 55px !important;
    font-size: 14px;
}

.submenu a:hover {
    background-color: #73e1ff;
}

/* === ACTIVE PAGE HIGHLIGHT === */
.sidebar a.active {
    background-color: white;
    color: #0b1736;
    font-weight: bold;
}

.sidebar a.active img.icon {
    filter: none; /* allow icon to go dark */
}

/* === SCROLL SUPPORT IF NEEDED === */
.sidebar:hover {
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #1b2a55;
    border-radius: 3px;
}