/* ═══════════════════════════════════════════════════ */
/* КАТАЛОГ: СТИЛИ                                       */
/* Файл: css/catalog.css                                */
/* ═══════════════════════════════════════════════════ */

/* 🔹 ГЛОБАЛЬНЫЕ ОГРАНИЧЕНИЯ */
*, *::before, *::after { box-sizing: border-box; }
body { overflow-x: hidden; }

/* 🔹 БАЗА - Убираем все отступы у main */
.catalog-main {
    padding: 40px 0 20px 0 !important;
    margin: 0 !important;
    background: #fff;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* 🔹 КОНТЕЙНЕР КАТАЛОГА - здесь задаем отступы как у хедера */
/* ⚠️ ОТСТУПЫ: меняй значения 192px под свой хедер */
.catalog-container {
    padding-left: 80px !important;
    padding-right: 80px !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* 🔹 ЗАГОЛОВОК СТРАНИЦЫ */
.page-title {
    margin: 0 0 20px 0;
    font-size: 28px;
    color: #100C35;
}

/* 🔹 РАСКЛАДКА - расстояние между фильтрами и товарами */
/* ⚠️ РАССТОЯНИЕ МЕЖДУ ФИЛЬТРОМ И КАРТОЧКАМИ: меняй 20px */
.catalog-wrapper {
    display: flex;
    gap: 20px;           /* ⚠️ Здесь расстояние между фильтром и товарами (10-20px) */
    margin-top: 20px;
    align-items: flex-start;
}

/* 🔹 ШИРИНА ФИЛЬТРОВ - фиксированная */
.catalog-sidebar {
    width: 280px;        /* ⚠️ Ширина панели фильтров */
    flex-shrink: 0;
}

/* 🔹 КОНТЕНТ С ТОВАРАМИ - растягивается */
.catalog-content {
    flex: 1;
    min-width: 0;
    width: 100%;
    overflow-x: hidden;
}

/* 🔹 ПАНЕЛЬ ФИЛЬТРОВ */
.filters-panel {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 10px;
    position: sticky;
    top: 20px;
    width: 100%;
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.filters-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #100C35;
}

.filters-header button {
    background: none;
    border: none;
    color: #7B68EE;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    padding: 4px 8px;
}

/* 🔹 СЕКЦИИ ФИЛЬТРОВ */
.filter-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filter-section h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #100C35;
}

/* 🔹 ЦЕНА: ПОЛЯ ВВОДА */
.price-inputs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.price-inputs > div { flex: 1; }

.price-inputs label {
    display: block;
    font-size: 11px;
    color: #666;
    margin-bottom: 4px;
}

.price-inputs input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
}

/* 🔹 СЛАЙДЕР ЦЕНЫ */
.price-slider-container {
    position: relative;
    height: 30px;
    margin: 15px 0 20px 0;
    display: flex;
    align-items: center;
}

.price-range-slider {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    margin: 0;
}

.price-slider-track {
    position: absolute;
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    z-index: 1;
}

.price-slider-fill {
    position: absolute;
    height: 100%;
    background: #7B68EE;
    border-radius: 3px;
    left: 0;
    right: 0;
    transition: right 0.1s;
}

.price-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #7B68EE;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.price-range-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #7B68EE;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* КНОПКА ПРИМЕНИТЬ */
.btn-apply {
    width: 100%;
    padding: 10px;
    background: #7B68EE;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    margin-top: 4px;
    display: block;
    clear: both;
}

.btn-apply:hover { background: #100C35; }

/* 🔹 КАТЕГОРИИ */
.filter-checkbox {
    display: flex;
    align-items: center;
    padding: 5px 0;
    cursor: pointer;
    font-size: 13px;
    color: #333;
}

.filter-checkbox input {
    width: 16px;
    height: 16px;
    margin-right: 10px;
    accent-color: #7B68EE;
}

/* 🔹 ЦВЕТА */
.color-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ddd;
    transition: all 0.2s;
    position: relative;
}

.color-swatch:hover {
    transform: scale(1.1);
    border-color: #7B68EE;
}

.color-swatch.active {
    border: 3px solid #7B68EE;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #7B68EE;
    transform: scale(1.1);
}

.color-swatch.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* 🔹 СЧЁТЧИК ТОВАРОВ */
.filters-footer {
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
    font-size: 12px;
    color: #666;
}

.filters-footer strong {
    color: #7B68EE;
    font-size: 15px;
    font-weight: 700;
}

/* 🔹 ПАНЕЛЬ ИНСТРУМЕНТОВ (сортировка) */
.catalog-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

#catalogTitle {
    font-size: 15px;
    color: #100C35;
    font-weight: 600;
}

#sortSelect {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

/* 🔹 СЕТКА ТОВАРОВ - 4 карточки */
/* ⚠️ РАССТОЯНИЕ МЕЖДУ КАРТОЧКАМИ: меняй 16px */
.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;           /* ⚠️ Расстояние между карточками */
    width: 100%;
    margin: 0;

}

/* 🔹 КАРТОЧКА ТОВАРА */
.product-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-item:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border-color: #7B68EE;
}

.product-image {
    width: 100%;
    aspect-ratio: 1;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 12px;
}

.product-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-name {
    font-weight: 600;
    font-size: 13px;
    color: #100C35;
    margin: 0 0 6px 0;
    min-height: 36px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-article {
    font-size: 11px;
    color: #999;
    margin: 0 0 8px 0;
}

.product-price {
    font-weight: 700;
    font-size: 17px;
    color: #7B68EE;
}

.btn-add-cart {
    width: 100%;
    height: 36px;
    background: #7B68EE;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    margin-top: auto;
}

.btn-add-cart:hover {
    background: #100C35;
    transform: translateY(-2px);
}

/* 🔹 ЗАГРУЗКА / НЕТ ТОВАРОВ */
#loadingIndicator,
#noProductsMessage {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
}

.loader {
    width: 36px;
    height: 36px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #7B68EE;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════ */
/* 🔹 АДАПТАЦИЯ                                        */
/* ═══════════════════════════════════════════════════ */

/* Планшеты (3 карточки) */
@media (max-width: 1024px) {
    .catalog-container {
        padding-left: 32px !important;
        padding-right: 32px !important;
    }
    
    .catalog-wrapper { 
        flex-direction: column; 
    }
    
    .catalog-sidebar { 
        width: 100%; 
        margin-bottom: 20px; 
    }
    
    .products-grid { 
        grid-template-columns: repeat(3, 1fr); 
    }
}

/* Мобильные (2 карточки) */
@media (max-width: 768px) {
    .catalog-container {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
    
    .products-grid { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 12px; 
    }
    
    .mobile-filters-toggle {
        display: block !important;
        width: 100%;
        padding: 12px;
        background: #7B68EE;
        color: #fff;
        border: none;
        border-radius: 8px;
        font-weight: 600;
        font-size: 14px;
        margin-bottom: 15px;
        cursor: pointer;
    }
    
    .catalog-sidebar {
        display: none;
        width: 100%;
        max-height: 70vh;
        overflow-y: auto;
        border: 1px solid #eee;
        border-radius: 12px;
        padding: 10px;
        background: #fff;
    }
    
    .catalog-sidebar.is-open {
        display: block !important;
        animation: fadeIn 0.3s ease;
    }
    
    .product-name { font-size: 11px; }
    .product-price { font-size: 14px; }
    .btn-add-cart { height: 32px; font-size: 11px; }
}

/* Очень маленькие (1 карточка) */
@media (max-width: 480px) {
    .products-grid { 
        grid-template-columns: 1fr; 
    }
    
    .catalog-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════ */
/* СЛАЙДЕР ЦЕНЫ (ПОЛЗУНОК)                             */
/* ═══════════════════════════════════════════════════ */

.price-slider-wrapper {
    position: relative;
    height: 30px;
    margin: 15px 0 20px 0;
    display: flex;
    align-items: center;
}

.price-range-input {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    margin: 0;
}

.price-slider-track {
    position: absolute;
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    z-index: 1;
}

.price-slider-fill {
    position: absolute;
    height: 100%;
    background: #7B68EE;
    border-radius: 3px;
    left: 0;
    right: 0%;
    transition: right 0.1s;
}

.price-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #7B68EE;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.price-range-input::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #7B68EE;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* ═══════════════════════════════════════════════════ */
/* СКИДКА В КАТАЛОГЕ                                   */
/* ═══════════════════════════════════════════════════ */

.product-old-price {
    font-size: 13px;
    color: #999;
    text-decoration: line-through;
    margin-left: 8px;
}

.product-discount {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #A80000;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    z-index: 2;
}

.product-price {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
/* ═══════════════════════════════════════════════════ */
/* ЭФФЕКТЫ НАВЕДЕНИЯ НА КАРТОЧКИ (ИСПРАВЛЕНО)         */
/* ═══════════════════════════════════════════════════ */

/* 1. Ссылка-обёртка: отвечает за подъём всей карточки */
.product-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.product-card-link:hover {
    transform: translateY(-8px); /* Карточка поднимается */
}

/* 2. Сама карточка: тень и рамка */
.products-grid .product-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.product-card-link:hover .product-item {
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
    border-color: #7B68EE;
}

/* 3. Контейнер фото: обрезает выходящие края при зуме */
.products-grid .product-image {
    overflow: hidden;
    position: relative;
}

/* 4. Фото товара: плавный зум */
.products-grid .product-img {
    transition: transform 0.4s ease;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-card-link:hover .product-img {
    transform: scale(1.08); /* Фото увеличивается */
}

/* 5. Кнопка "В корзину" */
.products-grid .btn-add-cart {
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}
.products-grid .btn-add-cart:hover {
    background: #100C35;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(123, 104, 238, 0.3);
}

/* ══════════════════════════════════════════════════ */
/* КРУЖОЧКИ ЦВЕТОВ В КАРТОЧКЕ КАТАЛОГА */
/* ═══════════════════════════════════════════════════ */

.product-colors {
    display: flex;
    gap: 6px;
    margin: 8px 0;
    flex-wrap: wrap;
}

.color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.2s;
}

.color-swatch:hover {
    transform: scale(1.2);
    border-color: #7B68EE;
}

/* Белый цвет — добавляем серую рамку, чтобы было видно */
.color-swatch[style*="background-color: #FFFFFF"] {
    border-color: #ccc;
}


/* ═══════════════════════════════════════════════════ */
/* ФИНАЛЬНЫЕ ИСПРАВЛЕНИЯ КАРТОЧЕК КАТАЛОГА            */
/* ═══════════════════════════════════════════════════ */

/* 1. УБИРАЕМ серый фон у контейнера картинки */
.product-image {
    background: #ffffff !important; /* Было #f8f9fa, теперь чисто белый */
}

/* 2. ГАРАНТИРОВАННО убираем подчеркивание у ссылок и названий */
.product-card-link, 
.product-card-link h3, 
.product-card-link .product-name,
.product-item a {
    text-decoration: none !important;
    color: inherit;
}

/* 3. СТИЛИ ДЛЯ КРУЖОЧКОВ ЦВЕТОВ ВНУТРИ КАРТОЧКИ (КАК НА OASIS) */
.product-colors {
    display: flex;
    gap: 6px;
    margin: 8px 0 12px 0;
    flex-wrap: wrap;
}

.product-colors .color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    position: relative;
}

.product-colors .color-swatch:hover {
    transform: scale(1.15);
    border-color: #7B68EE;
}

/* Белый цвет делаем с серой рамкой, чтобы его было видно на белом фоне */
.product-colors .color-swatch[style*="background-color: #FFFFFF"],
.product-colors .color-swatch[style*="background-color: #fff"] {
    border: 1px solid #ccc !important;
}


/* ═══════════════════════════════════════════════════ */
/* 🔥 v6: ЛИПКИЙ ХЕДЕР-КАРТОЧКА ПО ШИРИНЕ КОНТЕНТА      */
/* Сама шапка прозрачная, белая карточка = .container   */
/* ═══════════════════════════════════════════════════ */
html, body { overflow-x: clip !important; } /* лечит «нелипучесть» sticky */

header.header {
    position: sticky !important;   /* липнет к верху */
    top: 10px !important;          /* зазор сверху, как в дизайне */
    z-index: 9999 !important;      /* поверх всего */
    background: transparent !important; /* ✅ полоса прозрачная */
    box-shadow: none !important;   /* ✅ тени убраны */
}

/* Белая карточка — внутренний контейнер:               */
/* его ширина ВСЕГДА равна ширине контента на странице  */
header.header .container {
    background: #ffffff;
    border-radius: 12px;           /* скругление как у карточки (можно 12–20) */
    box-shadow: none;
}

/* ✅ Логотип-ссылка: рука, без подчёркивания */
a.logo {
    text-decoration: none !important;
    color: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}
a.logo:hover { opacity: 0.85; }

 /*🔥 v7: убираем «дырку» над прилипшей карточкой —*/
 /*  обнуляем старые отступы шапки и карточки */
header.header {
    margin-top: 10px !important;
    padding-top: 10px !important;
}
header.header .container {
    margin-top: 10px !important;
}


/* 🔥 СТИЛИ ДЛЯ ПОИСКА В КАТАЛОГЕ (v4.3) */
.catalog-search-wrapper {
    flex: 1;
    max-width: 400px;
}

.catalog-search-wrapper .search-input {
    width: 100%;
    transition: border-color 0.2s;
}

.catalog-search-wrapper .search-input:focus {
    outline: none;
    border-color: #7B68EE;
    box-shadow: 0 0 0 3px rgba(123, 104, 238, 0.1);
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .catalog-toolbar {
        flex-direction: column;
        gap: 12px;
    }
    
    .catalog-search-wrapper {
        max-width: 100%;
        width: 100%;
    }
    
    .catalog-search-wrapper .search-input {
        min-width: auto;
    }
}