.page-hero {
    background-color: var(--bg-light-gray);
    padding: 60px 0;
    text-align: center;
    position: relative;
    z-index: 2;
}

.page-title {
    font-size: 42px;
    color: var(--text-dark);
    margin-bottom: 15px;
    font-weight: 800;
    letter-spacing: -1px;
}

.page-subtitle {
    font-size: 16px;
    color: var(--text-gray);
    max-width: 500px;
    margin: 0 auto;
}

.catalog-main-section {
    background-color: var(--bg-white);
    padding: 80px 0 120px;
    position: relative;
}

.wave-top, .wave-bottom {
    position: absolute;
    left: 0;
    width: 100%;
    overflow: hidden;
    line-height: 0;
}

.wave-top { top: -1px; }
.wave-bottom { bottom: -1px; transform: rotate(180deg); }

.wave-top svg, .wave-bottom svg {
    position: relative;
    display: block;
    width: calc(100% + 1.3px);
    height: 60px;
}

.wave-top .shape-fill { fill: var(--bg-light-gray); }
.wave-bottom .shape-fill { fill: var(--text-dark); }

.catalog-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 40px;
    align-items: start;
    position: relative;
    z-index: 3;
}

.sidebar-header-mobile { display: none; }

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
    text-transform: uppercase;
}

.sidebar-menu, .sub-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu > li { margin-bottom: 15px; }

.sidebar-menu a {
    transition: all 0.3s ease !important;
    display: inline-block;
}

.sidebar-menu a:hover:not(.active-cat-link) {
    color: var(--text-gray) !important;
    transform: translateX(5px);
}

.active-cat-link {
    color: var(--accent-beige-hover, #c28e38) !important;
    font-weight: 700 !important;
}

.cat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.main-cat {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    text-transform: none;
    text-decoration: none;
    letter-spacing: 1px;
    transition: color 0.4s ease;
    display: inline-block;
}

.toggle-icon {
    color: var(--text-gray);
    transition: transform 0.4s ease, color 0.4s ease;
    display: flex;
    align-items: center;
}

.cat-header:hover .main-cat,
.cat-header:hover .toggle-icon,
.main-cat:hover { color: var(--text-gray); }

.sub-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, margin-top 0.4s ease;
    padding-left: 15px;
    border-left: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 0;
}

.sub-menu.open { max-height: 300px; margin-top: 15px; }
.has-submenu.open .toggle-icon { transform: rotate(180deg); }

.sub-menu a {
    font-size: 14px;
    color: var(--text-gray);
    text-decoration: none;
    transition: color 0.3s ease, transform 0.3s ease; 
    display: inline-block;
}

.sub-menu a:hover, .sub-menu a.active {
    color: var(--text-dark);
    transform: translateX(5px); 
}

.catalog-content { display: flex; flex-direction: column; gap: 30px; }
.mobile-cat-btn { display: none; }

.catalog-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-light-gray);
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    flex-wrap: wrap;
    gap: 15px;
}

.products-count {
    font-size: 13px;
    color: var(--text-gray);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.products-count span { font-weight: 700; color: var(--text-dark); }

.catalog-search {
    flex-grow: 1;
    max-width: 320px;
    position: relative;
}

.catalog-search input {
    width: 100%;
    padding: 10px 40px 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: 30px;
    font-size: 13px;
    background-color: transparent;
    color: var(--text-dark);
    outline: none;
    transition: all 0.3s ease;
}

.catalog-search input:focus {
    border-color: var(--text-dark);
    background-color: var(--bg-light-gray);
}

.search-btn-inside {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    padding: 0;
    display: flex;
}
.search-btn-inside:hover { color: var(--text-dark); }

.sort-control { display: flex; align-items: center; gap: 12px; }

.sort-control label {
    font-size: 12px;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.custom-select { position: relative; width: 210px; }

.select-selected {
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 10px 18px;
    font-size: 13px;
    color: var(--text-dark);
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}
.select-selected:hover { background-color: rgba(0,0,0,0.03); }

.select-selected::after {
    content: '';
    border: solid var(--text-dark);
    border-width: 0 2px 2px 0;
    display: inline-block;
    padding: 3px;
    transform: rotate(45deg);
    transition: transform 0.3s ease;
    margin-bottom: 2px;
}
.select-selected.select-arrow-active::after { transform: rotate(-135deg); margin-top: 4px; }

.select-items {
    position: absolute;
    background-color: var(--bg-light-gray);
    top: 110%;
    left: 0;
    right: 0;
    z-index: 99;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.1);
    overflow: hidden;
    border: 1px solid var(--border-color);
}
.select-hide { display: none; }

.select-items div {
    color: var(--text-dark);
    padding: 12px 18px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}
.select-items div:hover, .same-as-selected { background-color: var(--bg-white); }

.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px 30px; 
}

.product-card {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease;
}
.product-card.is-touched { transform: translateY(-4px); }

.card-link::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1;
}

.product-image {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 5; /* Компактные вертикальные пропорции */
    height: auto;      
    overflow: hidden;
    border-radius: 8px; 
    display: block;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    
    /* Аппаратное ускорение (решает проблему дергания и потери качества) */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0) scale(1);
    will-change: transform;
}

.product-card:hover .product-image img,
.product-card.is-touched .product-image img { 
    transform: translateZ(0) scale(1.05); 
}

.no-photo-placeholder {
    width: 100%; height: 100%;
    background: #f1f5f9;
    display: flex; align-items: center; justify-content: center;
    color: #94a3b8; font-size: 14px;
}

.product-info { display: flex; flex-direction: column; flex-grow: 1; }
.product-title { font-size: 14px; margin: 0 0 6px 0; text-transform: uppercase; letter-spacing: 0.5px; }
.product-title a { color: var(--text-dark); text-decoration: none; transition: color 0.3s ease; }
.product-title a:hover { color: var(--text-gray); }

.product-status-row { display: flex; justify-content: space-between; align-items: center; margin-top: 5px; }
.product-meta { font-size: 13px; color: var(--text-gray); margin: 0; }
.stock-badge { font-size: 12px; color: #10b981; font-weight: 600; }

.product-bottom {
    margin-top: auto;
    padding-top: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
}

.product-price { font-size: 16px; font-weight: 700; color: var(--text-dark); }
.product-price span { font-size: 13px; font-weight: 400; color: var(--text-gray); }

.card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 2;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.qty-mini-control {
    display: flex; align-items: center; 
    background: transparent;
    border: 1px solid var(--text-gray);
    border-radius: 36px;
    overflow: hidden; 
    height: 36px;
    box-sizing: border-box;
}

.qty-mini-btn {
    border: none !important; background: transparent !important; 
    padding: 0 12px; cursor: pointer; 
    color: var(--text-dark); font-weight: 500; font-size: 18px; 
    margin: 0 !important; height: 100%; 
    display: flex; align-items: center; justify-content: center; 
    outline: none; box-shadow: none !important;
    transition: background 0.2s;
}
.qty-mini-btn:hover { background: rgba(0,0,0,0.05) !important; }

.qty-mini-input {
    width: 24px; text-align: center; 
    border: none !important; background: transparent !important; 
    font-size: 14px; font-weight: 600; 
    padding: 0 !important; pointer-events: none; 
    outline: none; color: var(--text-dark); 
    margin: 0 !important; height: 36px; line-height: 36px;
    -moz-appearance: textfield;
}
.qty-mini-input::-webkit-outer-spin-button,
.qty-mini-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.add-to-cart-btn {
    background: transparent !important;
    border: 1px solid var(--text-gray) !important;
    width: 36px !important; height: 36px !important;
    border-radius: 50% !important;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-dark) !important;
    cursor: pointer;
    transition: all 0.3s ease !important;
    padding: 0 !important; margin: 0 !important;
    box-sizing: border-box;
}

.add-to-cart-btn.is-touched,
.add-to-cart-btn:hover {
    background-color: var(--text-dark) !important;
    border-color: var(--text-dark) !important;
    color: var(--bg-light-gray) !important;
    transform: translateY(-2px) !important;
}

.unavailable-box { text-align: right; }
.out-of-stock-text { color: #ef4444; font-size: 12px; font-weight: 600; display: block; }
.available-date-text { color: #dc2626; font-size: 11px; font-weight: 500; display: block; margin-top: 2px; }

.empty-catalog-box {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    border: 1px dashed #cbd5e1;
}
.empty-catalog-box h3 { color: #475569; margin-bottom: 10px; }
.empty-catalog-box p { color: #64748b; }

.product-badge {
    position: absolute;
    top: 15px; left: 15px;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
    padding: 6px 12px; border-radius: 4px;
    z-index: 2;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15); 
}
.badge-new { background-color: #00a046; color: #ffffff; }
.badge-popular { background-color: #ffaa00; color: #111111; }
.badge-sale { background-color: #e63946; color: #ffffff; }

.sidebar-backdrop { display: none; }

@media (max-width: 1200px) {
    .products-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 992px) {
    .catalog-layout { grid-template-columns: 1fr; position: static; z-index: auto; }

    .sidebar-backdrop {
        display: block;
        position: fixed; top: 0; left: 0;
        width: 100%; height: 100vh;
        background-color: rgba(0, 0, 0, 0.5);
        opacity: 0; visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        z-index: 1050;
    }
    .sidebar-backdrop.active { opacity: 1; visibility: visible; }

    .sidebar {
        position: fixed; top: 0; left: -100%;
        width: 290px; height: 100vh;
        background-color: #ffffff;
        padding: 25px 20px;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.25);
        transition: left 0.4s ease;
        z-index: 1060;
        overflow-y: auto;
    }
    .sidebar.active { left: 0; }

    .sidebar-header-mobile {
        display: flex; justify-content: space-between; align-items: center;
        padding-bottom: 15px; margin-bottom: 20px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        color: var(--text-dark);
        font-size: 18px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 1px;
    }
    .close-sidebar {
        background: none; border: none; color: var(--text-dark);
        cursor: pointer; padding: 0; display: flex;
        align-items: center; justify-content: center;
    }
    .close-sidebar svg { width: 24px; height: 24px; stroke-width: 2; }

    .sidebar-title { display: none; }

    .sidebar-menu > li { margin-bottom: 0; }
    
    .sidebar-menu > li > .main-cat,
    .sidebar-menu > li > .cat-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 0;
        border-bottom: 1px solid rgba(0,0,0,0.03);
        width: 100%;
    }

    .main-cat {
        font-size: 16px; 
        padding: 0;
        display: block;
        color: var(--text-dark);
        text-transform: none;
    }

    .toggle-icon {
        padding: 5px; 
        margin-right: -5px;
    }
    .toggle-icon svg {
        width: 20px;
        height: 20px;
    }

    .sub-menu {
        display: none;
        margin: 0;
        padding-left: 15px;
        flex-direction: column;
        border-bottom: none;
        max-height: none;
        transition: none;
    }

    .sub-menu.open {
        display: flex;
        margin-top: 5px;
        margin-bottom: 10px;
    }

    .sub-menu li {
        margin: 0;
        padding: 0;
    }

    .sub-menu a {
        padding: 10px 0;
        font-size: 15px;
        display: block;
        color: var(--text-gray);
    }

    .page-title {
        font-size: 42px;
    }

    .page-subtitle {
        font-size: 14px;
    }

    .catalog-toolbar {
        display: flex; flex-wrap: wrap; align-items: center;
        gap: 10px; padding: 14px; border-radius: 24px;
        background-color: var(--bg-light-gray);
    }
    .products-count { display: none; }

    .catalog-search { order: 1; flex: 1 1 100%; width: 100%; max-width: 100%; margin: 0; }
    .catalog-search input {
        width: 100%; height: 42px; padding: 0 40px 0 16px;
        font-size: 14px; border-radius: 30px; box-sizing: border-box;
    }

    .mobile-cat-btn {
        order: 2; flex: 0 0 auto; height: 42px;
        display: flex; align-items: center; justify-content: center;
        gap: 8px; background: transparent;
        border: 1px solid var(--border-color); border-radius: 30px;
        padding: 0 16px; font-size: 13px; font-weight: 600;
        color: var(--text-dark); cursor: pointer; white-space: nowrap;
        box-sizing: border-box; transition: all 0.3s ease;
    }
    .mobile-cat-btn.is-touched, .mobile-cat-btn:hover {
        background-color: var(--text-dark); color: var(--bg-light-gray);
        border-color: var(--text-dark);
    }

    .sort-control {
        order: 3; flex: 1 1 auto; min-width: 0; margin: 0;
        display: flex; justify-content: flex-end;
    }
    .sort-control label { display: none; }

    .custom-select { width: 100%; max-width: 220px; height: 42px; position: relative; margin-left: auto; }
    .select-selected {
        width: 100%; height: 42px; padding: 0 14px; font-size: 13px;
        font-weight: 600; border-radius: 30px;
        display: flex; justify-content: space-between; align-items: center;
        gap: 6px; box-sizing: border-box; white-space: nowrap;
        overflow: hidden; text-overflow: ellipsis;
    }
    .select-items {
        right: 0; left: 0; width: 100%; min-width: 100%;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15); border-radius: 16px;
    }

    .product-card { gap: 10px; }
    .product-image { 
        height: auto !important; 
        aspect-ratio: 4 / 5; 
        border-radius: 10px; 
    }
    .product-info { gap: 4px; }

    .product-title {
        font-size: 13px; line-height: 1.35; margin: 0 0 4px;
        display: -webkit-box; -webkit-line-clamp: 2;
        -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em;
    }
    .product-status-row { flex-direction: column; align-items: flex-start; gap: 2px; margin-top: 0; }
    .product-meta { font-size: 11px; line-height: 1.3; }
    .stock-badge { font-size: 11px; line-height: 1.3; }

    .product-bottom { padding-top: 10px; flex-direction: column; align-items: stretch; gap: 10px; }
    .product-price { font-size: 15px; line-height: 1.2; }
    .product-price span { font-size: 11px; }

    .card-actions { justify-content: space-between; width: 100%; gap: 6px; flex-wrap: nowrap; }
    .qty-mini-control { height: 34px; flex: 1 1 auto; min-width: 0; justify-content: space-between; }
    .qty-mini-btn { padding: 0 10px; font-size: 16px; }
    .qty-mini-input { width: 22px; height: 34px; line-height: 34px; font-size: 13px; }
    .add-to-cart-btn { width: 34px !important; height: 34px !important; flex: 0 0 auto; }

    .unavailable-box { text-align: left; width: 100%; }
    .out-of-stock-text { font-size: 11px; }
    .available-date-text { font-size: 10px; }
}

@media (max-width: 576px) {
    .page-hero {
        padding: 40px 0;
    }

    .page-title {
        font-size: 32px;
        margin-bottom: 10px;
        letter-spacing: -0.5px;
    }

    .page-subtitle {
        font-size: 14px;
        padding: 0 15px;
    }

    .catalog-toolbar { padding: 10px; gap: 8px; }
    .catalog-search input { height: 38px; padding: 0 36px 0 14px; font-size: 13px; }
    .search-btn-inside { right: 10px; }
    .search-btn-inside svg { width: 16px; height: 16px; }

    .mobile-cat-btn { height: 38px; padding: 0 12px; font-size: 12px; }
    .custom-select { width: 100%; max-width: 170px; height: 38px; }
    .select-selected { height: 38px; padding: 0 12px; font-size: 12px; }

    .products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
    .product-card { gap: 8px; }
    .product-image { 
        height: auto !important; 
        aspect-ratio: 4 / 5;
        border-radius: 10px; 
    }
    .product-title { font-size: 12px; line-height: 1.3; margin: 0 0 2px; -webkit-line-clamp: 2; min-height: 2.6em; }
    .product-meta { font-size: 10px; }
    .stock-badge { font-size: 10px; }

    .product-bottom { padding-top: 8px; gap: 8px; }
    .product-price { font-size: 14px; }
    .product-price span { font-size: 10px; }

    .card-actions { gap: 6px; flex-wrap: nowrap; justify-content: space-between; }
    .qty-mini-control { flex: 1 1 auto; min-width: 0; height: 32px; border-radius: 30px; }
    .qty-mini-btn { padding: 0 8px; font-size: 15px; }
    .qty-mini-input { width: 20px; height: 32px; line-height: 32px; font-size: 12px; }
    .add-to-cart-btn { width: 32px !important; height: 32px !important; border-radius: 50% !important; }
    .add-to-cart-btn svg { width: 16px; height: 16px; }
}

@media (hover: none) and (pointer: coarse) {
    .product-card.is-touched { transform: none; }
    .product-card.is-touched .product-image img,
    .product-card:hover .product-image img { transform: none; }
}