/* Shared sidebar styles (moved out of each page) */
:root {
    /* Sidebar width set to 70% of previous 260px to make it ~30% smaller */
    --sidebar-width: 182px;
    /* width to use when sidebar is collapsed but toggle remains visible */
    --sidebar-collapsed-width: 44px;
}

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

a {
    text-decoration: none;
}

li {
    list-style: none;
}

body {
    font-family: 'Poppins', sans-serif;
}

.container {
    display: flex;
}

#sidebar {
    display: flex;
    flex-direction: column;
    background-color: #0e2238;
    min-height: 100vh;
    width: var(--sidebar-width);
    position: fixed;
    left: 0;
    top: 0;
    padding: 1.25rem;
    z-index: 1000;
    transition: width 0.25s ease, padding 0.2s ease, transform 0.25s ease;
    overflow: hidden;
}

/* collapsed state reduces the panel to a small visible strip so the toggle stays visible */
#sidebar.collapsed {
    width: var(--sidebar-collapsed-width) !important;
    padding: 0.25rem !important;
}

/* Hidden state for small screens (slide off-canvas). Use .open to show it */
#sidebar.mobile-hidden {
    transform: translateX(-110%);
}

#sidebar.open {
    transform: translateX(0);
}

/* hide the label text when collapsed */
#sidebar.collapsed .sidebar-link span {
    display: none;
}

/* keep the toggle button visible and centered in collapsed strip */
#sidebar .toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.main {
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
    transition: all 0.35s ease-in-out;
    background-color: #fafbfe;
}

/* Smooth transition for content when sidebar opens/closes */
.main-content {
    transition: margin-left 0.28s ease;
}

#toggler {
    display: none;
}

.toggle-btn {
    font-size: 1.5rem;
    cursor: pointer;
    color: #FFF;
    padding: 0.5rem 0.75rem;
    width: max-content;
    margin-bottom: 1rem;
    background: transparent;
    border: none;
}

/* Navigation inside the sidebar */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #e6eef9;
    padding: 0.9rem 0.9rem;
    border-radius: 8px;
    background: transparent;
    transition: background 0.2s, transform 0.12s;
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.04);
    transform: translateY(-2px);
}

.sidebar-link span {
    font-weight: 600;
}

/* small-screen handling (put sidebar on top) */
@media (max-width: 480px) {
    /* On phones keep the sidebar vertical and off-canvas by default */
    #sidebar {
        width: var(--sidebar-width);
        min-height: 100vh;
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-110%);
        transition: transform 0.25s ease;
        padding: 0.75rem;
    }

    /* When .open is present the sidebar slides in */
    #sidebar.open {
        transform: translateX(0);
    }

    /* collapsed on mobile behaves like hidden state but keeps narrow strip visible if desired */
    #sidebar.collapsed {
        width: var(--sidebar-collapsed-width) !important;
        padding: 0.25rem !important;
        transform: translateX(0);
    }

    /* Keep link list vertical on mobile */
    .sidebar-nav {
        flex-direction: column;
        gap: 0.5rem;
    }

    .toggle-btn {
        margin-bottom: 0.5rem;
    }

    .sidebar-link {
        padding: 0.6rem 0.75rem;
        font-size: 0.95rem;
    }

    /* Ensure text is visible even when collapsed on mobile */
    #sidebar .sidebar-link span { display: inline; }
}

/* Extra small screens */
@media (max-width: 360px) {
    #sidebar {
        padding: 0.5rem;
    }

    .sidebar-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }

    .toggle-btn {
        padding: 0.4rem 0.5rem;
        font-size: 1.25rem;
    }
}

/* Overlay shown on mobile when sidebar is open */
.sidebar-overlay {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.35);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 900;
}

.sidebar-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Rotate the toggle icon slightly when sidebar is open for a visual cue */
#sidebar .toggle-btn {
    transition: transform 0.22s ease;
}

#sidebar.open .toggle-btn {
    transform: rotate(90deg);
}

/* Floating mobile button to open sidebar when the sidebar toggle is off-screen */
.mobile-sidebar-button {
    position: fixed;
    right: 16px;
    bottom: 16px;
    width: 52px;
    height: 52px;
    border-radius: 999px;
    background: #0e2238;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(2,6,23,0.28);
    border: none;
    z-index: 1100;
    cursor: pointer;
    font-size: 1.25rem;
    transition: transform 0.18s ease, background-color 0.18s ease;
}


.mobile-sidebar-button:focus { outline: none; box-shadow: 0 0 0 4px rgba(0,112,243,0.14); }

.mobile-sidebar-button.open { background: #183353; }

/* SVG morph: show hamburger by default, cross when open */
.mobile-sidebar-button .mobile-icon { width: 22px; height: 22px; display: block; }
.mobile-sidebar-button .mobile-icon .hamburger { opacity: 1; transition: opacity 0.18s ease; }
.mobile-sidebar-button .mobile-icon .close { opacity: 0; transition: opacity 0.18s ease; }
.mobile-sidebar-button.open .mobile-icon .hamburger { opacity: 0; }
.mobile-sidebar-button.open .mobile-icon .close { opacity: 1; }

@media (min-width: 481px) {
    /* hide the floating button on wider screens */
    .mobile-sidebar-button { display: none !important; }
}
