.catalog-toolbar {
    align-items: stretch;
    gap: 10px;
}

.catalog-search-row,
.catalog-filter-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.catalog-search-row {
    order: 2;
}

.catalog-filter-row {
    order: 1;
}

.sort-menu {
    position: relative;
}

.sort-menu-button {
    min-width: 108px;
    padding: 10px 30px 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    background: white
        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='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E")
        right 10px center / 12px no-repeat;
    color: var(--text-primary);
    cursor: pointer;
    white-space: nowrap;
}

.sort-menu-button:hover,
.sort-menu-button:focus-visible,
.status-filter:focus-visible,
.status-option:focus-visible,
.search-input:focus-visible,
.market-month-input:focus-visible,
.search-btn:focus-visible,
.clear-btn:focus-visible,
.btn:focus-visible,
.btn-page:focus-visible,
.tab-btn:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.35);
    outline-offset: 2px;
    border-color: var(--primary-color);
}

.sort-menu-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 20;
    min-width: 136px;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
}

.sort-menu-panel button {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    background: white;
    color: var(--text-primary);
    text-align: left;
    font-size: 14px;
    cursor: pointer;
}

.sort-menu-panel button:hover,
.sort-menu-panel button[aria-current='true'] {
    background: #eff6ff;
    color: var(--primary-color);
    font-weight: 600;
}

.catalog-date-filter {
    position: relative;
}

.status-filter-native {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.status-segment {
    display: inline-flex;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
}

.status-option {
    min-width: 50px;
    height: 40px;
    padding: 0 12px;
    border: 0;
    border-right: 1px solid var(--border-color);
    background: white;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.status-option:last-child {
    border-right: 0;
}

.status-option:hover {
    background: #eff6ff;
    color: var(--primary-color);
}

.status-option.active {
    background: var(--primary-color);
    color: white;
}

.catalog-date-filter summary {
    list-style: none;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

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

.catalog-date-fields {
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-card {
    border-radius: 10px;
}

.product-name {
    min-height: 58px;
    align-items: flex-start;
    justify-content: space-between;
}

.product-manufacturer {
    display: inline-flex;
    align-self: flex-start;
    padding: 2px 8px;
    border-radius: 6px;
    background: #eff6ff;
    line-height: 1.5;
}

.product-image {
    cursor: pointer;
}

.detail-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.price-primary {
    color: #ef4444;
    font-weight: 700;
}

.price-secondary,
.date {
    color: var(--text-primary);
    font-weight: 600;
}

.date-label {
    color: var(--text-secondary);
}

.product-image.is-missing {
    cursor: default;
    background: #f8fafc;
}

@media (min-width: 769px) {
    .catalog-toolbar {
        flex-direction: row;
    }

    .catalog-search-row,
    .catalog-filter-row {
        width: auto;
    }

    .catalog-search-row {
        order: 2;
        flex: 1;
        max-width: 520px;
    }

    .catalog-filter-row {
        order: 1;
        flex: 0 0 auto;
    }

    .catalog-date-filter {
        order: -1;
    }

    .catalog-date-filter summary {
        display: none;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 12px 16px;
    }

    .tab-switch {
        margin-top: 6px;
    }

    .catalog-toolbar {
        margin-top: 8px;
    }

    .catalog-search-row {
        gap: 6px;
    }

    .catalog-search-row .search-input {
        flex: 1 1 auto;
        min-width: 0;
    }

    .catalog-filter-row {
        justify-content: flex-start;
        gap: 6px;
    }

    .status-filter,
    .status-option,
    .sort-menu-button,
    .catalog-date-filter summary {
        height: 38px;
        font-size: 14px;
    }

    .sort-menu-button {
        min-width: 104px;
    }

    .catalog-date-fields {
        position: absolute;
        top: calc(100% + 6px);
        right: 0;
        z-index: 15;
        padding: 10px;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background: white;
        box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
    }

    .market-date-label {
        display: none;
    }

    .product-name {
        min-height: auto;
        justify-content: space-between;
        text-align: left;
    }

    .product-content {
        gap: 14px;
    }

    .btn-page {
        min-width: 42px;
        height: 42px;
    }

    .pagination {
        position: sticky;
        bottom: 0;
        z-index: 10;
        padding: 8px 0;
        background: white;
        border-top: 1px solid var(--border-color);
    }
}

@media (max-width: 480px) {
    .search-btn,
    .clear-btn {
        padding: 9px 12px;
    }

    .product-grid {
        gap: 10px;
    }

    .product-card {
        border-radius: 8px;
    }

    .product-image {
        width: 96px;
        height: 96px;
    }

    .footer {
        padding-top: 10px;
    }
}
