:root {
    --primary-color: #ffdb4d;
    --bg-color: #f8f9fa;
    --text-color: #333;
    --border-radius: 12px;
}


body { 
    font-family: -apple-system, system-ui, sans-serif; 
    background: var(--bg-color); 
    margin: 0; 
    color: var(--text-color); 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh;
}

/* ШАПКА */
header {
    background: #fff;
    border-bottom: 1px solid #eee;
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1100;
}

.logo {
    font-size: 24px;
    font-weight: 900;
    text-decoration: none;
    color: #000;
    display: flex;
    align-items: center;
}

.logo span {
    background: var(--primary-color);
    padding: 2px 8px;
    border-radius: 6px;
    margin-left: 5px;
}

.search-box { display: flex; gap: 8px; margin-left: 20px; align-items: center; flex-grow: 1; max-width: 400px; }
.search-box input { width: 100%; padding: 8px 12px; border-radius: 6px; border: 1px solid #ccc; outline: none; }
.search-box button, .btn-filter { padding: 8px 15px; border-radius: 6px; border: none; background: var(--primary-color); font-weight: bold; cursor: pointer; transition: 0.2s; }
.search-box button:hover, .btn-filter:hover { background: #e6c545; }

.nav-links { display: flex; align-items: center; }
.nav-links a { text-decoration: none; color: #666; margin-left: 20px; font-size: 14px; font-weight: 600; }
.nav-links a:hover { color: #000; }

/* ОСНОВНОЙ КОНТЕЙНЕР КАТАЛОГА */
.catalog-layout {
    display: flex;
    flex: 1;
    overflow: hidden; 
    height: calc(100vh - 70px); 
}

/* САЙДБАР */
.sidebar { 
    width: 280px; 
    background: white; 
    border-right: 1px solid #e0e0e0; 
    display: flex; 
    flex-direction: column;
    flex-shrink: 0;
}

/* Скрываем плашку мобильного каталога на ПК */
.mobile-catalog-toggle {
    display: none;
}

.sidebar-header { padding: 25px; font-size: 18px; font-weight: 800; border-bottom: 1px solid #f0f0f0; margin: 0; }

.category-list { overflow-y: auto; padding: 10px 0; flex-grow: 1; }

.category-item { 
    padding: 12px 25px; 
    cursor: pointer; 
    font-size: 15px; 
    transition: 0.2s; 
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none; 
    color: inherit;
}

.category-item:hover { background: #fff9e6; }

.category-item.active { 
    background: var(--primary-color); 
    font-weight: bold; 
    color: #000; 
    border-left: 5px solid #000;
}

.count-badge { font-size: 11px; opacity: 0.5; background: #eee; padding: 2px 7px; border-radius: 10px; }

/* КОНТЕНТНАЯ ОБЛАСТЬ */
.main-content { flex-grow: 1; overflow-y: auto; padding: 30px 40px; position: relative; }

/* ГОРИЗОНТАЛЬНЫЙ ФИЛЬТР НАД ТОВАРАМИ */
.top-filter-bar {
    background: #fff;
    padding: 15px 25px;
    border-radius: var(--border-radius);
    border: 1px solid #eee;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.top-filter-bar .filter-title {
    font-weight: 700;
    font-size: 15px;
    color: #333;
}

.top-filter-bar form { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.sort-select { padding: 6px 10px; border: 1px solid #ddd; border-radius: 4px; outline: none; cursor: pointer; }
.filter-group { display: flex; align-items: center; gap: 10px; }

/* КОНТЕЙНЕР ДЛЯ ПОЛЕЙ ВВОДА ЦЕНЫ */
.price-inputs {
    display: flex;
    align-items: center;
    flex-wrap: nowrap !important; /* Запрещаем перенос полей на новую строку */
    white-space: nowrap;
    gap: 8px;
}

/* Базовые стили для полей ввода цены */
.price-inputs input {
    width: 90px;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    outline: none;
    font-size: 14px;
    transition: transform 0.2s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.2s ease;
    transform-origin: center center;
    position: relative;
    z-index: 1;
}

/* ЧИСТЫЙ ЗУМ: без изменения width, соседи не сдвигаются */
.price-inputs input:focus {
    transform: scale(1.5); /* Увеличиваем поле на 50% */
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    border-color: #888; 
    z-index: 10;
}

/* Скрываем стандартные стрелочки вверх/вниз */
.price-inputs input[type="number"]::-webkit-outer-spin-button,
.price-inputs input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.price-inputs input[type="number"] {
    -moz-appearance: textfield;
}

/* КАРТОЧКА ТОВАРА */
.product-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); 
    gap: 25px; 
}

.product-card { 
    background: white; 
    border-radius: var(--border-radius); 
    text-decoration: none; 
    color: inherit; 
    transition: 0.3s; 
    border: 1px solid #eee;
    display: flex; 
    flex-direction: column;
}

.product-card:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(0,0,0,0.08); border-color: var(--primary-color); }

.img-wrap { width: 100%; height: 200px; display: flex; align-items: center; justify-content: center; padding: 15px; box-sizing: border-box; position: relative; }
.img-wrap img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* Зоны наведения для смены фото в карточке */
.img-wrap .img-zones { position: absolute; inset: 0; display: flex; z-index: 2; }
.img-wrap .img-zones .zone { flex: 1; }

/* Индикаторы (полоски) текущего фото */
.img-wrap .img-dots {
    position: absolute; left: 10px; right: 10px; bottom: 6px;
    display: flex; justify-content: center; gap: 4px;
    opacity: 0; transition: opacity .15s ease;
    pointer-events: none; z-index: 3;
}
.product-card:hover .img-wrap .img-dots { opacity: 1; }
.img-wrap .img-dots .dot {
    flex: 1; max-width: 28px; height: 2px;
    background: rgba(0, 0, 0, 0.18); border-radius: 1px;
    transition: background .15s ease;
}
.img-wrap .img-dots .dot.active { background: var(--primary-color, #333); }

.content { padding: 15px; border-top: 1px solid #f9f9f9; }
.name { font-size: 14px; font-weight: 600; line-height: 1.4; height: 40px; overflow: hidden; margin-bottom: 10px; color: #555; }
.price { font-size: 18px; font-weight: 800; color: #000; }

.loader { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 18px; color: #999; }
.no-results { grid-column: 1/-1; text-align: center; padding: 40px; color: #888; background: #fff; border-radius: var(--border-radius); }

/* --- Стили для пагинации --- */
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; margin-bottom: 30px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 40px; padding-bottom: 40px; flex-wrap: wrap; }
.page-link { padding: 8px 14px; border: 1px solid #e0e0e0; text-decoration: none; color: #333; border-radius: 6px; transition: all 0.2s ease; background: #fff; font-weight: 500; }
.page-link.active { background-color: #007bff; color: white; border-color: #007bff; pointer-events: none; }
.page-link:hover:not(.active) { background-color: #f5f5f5; border-color: #ccc; }
.page-dots { color: #888; padding: 0 5px; font-weight: bold; }

/* Общие стили для баннера (для больших экранов) */
.promo-banner {
    width: 100%;
    max-width: 1800px; 
    margin: 20px auto; 
    overflow: hidden;
    line-height: 0; 
}
.banner-link { display: block; width: 100%; text-decoration: none; transition: opacity 0.3s ease; }
.banner-link:hover { opacity: 0.95; }
.banner-img { width: 100%; height: auto; display: block; border-radius: 8px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); }

/* ПОДВАЛ */
footer { background: #1a1a1a; color: #fff; padding: 60px 40px; z-index: 10; }
.footer-content { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 40px; }
.footer-section h4 { margin-bottom: 20px; color: var(--primary-color); }
.footer-section p, .footer-section a { color: #ccc; text-decoration: none; font-size: 14px; line-height: 1.8; }
.footer-bottom { text-align: center; margin-top: 40px; padding-top: 20px; border-top: 1px solid #333; font-size: 12px; color: #666; }
.footer-disclaimer { max-width: 1200px; margin: 20px auto 0; padding: 20px; border-top: 1px solid #333; font-size: 13px; color: #888; line-height: 1.6; }
.footer-disclaimer b { color: #aaa; }


/* ========================================= */
/* МОБИЛЬНАЯ ВЕРСИЯ */
/* ========================================= */
@media (max-width: 768px) {
    header { padding: 15px 20px; flex-wrap: wrap; gap: 15px; }
    .search-box { margin-left: 0; max-width: 100%; order: 3; }
    .catalog-layout { flex-direction: column; height: auto; overflow: visible; }
    .sidebar { width: 100%; height: auto; border-right: none; border-bottom: none; }
    .sidebar-header { display: none; }
    
    /* Мобильная кнопка каталога */
    .mobile-catalog-toggle { 
        display: block; 
        padding: 12px; 
        margin: 15px 20px 0; 
        background: var(--primary-color); 
        text-align: center; 
        font-weight: 700; 
        border-radius: var(--border-radius); 
        cursor: pointer;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
        transition: all 0.3s ease; 
        z-index: 1001; 
    }
    
    /* Миниатюрное "залипшее" состояние при скролле */
    .mobile-catalog-toggle.scrolled {
        position: fixed;
        top: 140px; 
        left: -5px; 
        margin: 0;
        padding: 10px 15px 10px 20px; 
        width: auto;
        border-radius: 0 15px 15px 0; 
        box-shadow: 3px 3px 12px rgba(0,0,0,0.15);
        font-size: 13px;
        opacity: 0.95;
    }        

    /* Настройки списка категорий */
    .category-list { 
        display: none; 
        flex-direction: column; 
        padding: 10px 20px; 
        animation: slideDown 0.3s ease;
    }
    .category-list.show { display: flex; }
    
    @keyframes slideDown {
        from { opacity: 0; transform: translateY(-10px); }
        to { opacity: 1; transform: translateY(0); }
    }

    .category-item { 
        white-space: normal; 
        padding: 10px 15px; 
        border-radius: 8px; 
        border: 1px solid #eee; 
        margin-bottom: 8px; 
        margin-right: 0; 
    }
    .category-item.active { border-left: 5px solid #000; }
    
    .main-content { padding: 20px; }
    
    /* ПРАВИЛЬНЫЕ СТИЛИ ФИЛЬТРА ДЛЯ МОБИЛЬНЫХ */
    .top-filter-bar { padding: 15px; gap: 10px; flex-direction: column; align-items: stretch; }
    .top-filter-bar form { 
        display: flex; 
        flex-direction: row; 
        flex-wrap: wrap;
        justify-content: space-between; 
        gap: 10px;
    }

    /* Контейнер полей цены: жестко в строку */
    .price-inputs {
        display: flex;
        align-items: center;
        flex-wrap: nowrap !important;
        white-space: nowrap;
        gap: 5px; 
    }

    /* Базовые поля на мобильном */
    .price-inputs input { 
        width: 85px; 
        font-size: 16px !important; /* ЗАЩИТА ОТ АВТОЗУМА iOS */
    }

    /* ЗУМ ПРИ КЛИКЕ ДЛЯ МОБИЛЬНЫХ */
    .price-inputs input:focus {
        transform: scale(1.5);
        z-index: 999;
    }

    /* Умное направление зума, чтобы не улетало за экран */
    .price-inputs input[name="min_p"]:focus { transform-origin: left center; }
    .price-inputs input[name="max_p"]:focus { transform-origin: right center; }

    .btn-filter { flex-grow: 1; }

    /* Делаем сетку строго в 2 колонки */
    .product-grid, 
    .products-grid { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 10px; 
    }

    /* Адаптируем содержимое карточки */
    .img-wrap { 
        height: 140px; 
        padding: 10px; 
    }
    .content { padding: 10px; }
    .name { 
        font-size: 12px; 
        height: 34px; 
        margin-bottom: 8px; 
    }
    .price { font-size: 15px; }

    /* Скрываем баннер на мобильных */
    .promo-banner {
        display: none !important; 
    }
/* Удерживаем слово "Цена", поля и кнопку строго в одной строке */
    .filter-group {
        flex-wrap: nowrap !important; 
        width: 100%;
        gap: 6px; /* Компактные отступы */
        justify-content: space-between;
    }

    /* Чуть уменьшаем шрифт слова "Цена, ₽:" чтобы сэкономить место */
    .top-filter-bar .filter-title {
        font-size: 13px;
        white-space: nowrap;
    }

    /* МАГИЯ: Превращаем кнопку в узкий квадрат */
    .btn-filter {
        width: 38px !important; /* Фиксированная ширина */
        height: 34px; /* Подгоняем под высоту полей ввода */
        padding: 0 !important;
        flex-shrink: 0; /* Запрещаем кнопке сжиматься */
        font-size: 0 !important; /* Прячем оригинальный текст "Показать" */
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
    }

    /* Рисуем иконку внутри кнопки */
    .btn-filter::after {
        content: "➔"; /* Можно заменить на "✓" (галочку) или "🔍" (лупу) */
        font-size: 18px; /* Размер иконки */
        color: #000; 
        font-weight: bold;
    }
}

.sub-menu-scroll {
    overflow-x: auto;
    white-space: nowrap;
    padding: 10px 0;
    margin-bottom: 20px;
    scrollbar-width: none; /* Скрываем скроллбар в Firefox */
}
.sub-menu-scroll::-webkit-scrollbar { display: none; } /* Скрываем в Chrome/Safari */

.sub-menu-container {
    display: flex;
    gap: 10px;
}

.sub-item {
    background: #fff;
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    transition: all 0.2s;
}

.sub-item:hover {
    border-color: #ffdb4d;
    background: #fffdf5;
}

.sub-group {
    font-size: 11px;
    color: #888;
    margin-right: 4px;
    text-transform: uppercase;
}

        /* Выпадающие списки (Dropdowns) для умных фильтров */
        .dynamic-filters-container {
            display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; position: relative; z-index: 50;
        }
        .filter-dropdown { position: relative; }
        .filter-dropdown-btn {
            background: #fff; border: 1px solid #ddd; padding: 10px 18px; border-radius: 20px;
            color: #333; font-size: 13px; font-weight: 500; cursor: pointer; display: flex; 
            align-items: center; gap: 6px; transition: all 0.2s ease;
        }
        .filter-dropdown-btn .arrow { font-size: 9px; color: #aaa; transition: 0.2s; }
        .filter-dropdown-btn:hover { border-color: #0066cc; color: #0066cc; }
        .filter-dropdown.active .filter-dropdown-btn { border-color: #0066cc; background: #f0f7ff; color: #0066cc; }
        .filter-dropdown.active .filter-dropdown-btn .arrow { transform: rotate(180deg); color: #0066cc; }
.filter-dropdown-content {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    background-color: #fff;
    min-width: 180px;
    box-shadow: 0px 8px 24px rgba(0,0,0,0.12);
    border-radius: 12px;
    border: 1px solid #eee;
    overflow: hidden;
    flex-direction: column;
    
    z-index: 9999; /* ВАЖНО */
}        .filter-dropdown.active .filter-dropdown-content { display: flex; animation: dropFade 0.2s ease; }
        @keyframes dropFade { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
        .filter-dropdown-content a {
            color: #444; padding: 12px 16px; text-decoration: none; font-size: 13px;
            border-bottom: 1px solid #f5f5f5; transition: background 0.1s;
        }
        .filter-dropdown-content a:hover { background-color: #f0f7ff; color: #0066cc; padding-left: 20px; }
        .filter-dropdown-content a:last-child { border-bottom: none; }

/* --- Выпадающий список типов мебели (Мобильная кнопка) --- */
    .types-container {
        margin-bottom: 15px;
        position: relative;
    }

    .mobile-types-toggle {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        /* Легкий градиент и толстая рамка в цвет вашего сайта (#ffdb4d) */
        background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
        border: 2px solid var(--primary-color); 
        padding: 12px 18px;
        border-radius: 12px;
        font-size: 15px; /* Сделали шрифт чуть крупнее */
        color: #333;
        cursor: pointer;
        /* Добавили легкое свечение */
        box-shadow: 0 4px 12px rgba(255, 219, 77, 0.25); 
        transition: all 0.2s ease;
    }

    .mobile-types-toggle b {
        color: #000;
        font-weight: 800; /* Сделали выбранную категорию жирнее */
        margin-left: 5px;
    }

    /* Красиво оформляем стрелочку в виде отдельного кружка */
    .mobile-types-toggle .arrow {
        font-size: 11px;
        color: #000;
        background: var(--primary-color);
        width: 26px;
        height: 26px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: transform 0.3s ease, background 0.3s ease;
    }

    /* Прячем плитки по умолчанию на мобильном */
    .types-container .type-pills {
        display: none !important; 
        background: #fff;
        padding: 15px;
        border-radius: 12px;
        border: 1px solid #eee;
        margin-top: 8px !important;
        margin-bottom: 0 !important;
        box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    }

    /* Показываем плитки, когда у контейнера есть класс active */
    .types-container.active .type-pills {
        display: flex !important;
    }

    /* --- Состояние КОГДА СПИСОК ОТКРЫТ --- */
    .types-container.active .mobile-types-toggle {
        border-color: #ddd; /* Успокаиваем рамку */
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
        background: #f9f9f9;
    }

    .types-container.active .mobile-types-toggle .arrow {
        transform: rotate(180deg);
        background: #ddd; /* Успокаиваем кружок со стрелкой */
    }

/* --- SEO: H1 каталога и хлебные крошки --- */
.catalog-h1 {
    font-size: 24px;
    margin: 0 0 20px;
    color: #333;
    line-height: 1.25;
}

.catalog-breadcrumbs {
    font-size: 13px;
    color: #888;
    margin-bottom: 12px;
    line-height: 1.4;
}
.catalog-breadcrumbs a {
    color: #888;
    text-decoration: none;
    transition: color 0.15s;
}
.catalog-breadcrumbs a:hover {
    color: #ff6b00;
    text-decoration: underline;
}
.catalog-breadcrumbs .separator {
    margin: 0 6px;
    color: #ccc;
}
.catalog-breadcrumbs .current {
    color: #333;
}

