/* ============================================================================
   Layout Variables
   ============================================================================ */

:root {
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 60px;
    --detail-width: 420px;
    --detail-width-hidden: 0px;

    --z-index-sticky-header: 1;
    --z-index-resize-handle: 10;
    --z-index-overlay: 100;
    --z-index-mobile-panel: 101;
    --z-index-overlay-modal: 102;
    --z-index-modal: 103;
}

/* ============================================================================
   Full View Mode
   ============================================================================ */

body.full-view {

    .sidebar,
    .results-panel,
    .resize-handle,
    .overlay {
        display: none !important;
    }

    .detail-panel {
        grid-column: 1 / -1;
        border-left: none;
    }

    @media (max-width: 968px) {
        .app-container {
            grid-template-columns: 1fr !important;
        }

        .detail-panel {
            position: static !important;
            transform: none !important;
            width: 100% !important;
            max-width: 100% !important;
            z-index: auto !important;
            inset: auto !important;
        }
    }
}

/* ============================================================================
   Layout Grid
   ============================================================================ */

.app-container {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr var(--detail-width-hidden);
    height: 100vh;
    gap: 0;
    position: relative;
    --current-sidebar-width: var(--sidebar-width);
    --current-detail-width: var(--detail-width-hidden);

    &:has(.detail-panel.visible) {
        --current-detail-width: var(--detail-width);
        grid-template-columns: var(--current-sidebar-width) 1fr var(--current-detail-width);
    }

    &.sidebar-collapsed {
        --current-sidebar-width: var(--sidebar-collapsed-width);
        grid-template-columns: var(--current-sidebar-width) 1fr var(--current-detail-width);

        .resize-handle {
            display: block;
        }
    }

    .sidebar {
        background: var(--bg-primary);
        border-right: 1px solid var(--border);
        display: flex;
        flex-direction: column;
        overflow: hidden;

        .sidebar-header {
            padding: var(--space-md);
            border-bottom: 1px solid var(--border);
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-shrink: 0;
            gap: var(--space-sm);
        }

        .collapse-btn {
            flex-shrink: 0;
        }

        .collapse-btn .expand-icon {
            display: none;
        }

        .search-bar {
            position: relative;
            border-bottom: 1px solid var(--border);
            flex-shrink: 0;
            padding: var(--space-sm) var(--space-md);
            background: var(--bg-primary);
        }

        .search-field {
            position: relative;
        }

        .search-field .search-icon {
            position: absolute;
            left: 12px;
            top: 50%;
            transform: translateY(-50%);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 16px;
            height: 16px;
            color: var(--text-tertiary);
            pointer-events: none;
            z-index: 1;

            svg {
                width: 16px;
                height: 16px;
                flex-shrink: 0;
            }
        }

        .search-field:has(input[type="search"]:focus) .search-icon {
            color: var(--accent);
        }

        .search-field .search-shortcut-badge {
            position: absolute;
            right: 12px;
            top: 50%;
            transform: translateY(-50%);
            display: inline-flex;
            align-items: center;
            gap: 2px;
            font-size: 12px;
            line-height: 1;
            color: var(--text-secondary);
            pointer-events: none;
            user-select: none;
            font-weight: 500;
            letter-spacing: 0.5px;
            padding: 4px 8px;
            background: var(--bg-primary);
            border: 1px solid var(--border);
            border-radius: 4px;
            z-index: 1;
            opacity: 1;

            svg {
                width: 12px;
                height: 12px;
                flex-shrink: 0;
            }
        }

        .search-field input[type="search"] {
            width: 100%;
            padding: 8px 50px 8px 36px;
            font-size: var(--font-size-base-lg);
            line-height: normal;
        }

        .search-field input[type="search"]::-webkit-search-cancel-button,
        .search-field input[type="search"]::-moz-search-clear-button {
            display: none;
        }

        .search-field input[type="search"]:focus {
            padding: 8px 12px 8px 36px;
        }

        .search-field input[type="search"]:focus~.search-shortcut-badge {
            opacity: 0;
            pointer-events: none;
        }

        .search-field input[type="search"]::placeholder {
            font-size: var(--font-size-base-sm);
        }

        .filters-container {
            flex: 1;
            overflow-y: auto;
            overflow-x: hidden;
            contain: layout style paint;
            content-visibility: auto;
        }

        .filters-panel-header {
            position: sticky;
            top: 0;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: var(--space-md);
            border-bottom: 1px solid var(--border);
            background: var(--bg-primary);
            z-index: var(--z-index-sticky-header);
        }

        .filter-group {
            border-bottom: 1px solid var(--border);
            padding: 0 var(--space-md);
        }

        .filter-group summary {
            list-style: none;
            cursor: pointer;
            padding: var(--space-md) 0;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: var(--space-sm);
            font-size: var(--font-size-base);
            font-weight: 500;
            color: var(--text-primary);
        }

        .filter-group summary::-webkit-details-marker {
            display: none;
        }

        .filter-group .chevron {
            display: inline-flex;
            width: 16px;
            height: 16px;
            color: var(--text-tertiary);
            transition: transform 0.2s ease;
        }

        .filter-group[open] .chevron {
            transform: rotate(180deg);
        }

        .filter-group-body {
            display: grid;
            gap: var(--space-sm);
            padding-bottom: var(--space-md);
        }

        .filter-search {
            border: 1px solid var(--border);
            padding: 0 var(--space-sm);
            background: var(--bg-primary);
        }

        .filter-search input {
            width: 100%;
            padding: var(--space-sm) 0;
            border: none;
            background: transparent;
            color: var(--text-primary);
            font-size: var(--font-size-base);
        }

        .filter-search input:focus {
            outline: none;
        }

        .filter-items {
            display: flex;
            flex-direction: column;
        }

        .filter-item {
            padding: var(--space-sm) 0;
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            cursor: pointer;
            font-size: var(--font-size-base);
            border-inline-start: 2px solid transparent;
            gap: var(--space-sm);
        }

        .filter-item:hover {
            background: var(--accent-light);
        }

        .filter-item+.filter-item {
            border-top: 1px solid var(--border-light);
        }

        .filter-item-info {
            display: flex;
            flex-direction: column;
            gap: 2px;
            flex: 1;
            min-width: 0;
        }

        .filter-item-name {
            color: var(--text-primary);
            font-weight: 400;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .filter-item-version {
            color: var(--text-tertiary);
            font-size: var(--font-size-base-sm);
            white-space: normal;
            overflow-wrap: anywhere;
        }

        .filter-item-state {
            width: 14px;
            height: 14px;
            border: 1px solid var(--filter-border);
            flex-shrink: 0;
            position: relative;
            background: transparent;
        }

        .filter-item[data-state="any"] .filter-item-state {
            background: var(--filter-bg-any);
            border-color: var(--filter-border);
        }

        .filter-item[data-state="include"],
        .filter-item[data-state="exclude"] {
            background: var(--bg-primary);
        }

        .filter-item[data-state="include"] {
            border-inline-start-color: var(--accent);
        }

        .filter-item[data-state="include"] .filter-item-name {
            color: var(--accent);
            font-weight: 500;
        }

        .filter-item[data-state="include"] .filter-item-state {
            background: var(--accent);
            border-color: var(--accent);
        }

        .filter-item[data-state="exclude"] {
            border-inline-start-color: var(--text-tertiary);
        }

        .filter-item[data-state="exclude"] .filter-item-name {
            color: var(--text-secondary);
            font-weight: 500;
            text-decoration: line-through;
        }

        .filter-item[data-state="exclude"] .filter-item-state {
            background: var(--text-tertiary);
            border-color: var(--text-tertiary);
        }

        .filter-item-state::after {
            position: absolute;
            inset-block-start: 50%;
            inset-inline-start: 50%;
            transform: translate(-50%, -50%);
            color: var(--bg-primary);
            font-weight: 700;
        }

        .filter-item[data-state="include"] .filter-item-state::after {
            content: '✓';
            font-size: 9px;
        }

        .filter-item[data-state="exclude"] .filter-item-state::after {
            content: '×';
            font-size: 11px;
            line-height: 1;
        }

        .sidebar-footer {
            padding: var(--space-md);
            border-top: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            gap: var(--space-sm);
            align-items: center;
            flex-shrink: 0;

            .submit-btn {
                width: 100%;
                text-align: center;
                background: transparent;
                color: var(--accent);
                padding: 8px 10px;
                text-decoration: none;
                border: 1px solid var(--border);
                font-weight: 600;

                &:hover {
                    background: var(--accent-light);
                    color: var(--accent);
                }
            }

            .login-btn {
                display: none;
                background: var(--accent);
                color: var(--bg-primary);
                border: 1px solid var(--accent);

                &:hover {
                    opacity: 0.9;
                }

                &.visible {
                    display: block;
                }
            }

            .footer-icons {
                display: flex;
                gap: var(--space-sm);
                justify-content: center;
                width: 100%;

                .icon-btn {
                    width: 48px;
                    height: 40px;

                    svg {
                        width: 20px;
                        height: 20px;
                    }
                }
            }

            .user-info {
                display: none;

                &.visible {
                    display: flex;
                    flex-direction: column;
                    align-items: center;
                    gap: var(--space-sm);
                    width: 100%;
                    padding: var(--space-md);
                    background: var(--bg-primary);
                    border: 1px solid var(--border);
                    border-radius: 8px;
                    color: var(--text-primary);
                    margin-top: var(--space-xs);
                    margin-bottom: var(--space-sm);
                }

                .user-avatar {
                    width: 48px;
                    height: 48px;
                    border-radius: 50%;
                    object-fit: cover;
                    border: 2px solid var(--accent);
                    flex-shrink: 0;
                }

                .user-name {
                    font-size: 13px;
                    font-weight: 600;
                    white-space: nowrap;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    text-align: center;
                    width: 100%;
                    letter-spacing: 0.3px;
                }
            }

            .contact-link {
                display: block;
                width: 100%;
                text-align: center;
                font-size: var(--font-size-xs);
                color: var(--text-secondary);
                user-select: text;
                cursor: default;
            }
        }

        &.collapsed {
            width: var(--sidebar-collapsed-width);
            min-width: var(--sidebar-collapsed-width);
        }

        &.collapsed .collapse-btn {
            margin: 0;
            display: flex;

            .collapse-icon {
                display: none;
            }

            .expand-icon {
                display: block;
            }
        }

        &.collapsed .sidebar-header .logo {
            display: none;
        }

        &.collapsed .search-bar,
        &.collapsed .filters-container {
            display: none;
        }

        &.collapsed .sidebar-header {
            justify-content: center;
            padding: var(--space-md);
        }

        &.collapsed .sidebar-footer {
            flex-direction: column;
            gap: var(--space-sm);
            padding: var(--space-md);
            align-items: center;
            justify-content: center;
            margin-top: auto;
        }

        &.collapsed .sidebar-footer .icon-btn {
            max-width: none;
            width: 40px;
            height: 40px;
            flex: none;
        }

        &.collapsed .sidebar-footer .footer-icons {
            display: flex;
            flex-direction: column;
            gap: var(--space-sm);
            align-items: center;
            width: auto;
        }

        &.collapsed .sidebar-footer .submit-btn,
        &.collapsed .sidebar-footer .login-btn,
        &.collapsed .sidebar-footer .user-info,
        &.collapsed .sidebar-footer .contact-link {
            display: none;
        }
    }

    .results-panel {
        background: var(--bg-primary);
        display: flex;
        flex-direction: column;
        overflow: hidden;

        .results-header {
            padding: var(--space-md) var(--space-lg);
            border-bottom: 1px solid var(--border);
            flex-shrink: 0;
            display: flex;
            align-items: center;
            gap: var(--space-md);
            background: var(--bg-primary);

            #resultsCount {
                font-size: var(--font-size-base-sm);
                color: var(--text-tertiary);
                font-weight: 500;
                text-transform: uppercase;
                letter-spacing: 0.08em;
            }

            .custom-select-wrapper {
                margin-left: auto;
            }

            .view-toggle {
                display: flex;
                gap: 2px;
                background: var(--bg-primary);
                padding: 2px;
                border: 1px solid var(--border);
                margin-left: 8px;

                .view-btn {
                    svg {
                        width: 14px;
                        height: 14px;
                    }

                    &.active {
                        background: var(--bg-primary);
                        color: var(--accent);
                        border-color: var(--border);
                    }
                }
            }
        }

        .results-list {
            flex: 1;
            overflow-y: auto;
            padding: var(--space-md);
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
            gap: var(--space-md);
            align-content: start;
            contain: layout style paint;
            content-visibility: auto;

            &.list-view {
                grid-template-columns: 1fr;
                gap: var(--space-xs);

                .result-item {
                    padding: var(--space-sm) var(--space-md);
                }
            }

            .vote-score {
                display: inline-flex;
                align-items: center;
                justify-content: center;
                min-width: 32px;
                height: 24px;
                padding: 0 var(--space-xs);
                font-size: var(--font-size-sm);
                font-weight: 600;
                color: var(--text-secondary);
                background: var(--bg-primary);
                border: 1px solid var(--border);
                border-radius: 4px;
                --vote-intensity: 0;
                white-space: nowrap;

                &.vote-positive {
                    color: color-mix(in srgb, #ff4500 calc(var(--vote-intensity) * 100%), var(--text-secondary));
                    background: color-mix(in srgb, rgba(255, 69, 0, 0.1) calc(var(--vote-intensity) * 100%), var(--bg-primary));
                    border-color: color-mix(in srgb, rgba(255, 69, 0, 0.3) calc(var(--vote-intensity) * 100%), var(--border));
                }

                &.vote-negative {
                    color: color-mix(in srgb, #7193ff calc(var(--vote-intensity) * 100%), var(--text-secondary));
                    background: color-mix(in srgb, rgba(113, 147, 255, 0.1) calc(var(--vote-intensity) * 100%), var(--bg-primary));
                    border-color: color-mix(in srgb, rgba(113, 147, 255, 0.3) calc(var(--vote-intensity) * 100%), var(--border));
                }
            }

            .result-item {
                background: var(--bg-primary);
                border: 1px solid var(--border);
                padding: var(--space-md);
                cursor: pointer;
                display: flex;
                flex-direction: column;
                contain: layout style paint;
                content-visibility: auto;
                text-decoration: none;
                color: inherit;
                word-wrap: break-word;
                overflow-wrap: break-word;

                &:not(.active) {
                    border-color: var(--border);
                }

                &.active {
                    border-color: var(--accent);
                }

                * {
                    text-decoration: none;
                    color: inherit;
                }
            }

            .empty-state {
                grid-column: 1 / -1;
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: center;
                gap: var(--space-md);
                min-height: 400px;
                color: var(--text-tertiary);
                padding: var(--space-xl);
                text-align: center;

                .empty-icon {
                    width: 48px;
                    height: 48px;
                    opacity: 0.2;
                    margin-bottom: 0.5rem;
                }

                h3 {
                    color: var(--text-secondary);
                    margin-bottom: 4px;
                    font-weight: 500;
                    font-size: var(--font-size-md);
                }

                p {
                    color: var(--text-tertiary);
                    font-size: var(--font-size-base-sm);
                }
            }
        }
    }

    &:has(.detail-panel.visible) .results-panel {
        padding-right: 20px;
    }

    .detail-panel {
        background: var(--bg-primary);
        border-left: 1px solid var(--border);
        overflow-y: auto;
        display: none;
        flex-direction: column;
        contain: layout style paint;
        content-visibility: hidden;
    }

    .detail-panel.visible {
        display: flex;
        content-visibility: visible;
    }

    .detail-panel iframe {
        width: 100%;
        height: 100%;
        border: none;
    }

    .resize-handle {
        position: absolute;
        right: var(--current-detail-width);
        inset-block: 0;
        width: 4px;
        background: transparent;
        cursor: col-resize;
        z-index: var(--z-index-resize-handle);
        display: none;
        will-change: background;
        contain: layout paint;

        &:hover,
        &:active {
            background: var(--accent);
        }

        &::before {
            content: '';
            position: absolute;
            inset-inline: -4px;
            inset-block: 0;
        }
    }

    &:has(.detail-panel.visible):hover .resize-handle,
    &:has(.detail-panel.visible) .resize-handle:hover,
    &:has(.detail-panel.visible) .resize-handle:active {
        display: block;
    }
}

.mobile-filter-btn {
    display: none;
}

[data-theme="dark"] .results-panel .results-header .order-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0a0a0' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

/* ============================================================================
   Mobile Overlay
   ============================================================================ */

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-index-overlay);
    opacity: 0;
    pointer-events: none;
}

.overlay.visible {
    opacity: 1;
    pointer-events: all;
}

/* ============================================================================
   Modal Styles
   ============================================================================ */

.modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-index-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    padding: var(--space-lg);

    &.visible~.app-container .overlay,
    body:has(&.visible) .overlay {
        z-index: var(--z-index-overlay-modal);
    }

    &.visible {
        opacity: 1;
        pointer-events: all;
    }

    .modal-content {
        background: var(--bg-primary);
        border: 1px solid var(--border);
        width: 100%;
        max-width: 500px;
        max-height: 90vh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .modal-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: var(--space-xl);
        border-bottom: 1px solid var(--border);

        h2 {
            margin: 0;
            font-size: var(--font-size-3xl);
            font-weight: 600;
            color: var(--text-primary);
        }

        .close-modal-btn {
            margin-inline-start: var(--space-md);
        }
    }

    .modal-body {
        flex: 1;
        overflow-y: auto;
        padding: var(--space-xl);

        .settings-section {
            margin-bottom: var(--space-xl);

            &:last-child {
                margin-bottom: 0;
            }

            .settings-section-title {
                margin: 0 0 var(--space-md) 0;
                font-size: var(--font-size-base);
                font-weight: 600;
                color: var(--text-primary);
                text-transform: uppercase;
                letter-spacing: 0.05em;
            }

            .settings-field {
                margin-bottom: var(--space-md);
                display: grid;
                grid-template-columns: 1fr auto;
                grid-template-rows: auto auto;
                align-items: center;

                &:last-child {
                    margin-bottom: 0;
                }

                .settings-label {
                    grid-column: 1;
                    grid-row: 1;
                    display: flex;
                    align-items: center;
                    font-size: var(--font-size-base);
                    font-weight: 500;
                    color: var(--text-primary);
                    margin: 0;
                    line-height: 1.5;
                    min-height: calc(1.5 * var(--font-size-base) + 2 * var(--space-md));
                }

                .settings-input {
                    grid-column: 2;
                    grid-row: 1;
                    width: 100%;
                    min-width: 200px;
                    max-width: 300px;
                    box-sizing: border-box;
                    line-height: 1.5;
                    padding: var(--space-md);
                    background: var(--bg-primary);
                    border: 1px solid var(--border);
                    color: var(--text-primary);
                    font-size: var(--font-size-base);

                    &:focus {
                        outline: none;
                        border-color: var(--accent);
                    }

                    &::placeholder {
                        color: var(--text-tertiary);
                    }
                }

                .toggle {
                    grid-column: 2;
                    grid-row: 1;
                    width: 40px;
                    min-width: 40px;
                    max-width: 40px;
                    flex-shrink: 0;
                    position: relative;
                    display: inline-flex;
                    align-items: center;
                    justify-content: flex-start;
                    height: 20px;
                    cursor: pointer;
                }

                .settings-help {
                    grid-column: 2;
                    grid-row: 2;
                    align-self: start;
                    font-size: var(--font-size-sm);
                    color: var(--text-secondary);
                    line-height: 1.4;
                    width: 100%;
                    max-width: 300px;
                }
            }
        }
    }

    .modal-footer {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: var(--space-md);
        padding: var(--space-xl);
        border-top: 1px solid var(--border);
    }

    @media (max-width: 768px) {
        padding: var(--space-md);

        .modal-content {
            max-width: 100%;
        }

        .modal-header,
        .modal-body,
        .modal-footer {
            padding: var(--space-lg);
        }
    }
}

/* ============================================================================
   Common utility classes
   ============================================================================ */

.reset-filters-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: var(--font-size-sm);
    font-weight: 400;
    cursor: pointer;
    padding: var(--space-xs) var(--space-sm);
    border-radius: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;

    &:hover {
        background: var(--accent-light);
    }
}

.filters-title {
    font-size: var(--font-size-base-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
}

.logo {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.05em;
    margin-bottom: 0;
    line-height: 1;
    text-transform: uppercase;
}

/* ============================================================================
   Media Queries
   ============================================================================ */

@media (max-width: 1200px) {
    :root {
        --detail-width: 400px;
    }
}

@media (max-width: 968px) {
    .app-container {
        grid-template-columns: var(--current-sidebar-width) 1fr;
        --current-detail-width: 0px;
    }

    .app-container:has(.detail-panel.visible) {
        grid-template-columns: var(--current-sidebar-width) 1fr;
    }

    .detail-panel {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: var(--detail-width);
        max-width: 90vw;
        z-index: var(--z-index-mobile-panel);
        transform: translateX(100%);
        will-change: transform;
    }

    .detail-panel.mobile-visible {
        transform: translateX(0);
    }

    .resize-handle {
        display: none;
    }

    .results-panel .results-list {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        padding: var(--space-md);
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 100%;
        --detail-width: 100%;
    }

    .app-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 85vw;
        max-width: 320px;
        z-index: var(--z-index-mobile-panel);
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .sidebar.mobile-visible {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        width: 85vw;
        max-width: 320px;
    }

    .app-container .sidebar.collapsed .sidebar-header>div,
    .app-container .sidebar.collapsed .search-bar,
    .app-container .sidebar.collapsed .filters-container,
    .app-container .sidebar.collapsed .sidebar-footer {
        display: flex;
        opacity: 1;
        pointer-events: all;
    }

    .results-panel {
        grid-column: 1;
        border-left: none;
    }

    .detail-panel {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: 100%;
        z-index: var(--z-index-mobile-panel);
        transform: translateX(100%);
        transition: transform 0.2s ease;
    }

    .detail-panel.mobile-visible {
        transform: translateX(0);
    }

    .resize-handle,
    .collapse-btn {
        display: none !important;
    }

    .mobile-filter-btn {
        display: flex !important;
    }

    .results-list {
        grid-template-columns: 1fr;
    }

    .results-panel .results-list.list-view .snippet-summary {
        flex-direction: column;
        align-items: flex-start;
    }

    .results-panel .results-list.list-view .summary-title {
        min-width: unset;
        max-width: 100%;
    }

    .results-panel .results-header {
        flex-wrap: wrap;
        gap: var(--space-sm);
    }

    .results-panel .results-header #resultsCount {
        order: 1;
        flex: 1;
        min-width: 0;
    }

    .results-panel .results-header .order-select {
        order: 2;
        margin-left: auto;
    }

    .results-panel .results-header .view-toggle {
        order: 3;
        margin-left: 8px;
    }
}