/* Hero блок */
.products-hero {
    display: flex;
    align-items: center;
    background-color: rgba(254, 251, 244, 1);
    background-image: url('/images/catalog-section.jpg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    min-height: 400px;
    overflow: hidden;
}

.products-hero .main-text {
    padding-left: 100px;
    width: 550px;
    flex-shrink: 0;
}

.products-hero .main-text h2 {
    color: rgba(29, 43, 79, 1);
    font-size: 42px;
    font-weight: 700;
    font-family: "Playfair Display", serif;
    padding-bottom: 15px;
}

.products-hero .main-text h3 {
    color: rgba(29, 43, 79, 1);
    font-size: 18px;
    font-weight: 400;
    line-height: 1.5;
}

/* Каталог */
.catalog {
    display: flex;
    align-items: flex-start;
    gap: 25px;
    padding: 60px 100px;
}

/* Фильтры */
.catalog .filters {
    flex-shrink: 0;
    width: 260px;
    border: 1px solid rgba(233, 236, 243, 1);
    border-radius: 12px;
    padding: 20px;
    box-sizing: border-box;
}

.catalog .filters h3 {
    color: rgba(29, 43, 79, 1);
    font-size: 18px;
    font-weight: 700;
    padding-bottom: 20px;
}

.catalog .filters .filter-block {
    border-top: 1px solid rgba(233, 236, 243, 1);
    padding: 15px 0;
}

.catalog .filters .filter-block h4 {
    color: rgba(29, 43, 79, 1);
    font-size: 15px;
    font-weight: 600;
    padding-bottom: 12px;
}

.catalog .filters .filter-block label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    color: rgba(80, 90, 110, 1);
    font-size: 14px;
    cursor: pointer;
}

.catalog .filters .filter-block input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: rgba(29, 43, 79, 1);
    cursor: pointer;
}

.catalog .filters .filter-block .colors {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.catalog .filters .filter-block .colors .color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid rgba(233, 236, 243, 1);
    transition: transform 0.2s ease;
}

.catalog .filters .filter-block .colors .color:hover {
    transform: scale(1.15);
}

.catalog .filters .filter-block .colors .color.selected {
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px rgba(29, 43, 79, 1);
}

/* Панель поиска и сортировки */
.catalog .content {
    flex-grow: 1;
    min-width: 0;
}

.catalog .toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 25px;
}

.catalog .toolbar .search {
    position: relative;
    flex-grow: 1;
    max-width: 450px;
}

.catalog .toolbar .search img {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
}

.catalog .toolbar .search input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(233, 236, 243, 1);
    border-radius: 8px;
    padding: 11px 15px 11px 40px;
    font-size: 14px;
    color: rgba(29, 43, 79, 1);
    outline: none;
}

.catalog .toolbar .search input::placeholder {
    color: rgba(80, 90, 110, 0.6);
}

.catalog .toolbar .search input:focus {
    border-color: rgba(29, 43, 79, 1);
}

.catalog .toolbar .sort {
    position: relative;
}

.catalog .toolbar .sort .sort-button {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #ffffff;
    border: 1px solid rgba(233, 236, 243, 1);
    border-radius: 8px;
    padding: 11px 15px;
    font-size: 14px;
    color: rgba(29, 43, 79, 1);
}

.catalog .toolbar .sort .sort-button img {
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease;
}

.catalog .toolbar .sort.open .sort-button img {
    transform: rotate(180deg);
}

.catalog .toolbar .sort .sort-list {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    z-index: 10;
    min-width: 100%;
    background-color: #ffffff;
    border: 1px solid rgba(233, 236, 243, 1);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(29, 43, 79, 0.1);
    overflow: hidden;
}

.catalog .toolbar .sort .sort-list button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 10px 15px;
    font-size: 14px;
    color: rgba(29, 43, 79, 1);
    white-space: nowrap;
}

.catalog .toolbar .sort .sort-list button:hover {
    background-color: rgba(246, 247, 250, 1);
}

.catalog .toolbar .sort .sort-list button.selected {
    background-color: rgba(246, 247, 250, 1);
    font-weight: 600;
}

/* Сетка товаров */
.catalog .cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.catalog .cards .card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: 1px solid rgba(233, 236, 243, 1);
    border-radius: 12px;
    padding: 12px;
    box-sizing: border-box;
    cursor: pointer;
}

.catalog .cards .card .image {
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(246, 247, 250, 1);
    border-radius: 10px;
    padding: 10px;
    box-sizing: border-box;
    margin-bottom: 15px;
    overflow: hidden;
}

.catalog .cards .card .image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.catalog .cards .card h3 {
    color: rgba(29, 43, 79, 1);
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-bottom: 5px;
}

.catalog .cards .card .sku {
    color: rgba(80, 90, 110, 1);
    font-size: 13px;
    padding-bottom: 12px;
}

.catalog .cards .card .price {
    color: rgba(29, 43, 79, 1);
    font-size: 20px;
    font-weight: 700;
    padding-bottom: 15px;
    margin-top: auto;
}

.catalog .cards .card .price small {
    font-size: 12px;
    font-weight: 500;
}

.catalog .cards .card .add-to-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background-color: rgba(244, 180, 0, 1);
    border: none;
    border-radius: 8px;
    padding: 11px;
    color: rgba(29, 43, 79, 1);
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.25s ease;
}

.catalog .cards .card .add-to-cart img {
    width: 16px;
    height: 16px;
}

.catalog .cards .card .add-to-cart:hover {
    background-color: rgba(220, 160, 0, 1);
}

/* Пустой результат */
.catalog .no-results {
    text-align: center;
    color: rgba(80, 90, 110, 1);
    font-size: 16px;
    padding: 60px 0;
}

/* Пагинация */
.catalog .pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 40px;
}

.catalog .pagination button {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    border: 1px solid rgba(233, 236, 243, 1);
    border-radius: 8px;
    color: rgba(29, 43, 79, 1);
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.catalog .pagination button:hover {
    border-color: rgba(29, 43, 79, 1);
}

.catalog .pagination button.active {
    background-color: rgba(29, 43, 79, 1);
    border-color: rgba(29, 43, 79, 1);
    color: #ffffff;
}

.catalog .pagination button:disabled {
    opacity: 0.35;
    cursor: default;
}

.catalog .pagination button:disabled:hover {
    border-color: rgba(233, 236, 243, 1);
}

.catalog .pagination button img {
    width: 14px;
    height: 14px;
}

.catalog .pagination span {
    color: rgba(80, 90, 110, 1);
    padding: 0 4px;
}

/* Мобильная кнопка и панель фильтров */
.catalog .toolbar .filters-button {
    display: none;
    align-items: center;
    gap: 10px;
    background-color: #ffffff;
    border: 1px solid rgba(233, 236, 243, 1);
    border-radius: 8px;
    padding: 11px 15px;
    font-size: 14px;
    color: rgba(29, 43, 79, 1);
}

.catalog .toolbar .filters-button img {
    width: 16px;
    height: 16px;
}

.catalog .filters .filters-close {
    display: none;
    background: none;
    border: none;
    color: rgba(29, 43, 79, 1);
    font-size: 36px;
    line-height: 1;
    padding: 0 0 10px 0;
}

.catalog .filters-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 98;
    background-color: rgba(29, 43, 79, 0.4);
}

/* Адаптация каталога */
@media (max-width: 1440px) {
    .products-hero .main-text {
        padding-left: 60px;
    }

    .catalog {
        padding: 50px 60px;
    }
}

@media (max-width: 1240px) {
    .products-hero {
        min-height: 340px;
    }

    .products-hero .main-text {
        padding-left: 40px;
        width: 440px;
    }

    .products-hero .main-text h2 {
        font-size: 34px;
    }

    .catalog {
        padding: 40px;
        gap: 20px;
    }

    .catalog .filters {
        width: 230px;
    }

    .catalog .cards {
        gap: 15px;
    }
}

@media (max-width: 1024px) {
    /* Фото на всю ширину, текст поверх пустой части снимка */
    .products-hero {
        flex-direction: column;
        align-items: stretch;
        min-height: auto;
        padding-top: 35px;
        padding-bottom: 78%;
        background-image: url('/images/catalog-section-tablet.jpg');
        background-position: center bottom;
        background-size: 100% auto;
    }

    .products-hero .main-text {
        padding: 0 30px 30px 30px;
        width: auto;
        flex-shrink: 1;
        text-align: center;
    }

    .catalog {
        padding: 30px;
    }

    .catalog .filters {
        position: fixed;
        top: 0;
        left: 0;
        width: 80%;
        max-width: 420px;
        height: 100%;
        z-index: 99;
        background-color: #ffffff;
        border: none;
        border-radius: 0;
        padding: 25px 30px;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .catalog .filters.open {
        transform: translateX(0);
    }

    .catalog .filters .filters-close {
        display: block;
    }

    .catalog .toolbar {
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .catalog .toolbar .search {
        flex-basis: 100%;
        max-width: 100%;
    }

    .catalog .toolbar .filters-button {
        display: flex;
    }
}

@media (max-width: 900px) {
    .catalog .cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .products-hero {
        background-image: url('/images/catalog-section-phone.jpg');
    }

    .products-hero .main-text h2 {
        font-size: 30px;
    }

    .catalog {
        padding: 25px 20px;
    }

    .catalog .cards .card .image {
        height: 180px;
    }
}

@media (max-width: 480px) {
    .products-hero .main-text {
        padding: 0 16px 25px 16px;
    }

    .products-hero .main-text h2 {
        font-size: 26px;
    }

    .products-hero .main-text h3 {
        font-size: 16px;
    }

    .catalog {
        padding: 20px 16px;
    }

    .catalog .cards {
        gap: 10px;
    }

    .catalog .cards .card {
        padding: 10px;
    }

    .catalog .cards .card .image {
        height: 140px;
    }

    .catalog .cards .card h3 {
        font-size: 14px;
    }

    .catalog .cards .card .sku {
        font-size: 12px;
    }

    .catalog .cards .card .price {
        font-size: 17px;
    }

    .catalog .cards .card .add-to-cart {
        font-size: 12px;
        gap: 6px;
        padding: 9px;
    }

    .catalog .toolbar .sort .sort-button,
    .catalog .toolbar .filters-button {
        padding: 10px 12px;
        font-size: 13px;
    }

    /* Кнопки фильтра и сортировки в один ряд равной ширины */
    .catalog .toolbar .filters-button,
    .catalog .toolbar .sort {
        flex: 1;
    }

    .catalog .toolbar .filters-button {
        justify-content: space-between;
    }

    .catalog .toolbar .sort .sort-button {
        width: 100%;
        justify-content: space-between;
    }

    .catalog .pagination button {
        min-width: 32px;
        height: 32px;
    }

    .catalog .filters {
        padding: 20px 24px;
    }
}

@media (max-width: 360px) {
    .catalog .toolbar .filters-button,
    .catalog .toolbar .sort {
        flex-basis: 100%;
    }
}

/* Короткий текст кнопки на карточках */
.catalog .cards .card .add-to-cart .short {
    display: none;
}

@media (max-width: 768px) {
    .catalog .cards .card .add-to-cart .full {
        display: none;
    }

    .catalog .cards .card .add-to-cart .short {
        display: inline;
    }

    .catalog .pagination {
        justify-content: center;
    }
}

/* Широкие экраны */
@media (min-width: 1680px) {
    .products-hero .main-text {
        padding-left: 12%;
    }

    .catalog {
        padding-left: 12%;
        padding-right: 12%;
    }
}
