/* ========== БАЗОВЫЕ СТИЛИ ========== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    overflow-x: hidden;
}

/* ========== ОСНОВНАЯ СТРУКТУРА ========== */
.gallery-layout {
    display: grid;
    grid-template-columns: 1fr; /* Всегда одна колонка, так как фильтры выплывающие */
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    align-items: start;
    width: 100%;
}

.gallery-main {
    order: 1;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* ========== ВЫПЛЫВАЮЩАЯ ФИЛЬТРАЦИЯ ========== */
/* ЕДИНЫЕ СТИЛИ ДЛЯ ВСЕХ УСТРОЙСТВ */

/* КНОПКА ОТКРЫТИЯ ФИЛЬТРОВ — тот же стиль и механика, что у «Контакты» в хедере и у CTA
   в секциях главной: чёрная кнопка, при наведении заливка пропадает и остаётся обводка,
   текст и стрелка меняются местами (дистанция считается в JS — см. shop.html). */
.mobile-filter-btn {
    /* display:flex (не inline-flex) обязателен: margin:auto центрирует только блочные
       элементы, а inline-flex остаётся в строчном контексте и прижимается влево —
       именно так кнопка и съехала до этого фикса. width:fit-content — чтобы блок был
       по размеру содержимого и при этом мог центрироваться через auto-отступы. */
    /* ✅ Safari (в отличие от Chrome) может не подхватывать :hover-переходы на <button>,
       пока не сброшен нативный вид элемента формы — единственная из наших кнопок-«свопов»,
       сделанная как <button>, а не <a>, поэтому и ловила баг только там: реакция появлялась
       будто бы по клику, потому что клик форсировал перерисовку, а не потому что эффект и
       правда завязан на нажатие. */
    -webkit-appearance: none;
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: fit-content;
    max-width: none;
    margin: 0 auto 30px auto;
    padding: 0 26px;
    height: 48px;
    background: #0a0a0a;
    color: #ffffff;
    border: 1.5px solid #0a0a0a;
    border-radius: 6px;
    font-family: var(--font-main);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
    letter-spacing: 1px;
    text-transform: lowercase;
    position: relative;
    overflow: hidden;
    z-index: 100;
}

.mobile-filter-btn:hover {
    background: transparent;
    color: #0a0a0a;
}

.mobile-filter-btn__label,
.mobile-filter-btn__arrow {
    transition: transform 0.3s ease;
    /* Та же поправка оптического центрирования текста в Oswald, что и у «Контакты» в хедере
       (header-footer.css) — асимметрия резерва над/под строкой у шрифта, а не line-height.
       Задана отдельно для текста и стрелки ниже — она зависит от font-size, а он у них разный. */
    line-height: 1;
    position: relative;
}

/* ✅ По подобию кнопки «Контакты» в хедере: Oswald Thin, размер — 60% от высоты кнопки
   (кнопка 48px → 29px). top подобран по скриншоту под этот конкретный размер/начертание. */
.mobile-filter-btn__label {
    font-family: var(--font-main);
    font-weight: 200;
    font-size: 29px;
    top: -5px;
}

.mobile-filter-btn__arrow {
    display: inline-flex;
    font-size: 16px;
    top: -1px;
}

.mobile-filter-btn:hover .mobile-filter-btn__label {
    transform: translateX(var(--filter-btn-label-shift, 26px));
}

.mobile-filter-btn:hover .mobile-filter-btn__arrow {
    transform: translateX(var(--filter-btn-arrow-shift, -66px));
}

/* ✅ Раньше здесь была background:transparent — .active навешивается JS-ом при ОТКРЫТИИ
   панели (по клику) и висит, пока панель открыта, независимо от того, наведена ли мышь.
   Из-за этого кнопка залипала в «прозрачном» виде после клика, что выглядело как смена
   по нажатию, а не по наведению. Сброс/смена вида должны идти только через :hover. */

/* СЧЕТЧИК АКТИВНЫХ ФИЛЬТРОВ */
.filter-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-accent);
    color: #0a0a0a;
    border-radius: 30px;
    padding: 2px 9px;
    font-size: 13px;
    font-weight: 700;
    min-width: 22px;
    transition: transform 0.2s ease;
}

/* САЙДБАР ФИЛЬТРОВ - ВЫПЛЫВАЕТ СЛЕВА. Стиль — как у панели конструктора рам
   (BrandNewFrame.html/framestyles.css .panel): белый фон, острые углы, чёрная обводка,
   без градиентов и блюра. */
.filters-sidebar {
    position: fixed !important;
    top: 0;
    left: -100%;
    width: 380px;
    max-width: 90%;
    height: 100vh;
    max-height: 100vh;
    margin: 0 !important;
    border-radius: 0 !important;
    z-index: 9999;
    transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: none;
    overflow-y: auto;
    padding: 30px 25px !important;
    background: #ffffff !important;
    border: none;
    border-right: 3px solid #0a0a0a;
}

.filters-sidebar.active {
    left: 0;
}

/* ЗАТЕМНЕНИЕ ФОНА — без блюра, чтобы не спорить со строгой геометрией панели */
.filters-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.75);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.filters-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ХЕДЕР ФИЛЬТРОВ */
.filters-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #0a0a0a;
}

.filters-header h2 {
    margin: 0;
    font-family: var(--font-main);
    font-size: 20px;
    font-weight: 700;
    color: #0a0a0a;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

/* КНОПКА ЗАКРЫТИЯ */
.close-filters {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #0a0a0a;
    border: 1.5px solid #0a0a0a;
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    font-size: 18px;
}

.close-filters:hover {
    background: transparent;
    color: #0a0a0a;
}

/* ========== ПОИСК ========== */
.search-filter {
    position: relative;
    margin-bottom: 20px;
    width: 100%;
}

.search-filter input {
    width: 100%;
    padding: 12px 44px 12px 14px;
    border: 2px solid #0a0a0a;
    border-radius: 0;
    font-family: var(--font-main);
    font-size: 14px;
    background: #ffffff;
    color: #0a0a0a;
    transition: background 0.2s ease;
}

.search-filter input:focus {
    border-color: #0a0a0a;
    background: #f1efe9;
    outline: none;
    box-shadow: none;
}

.search-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #0a0a0a;
    font-size: 16px;
}

/* ========== СЕКЦИИ ФИЛЬТРОВ ========== */
.filter-section {
    margin-bottom: 0;
    border: none;
    border-bottom: 1px solid rgba(10, 10, 10, 0.15);
    border-radius: 0;
    overflow: hidden;
    background: #ffffff;
    transition: all 0.3s ease;
    box-shadow: none;
    width: 100%;
    animation: slideInLeft 0.5s ease forwards;
    opacity: 0;
}

.filter-section:nth-child(1) { animation-delay: 0.1s; }
.filter-section:nth-child(2) { animation-delay: 0.2s; }
.filter-section:nth-child(3) { animation-delay: 0.3s; }
.filter-section:nth-child(4) { animation-delay: 0.4s; }
.filter-section:nth-child(5) { animation-delay: 0.5s; }

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.filter-section.active {
    border-color: rgba(10, 10, 10, 0.15);
    box-shadow: none;
}

.filter-header {
    padding: 16px 4px;
    background: transparent;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: opacity 0.2s ease;
    width: 100%;
}

.filter-header:hover {
    opacity: 0.65;
}

.filter-title {
    font-family: var(--font-main);
    font-size: 13px;
    font-weight: 700;
    color: #0a0a0a;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.filter-title i {
    color: #0a0a0a;
    width: 18px;
    text-align: center;
    font-size: 14px;
}

.filter-toggle {
    color: #0a0a0a;
    font-size: 14px;
    transition: transform 0.3s ease;
}

.filter-section.active .filter-toggle {
    transform: rotate(180deg);
    color: #0a0a0a;
}

.filter-content {
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s ease;
    background: white;
    width: 100%;
}

.filter-section.active .filter-content {
    max-height: 350px;
}

/* ========== ЧЕКБОКСЫ ========== */
.filter-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 18px;
    transform: translateY(-5px);
    opacity: 0;
    transition: all 0.3s ease;
    width: 100%;
}

.filter-section.active .filter-options {
    transform: translateY(0);
    opacity: 1;
    padding: 18px;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 4px;
    background: transparent;
    border-radius: 0;
    border: none;
    transition: opacity 0.2s ease;
    cursor: pointer;
    width: 100%;
}

.filter-option:hover {
    opacity: 0.7;
    transform: none;
    box-shadow: none;
}

.filter-option input {
    display: none;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #0a0a0a;
    border-radius: 0;
    position: relative;
    transition: background 0.15s ease;
    flex-shrink: 0;
    background: white;
}

.filter-option input:checked + .checkbox-custom {
    background: #0a0a0a;
    border-color: #0a0a0a;
    transform: none;
}

.filter-option input:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 12px;
    font-weight: bold;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.option-label {
    font-family: var(--font-main);
    font-size: 13px;
    color: #0a0a0a;
    font-weight: 500;
    flex: 1;
    word-wrap: break-word;
}

.option-count {
    font-family: var(--font-main);
    font-size: 11px;
    color: #55534c;
    background: #f1efe9;
    padding: 4px 8px;
    border-radius: 0;
    font-weight: 600;
    flex-shrink: 0;
}

/* ========== ЦЕНОВОЙ ФИЛЬТР ========== */
.price-filter {
    background: #f1efe9;
    padding: 15px;
    border-radius: 0;
    transform: translateY(-5px);
    opacity: 0;
    transition: all 0.3s ease;
    width: 100%;
}

.filter-section.active .price-filter {
    transform: translateY(0);
    opacity: 1;
}

.price-inputs {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.price-inputs input {
    flex: 1;
    padding: 10px;
    border: 2px solid #0a0a0a;
    border-radius: 0;
    font-family: var(--font-main);
    font-size: 13px;
    text-align: center;
    background: #ffffff;
    color: #0a0a0a;
    transition: background 0.2s ease;
}

.price-inputs input:focus {
    border-color: #0a0a0a;
    outline: none;
    box-shadow: none;
    background: #f1efe9;
}

.price-separator {
    color: #0a0a0a;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

/* ========== АКТИВНЫЕ ФИЛЬТРЫ ========== */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #0a0a0a;
    min-height: 40px;
    width: 100%;
}

.active-filter {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #0a0a0a;
    color: white;
    padding: 6px 12px;
    border-radius: 0;
    font-family: var(--font-main);
    font-size: 11px;
    font-weight: 600;
    animation: slideInUp 0.3s ease;
    box-shadow: none;
    word-wrap: break-word;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.remove-filter {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    cursor: pointer;
    padding: 2px;
    border-radius: 50%;
    transition: all 0.2s ease;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
}

.remove-filter:hover {
    background: rgba(255,255,255,0.3);
}

/* ========== КНОПКА СБРОСА — как .btn в конструкторе: инверсия заливки на ховере ========== */
.reset-filters {
    width: 100%;
    padding: 12px;
    background: #0a0a0a;
    color: white;
    border: 1.5px solid #0a0a0a;
    border-radius: 6px;
    font-family: var(--font-main);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 20px;
    box-shadow: none;
}

.reset-filters:hover {
    background: transparent;
    color: #0a0a0a;
    transform: none;
    box-shadow: none;
}

/* ========== РЕЗУЛЬТАТЫ ========== */
.results-info {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    font-family: var(--font-main);
    font-size: 16px;
    color: #2d3748;
    text-align: center;
    border: 1px solid #e2e8f0;
    width: 100%;
}

/* ========== СЕТКА ТОВАРОВ - 4 КОЛОНКИ НА ДЕСКТОПЕ ========== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 колонки на десктопе */
    gap: 25px;
    width: 100%;
    align-items: start;
}

.product-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    height: fit-content;
    width: 100%;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

/* ✅ Раньше высота была фиксированной (200px), а фото вписывалось внутрь через
   object-fit:contain — из-за разных пропорций фотографий по бокам/сверху-снизу оставались
   пустые поля с градиентом. Теперь высота блока не задаётся, а следует за естественными
   пропорциями конкретного фото (ширина = 100% карточки, высота — по соотношению сторон) —
   картинка растягивается на всю ширину карточки без обрезки и без искажений. Карточки в
   ряду от этого становятся разной высоты, но грid уже настроен на это (align-items:start,
   .product-card{height:fit-content}). */
.product-image-container {
    width: 100%;
    overflow: hidden;
    display: block;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.product-image {
    width: 100%;
    height: auto;
    display: block;
    transition: all 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.product-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* ✅ Шрифт выбран по итогам сравнения кандидатов (см. историю) — Oswald Thin для заголовка
   и цены карточки товара. */
.product-title {
    font-family: var(--font-main);
    font-weight: 200;
    font-size: 20px;
    color: #2d3748;
    margin: 0 0 10px 0;
    line-height: 1.4;
    flex: 1;
    word-wrap: break-word;
}

.product-price {
    font-family: var(--font-main);
    font-weight: 200;
    font-size: 25px;
    color: #667eea;
    margin-top: auto;
    text-align: right;
}

/* ========== УБИРАЕМ ПОДЧЕРКИВАНИЯ ========== */
.service-card-link,
.service-card-link:hover,
.service-card-link:focus,
.service-card-link:active,
.product-info,
.product-title,
.product-price,
.product-card:hover .product-title,
.product-card:hover .product-price,
.results-info,
.results-info span {
    text-decoration: none !important;
    border: none !important;
    outline: none !important;
    color: inherit !important;
}

.service-card-link {
    display: block;
    width: 100%;
}

/* ========== СООБЩЕНИЕ "НЕТ ТОВАРОВ" ========== */
.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 16px;
    font-family: var(--font-main);
    font-size: 18px;
    color: #64748b;
    border: 2px dashed #cbd5e0;
    display: none;
    width: 100%;
}

.no-products.show {
    display: block;
}

.no-products i {
    font-size: 48px;
    color: #cbd5e0;
    margin-bottom: 20px;
    display: block;
}

/* ========== АДАПТИВНОСТЬ ========== */
@media (max-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr); /* 3 колонки на средних экранах */
        gap: 20px;
    }
}

@media (max-width: 900px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 колонки на планшетах */
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .gallery-layout {
        padding: 0 12px;
        gap: 25px;
    }
    
    .filters-sidebar {
        width: 340px;
        padding: 25px 20px !important;
    }
    
    .mobile-filter-btn {
        margin-bottom: 25px;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 колонки */
        gap: 15px;
    }
    
    .product-info {
        padding: 15px;
    }
    
    .product-title {
        font-size: 18px;
    }
    
    .product-price {
        font-size: 22px;
    }
}

@media (max-width: 600px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 колонки на маленьких */
        gap: 12px;
    }
    
    .gallery-layout {
        padding: 0 10px;
    }
    
    .filter-count-badge {
        padding: 2px 10px;
        font-size: 13px;
        min-width: 24px;
    }
    
    .filters-header h2 {
        font-size: 20px;
    }
    
    .price-inputs {
        flex-direction: column;
        gap: 10px;
    }
    
    .price-inputs input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr; /* 1 колонка на мобильных */
        gap: 15px;
    }
    
    .filters-sidebar {
        width: 100%;
        max-width: 100%;
        border-radius: 0 !important;
        padding: 20px 15px !important;
    }
    
    .filter-header {
        padding: 12px;
    }
    
    .filter-title {
        font-size: 13px;
    }
    
    
    .product-title {
        font-size: 18px;
    }
    
    .product-price {
        font-size: 22px;
    }
    
    .results-info {
        padding: 15px;
        font-size: 14px;
    }
    
    .no-products {
        padding: 40px 15px;
        font-size: 16px;
    }
    
    .no-products i {
        font-size: 36px;
    }
}

@media (max-width: 360px) {
    .gallery-layout {
        padding: 0 5px;
    }
    
    .product-card {
        border-radius: 12px;
    }
    
    .product-title {
        font-size: 16px;
    }
    
    .product-price {
        font-size: 20px;
    }
}

/* ========== ДОПОЛНИТЕЛЬНЫЕ СТИЛИ ========== */
.main-content-wrapper {
    width: 100%;
    overflow-x: hidden;
}

.store-description,
.services-header {
    max-width: 100%;
    word-wrap: break-word;
    padding: 0 20px;
    margin: 0 auto;
}