/* Кнопки для мобильных */
.mobile-toggle-buttons {
    display: none;
    gap: 10px;
    padding: 15px 20px;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.mobile-toggle-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.3);
}

.mobile-toggle-btn:hover {
    background: #1976D2;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.4);
}

.mobile-toggle-btn:active {
    transform: translateY(0);
}

.mobile-toggle-btn svg {
    flex-shrink: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
}

/* Sidebar Filters */
.sidebar {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    height: fit-content;
/*    position: sticky;
    top: 20px;*/
}

.sidebar h2 {
    margin-bottom: 20px;
    font-size: 20px;
    color: #222;
}

.product-actions {
    padding: 0 15px 12px;
}

.filter-group {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.filter-group:last-of-type {
    border-bottom: none;
}

.filter-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #555;
}

.filter-group select,
.filter-group input[type="number"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.filter-group select:focus,
.filter-group input[type="number"]:focus {
    outline: none;
    border-color: #2196F3;
}

.price-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.price-slider-container {
    position: relative;
    height: 40px;
    margin: 15px 0;
}

.price-slider-track {
    position: absolute;
    width: 100%;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    top: 17px;
}

.price-slider-range {
    position: absolute;
    height: 6px;
    background: #2196F3;
    border-radius: 3px;
    top: 17px;
}

.price-slider-container input[type="range"] {
    position: absolute;
    width: 100%;
    height: 6px;
    background: transparent;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    top: 17px;
}

.price-slider-container input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    background: transparent;
    border-radius: 3px;
}

.price-slider-container input[type="range"]::-moz-range-track {
    width: 100%;
    height: 6px;
    background: transparent;
    border-radius: 3px;
}

.price-slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: white;
    border: 3px solid #2196F3;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    margin-top: -7px;
    z-index: 10;
    position: relative;
}

.price-slider-container input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: white;
    border: 3px solid #2196F3;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.price-slider-container input[type="range"]::-webkit-slider-thumb:hover {
    border-color: #1976D2;
    transform: scale(1.15);
}

.price-slider-container input[type="range"]::-moz-range-thumb:hover {
    border-color: #1976D2;
    transform: scale(1.15);
}

.price-slider-container input[type="range"]:active::-webkit-slider-thumb {
    border-color: #0D47A1;
    background: #e3f2fd;
}

.price-slider-container input[type="range"]:active::-moz-range-thumb {
    border-color: #0D47A1;
    background: #e3f2fd;
}

.price-slider-container input[type="range"]:last-child {
    z-index: 5;
}

.price-limits {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #999;
    margin-top: 5px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    font-weight: normal;
    margin-bottom: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.btn-apply,
.btn-reset {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    display: block;
    text-decoration: none;
}

.btn-apply {
    background: #2196F3;
    color: white;
    border-color: #2196F3;
    margin-bottom: 10px;
}

.btn-apply:hover {
    background: #1976D2;
    border-color: #1976D2;
}

.btn-reset {
    background: #f5f5f5;
    color: #666;
    border-color: #ddd;
}

.btn-reset:hover {
    background: #e0e0e0;
    border-color: #ccc;
}

/* Контейнер кнопок фильтра */
.filter-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

/* Кнопка "Фильтровать" скрыта на десктопе */
.btn-apply-mobile {
    display: none;
}

/* Content Area */
.content {
    min-height: 500px;
}

.catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    gap: 20px;
    flex-wrap: wrap;
}

/* Search */
.search-container {
    flex: 1;
    min-width: 300px;
}

.search-form {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: #4CAF50;
}

.search-button {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #666;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-button:hover {
    color: #4CAF50;
}

.search-clear {
    position: absolute;
    right: 45px;
    background: #f44336;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.search-clear:hover {
    background: #d32f2f;
}

/* Sort Controls */
.sort-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.sort-controls label {
    font-weight: 600;
    color: #555;
}

.sort-controls select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

/* Results Info */
.results-info {
    margin-bottom: 20px;
    padding: 10px 15px;
    background: #f5f5f5;
    border-radius: 6px;
    font-size: 14px;
}

.clear-search-link {
    margin-left: 15px;
    color: #4CAF50;
    text-decoration: none;
    font-size: 13px;
}

.clear-search-link:hover {
    text-decoration: underline;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.product-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.product-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.product-image {
    width: 100%;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    overflow: hidden;
    padding: 5px;
}

/* Поддержка тега picture для WebP */
.product-image picture {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.no-image {
    color: #999;
    font-size: 14px;
}

.product-info {
    padding: 15px;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #222;
    line-height: 1.4;
    min-height: 44px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-specs {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 12px;
    color: #666;
}

.product-specs span {
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 4px;
}

/* Теги товара (размер и индексы) */
.product-tags {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.product-tags .tag {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    background: #e3f2fd;
    color: #1976D2;
    border: 1px solid #90caf9;
}

.product-tags .tag-size {
    background: #f3e5f5;
    color: #7b1fa2;
    border-color: #ce93d8;
}

.product-tags .tag-index {
    background: #fff3e0;
    color: #e65100;
    border-color: #ffb74d;
}

/* Цена товара */
.product-price {
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
}

.product-price .price-per-item {
    font-size: 27px;
    font-weight: 700;
    color: #2196F3;
}

/* Цена за комплект */
.product-price-set {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    padding: 6px 10px;
    background: #f5f5f5;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.product-price-set .set-label {
    color: #666;
    font-weight: 500;
}

.product-price-set .set-price {
    color: #28a745;
    font-weight: 700;
    font-size: 13px;
}

/* Оптовая цена (для специальных пользователей) */
.product-price-wholesale {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    padding: 6px 10px;
    background: #fff3e0;
    border-radius: 6px;
    border: 1px solid #ffb74d;
    margin-bottom: 6px;
}

.product-price-wholesale .wholesale-label {
    color: #e65100;
    font-weight: 500;
}

.product-price-wholesale .wholesale-price {
    color: #ff6f00;
    font-weight: 700;
    font-size: 13px;
}

.product-stock {
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

.in-stock {
    color: #2e7d32;
    background: #e8f5e9;
}

.out-of-stock {
    color: #c62828;
    background: #ffebee;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
}

.pagination-link,
.pagination-current {
    padding: 10px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.pagination-link {
    background: white;
    color: #2196F3;
    border: 1px solid #ddd;
}

.pagination-link:hover {
    background: #2196F3;
    color: white;
    border-color: #2196F3;
}

.pagination-current {
    background: #2196F3;
    color: white;
    border: 1px solid #2196F3;
}

/* No Results */
.no-results {
    background: white;
    padding: 60px 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.no-results p {
    font-size: 18px;
    color: #666;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .pagination {
        flex-wrap: wrap;
      }
    /* Показываем кнопки переключения */
    .mobile-toggle-buttons {
        display: flex;
    }
    
    /* Скрываем подборщик и фильтры по умолчанию */
    .tire-selector-widget,
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: white;
        z-index: 9999;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        box-shadow: 2px 0 10px rgba(0,0,0,0.2);
        padding-bottom: 80px; /* Отступ для плавающей кнопки */
    }
    
    /* Показываем при активации */
    .tire-selector-widget.active,
    .sidebar.active {
        transform: translateX(0);
    }
    
    /* Аккуратный крестик закрытия сверху справа */
    .tire-selector-widget::before,
    .sidebar::before {
        content: '✕';
        position: sticky;
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(0, 0, 0, 0.05);
        color: #666;
        font-size: 24px;
        font-weight: 300;
        cursor: pointer;
        z-index: 10;
        border-radius: 50%;
        transition: all 0.2s;
        margin-left: auto;
        margin-right: 10px;
        margin-bottom: 10px;
    }
    
    .tire-selector-widget::before:hover,
    .sidebar::before:hover {
        background: rgba(0, 0, 0, 0.1);
        color: #333;
        transform: rotate(90deg);
    }
    
    /* Показываем кнопку "Фильтровать" на мобильных */
    .btn-apply-mobile {
        display: block !important;
    }
    
    /* Плавающая подложка внизу для кнопок фильтра (только для открытого .sidebar) */
    .sidebar.active .filter-actions {
        position: sticky;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        margin: 0;
        padding: 12px 16px;
        background: white;
        border-radius: 0;
        /* box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15); */
        z-index: 11;
        /* border-top: 1px solid #e0e0e0; */
        display: flex;
        flex-direction: row;
        gap: 12px;
    }
    
    .sidebar.active .btn-reset {
        flex: 1;
        width: auto;
        margin: 0;
        padding: 14px 20px;
        background: white;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        font-size: 15px;
        font-weight: 600;
        color: #666;
        transition: all 0.3s;
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        touch-action: manipulation;
        user-select: none;
        -webkit-user-select: none;
    }
    
    .sidebar.active .btn-reset:hover {
        background: #f5f5f5;
        border-color: #ccc;
        color: #333;
    }
    
    .sidebar.active .btn-reset:active {
        background: #e0e0e0;
        transform: scale(0.98);
    }
    
    .sidebar.active .btn-apply-mobile {
        flex: 2;
        margin: 0;
        padding: 14px 20px;
        background: #2196F3;
        color: white;
        border: none;
        border-radius: 8px;
        font-size: 15px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s;
        box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
        -webkit-tap-highlight-color: rgba(33, 150, 243, 0.3);
        touch-action: manipulation;
        user-select: none;
        -webkit-user-select: none;
    }
    
    .sidebar.active .btn-apply-mobile:hover {
        background: #1976D2;
        box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
        transform: translateY(-1px);
    }
    
    .sidebar.active .btn-apply-mobile:active {
        background: #1565C0;
        transform: scale(0.98);
    }
    
    /* Оверлей для закрытия при клике вне */
    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0,0,0,0.5);
        z-index: 9998;
    }
    
    .mobile-overlay.active {
        display: block;
    }
    
    .catalog-header {
        flex-direction: column;
        align-items: stretch;
    }    
    .search-container {
        min-width: 100%;
    }
    
    .sort-controls {
        width: 100%;
    }
    
    .sort-controls select {
        flex: 1;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
        gap: 15px;
    }
}

/* Иконки сезона и шипов в карточках товаров */
.spec-season, 
.spec-thorn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
}

svg.icon {
    width: 20px;
    height: 20px;
    display: block;
}

.spec-season svg, 
.spec-thorn svg {
    width: 20px;
    height: 20px;
    display: block;
}

.spec-season svg.icon, 
.spec-thorn svg.icon {
    width: 20px;
    height: 20px;
    display: block;
}