
@media (max-width: 768px) {
    :root {
        --menu-size: 280px;
    }

    #menu {
        position: fixed;
        left: 0;
        top: 60px;
        height: calc(100vh - 60px);
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        z-index: 999;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    }

    #menu.mobile-open {
        transform: translateX(0);
    }

    #app.menu-open::before {
        content: '';
        position: fixed;
        top: 60px;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }

    .mobile-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        padding: 0;
    }

    #main-wrapper {
        width: 100%;
    }

    #content {
        padding: 20px;
    }

    #topbar {
        padding: 0 10px;
        gap: 10px;
    }

    .search-bar {
        width: 100%;
        max-width: 250px;
    }

    .search-scope-select {
        font-size: 0.7rem;
        padding: 6px 8px;
    }

    .topbar-actions {
        gap: 4px;
        overflow-x: auto;
        flex-shrink: 1;
    }

    .topbar-actions .btn {
        flex-shrink: 0;
        padding: 6px 8px;
    }

    .vertical-separator {
        height: 30px;
    }
}

@media (max-width: 600px) {
    :root {
        --menu-size: 240px;
    }

    #content {
        padding: 15px;
    }

    #topbar {
        padding: 0 8px;
        height: 55px;
    }

    #topbar {
        flex-wrap: wrap;
        gap: 8px;
    }

    .search-bar {
        max-width: 100%;
        order: 3;
        width: 100%;
        margin-top: 8px;
    }

    .topbar-actions {
        gap: 2px;
        max-width: 100%;
    }

    .topbar-actions .btn {
        padding: 4px 6px;
        font-size: 0.9rem;
    }

    .search-scope-select {
        display: none;
    }

    .search-bar input {
        padding: 4px;
        font-size: 0.9rem;
    }

    #menu {
        width: 240px;
    }

    .menu-title {
        display: none;
    }

    .menu-logo {
        width: 40px;
        height: 40px;
    }

    .menu-header {
        padding: 8px;
        justify-content: center;
    }

    .menu-user-info .username {
        font-size: 0.9rem;
    }
}

@media (max-width: 420px) {
    :root {
        --menu-size: 200px;
    }

    #content {
        padding: 12px;
    }

    #topbar {
        padding: 0 6px;
        height: 50px;
    }

    .mobile-toggle {
        width: 35px;
        height: 35px;
    }

    .topbar-actions .btn {
        padding: 3px 4px;
        font-size: 0.8rem;
    }

    .vertical-separator {
        display: none;
    }

    .menu-item {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .menu-group-title {
        padding: 0 12px;
        font-size: 0.65rem;
    }

    .menu-user-info {
        display: none;
    }
}

@media (max-height: 500px) and (max-width: 768px) {
    #topbar {
        height: 50px;
    }

    #content {
        padding: 12px;
    }

    .menu-header {
        padding: 8px;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    :root {
        --menu-size: 240px;
    }

    #content {
        padding: 25px;
    }

    .search-bar {
        width: 250px;
    }
}

@media (min-width: 769px) {

    #menu {
        transform: translateX(0) !important;
        position: relative !important;
        top: auto !important;
        height: auto !important;
        box-shadow: none !important;
    }


    #app.menu-open::before {
        display: none;
    }


    .mobile-toggle {
        display: none !important;
    }


    #app {
        display: flex;
    }

    #main-wrapper {
        width: calc(100% - var(--menu-size));
        flex-grow: 1;
    }
}


@media (hover: none) and (pointer: coarse) {

    .btn,
    .menu-item,
    button {
        min-height: 44px;
        min-width: 44px;
    }


    .btn {
        padding: 8px 12px;
    }


    .menu-item:hover {
        background-color: var(--bg2);
    }
}
