@layer base {
    :root {
        --background: 0 0% 100%;
        --foreground: 240 10% 3.9%;
        --card: 0 0% 100%;
        --card-foreground: 240 10% 3.9%;
        --popover: 0 0% 100%;
        --popover-foreground: 240 10% 3.9%;
        --primary: 240 5.9% 10%;
        --primary-foreground: 0 0% 98%;
        --secondary: 240 4.8% 95.9%;
        --secondary-foreground: 240 5.9% 10%;
        --muted: 240 4.8% 95.9%;
        --muted-foreground: 240 3.8% 46.1%;
        --accent: 240 4.8% 95.9%;
        --accent-foreground: 240 5.9% 10%;
        --destructive: 0 84.2% 60.2%;
        --destructive-foreground: 0 0% 98%;
        --border: 240 5.9% 90%;
        --input: 240 5.9% 90%;
        --ring: 240 5.9% 10%;
        --radius: 0.5rem;
    }

    html,
    body {
        overflow-x: hidden;
    }

    .cv-auto {
        content-visibility: auto;
        contain-intrinsic-size: 600px;
    }
}

/* Custom Scrollbar for Menu */
.custom-scrollbar {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.custom-scrollbar::-webkit-scrollbar {
    display: none;
}

/* Sidebar navigation styles (desktop) */
.nav-item {
    position: relative;
    display: flex;
    width: 100%;
    align-items: center;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.9375rem;
    color: hsl(var(--muted-foreground));
    transition: all 0.2s ease-in-out;
    line-height: 1.25rem;
}

.nav-item:hover {
    background-color: hsl(var(--muted));
    color: hsl(var(--foreground));
    border-color: hsl(var(--border));
}

.nav-item.active {
    background-color: hsl(var(--secondary));
    color: hsl(var(--foreground));
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 1.5rem;
    width: 3px;
    background-color: hsl(var(--primary));
    border-radius: 0 2px 2px 0;
}

/* Desktop layout: convert floating menu to left sidebar */
@media (min-width: 768px) {
    #fabContainer {
        position: fixed;
        top: 64px;
        /* header height */
        left: 0;
        bottom: 0;
        width: 240px;
        z-index: 40;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        pointer-events: auto;
        background-color: hsl(var(--card));
        border-right: 1px solid hsla(var(--border) / 0.4);
    }

    #fabBtn {
        display: none !important;
    }

    #categoryMenu {
        margin-bottom: 0;
        width: 100%;
        height: calc(100vh - 64px);
        max-height: none;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        scale: 1 !important;
        translate: none !important;
        border-left: none;
        border-top: none;
        border-bottom: none;
        box-shadow: none;
        background-color: transparent;
        border-radius: 0;
        border-color: hsla(var(--border) / 0.4);
    }

    #categoryMenuList {
        flex: 1;
        overflow-y: auto;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    header .container {
        max-width: none;
        padding-left: 1rem;
    }

    main.container {
        margin-left: 260px;
        /* reserve space for sidebar */
        padding-top: 1rem;
    }
}

/* Mobile dropdown positioning */
@media (max-width: 767px) {
    #fabContainer {
        top: calc(64px + 0.5rem);
        right: max(1rem, env(safe-area-inset-right));
        left: 1rem;
        bottom: auto;
        align-items: flex-end;
        width: auto;
    }

    #categoryMenu {
        width: clamp(200px, 72vw, 240px);
        max-width: calc(100vw - 2rem);
        height: calc(100svh - 80px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        max-height: calc(100svh - 80px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        margin-bottom: 0;
        transform-origin: top right;
        box-sizing: border-box;
    }

    #categoryMenuList {
        flex: 1;
        overflow-y: auto;
    }
}