/* =========================================
   ОБЩИЕ СТИЛИ КАТАЛОГА
========================================= */
.catalog-z {
    color: #2e7d32;
    margin: 30px 0;
    text-align: center;
    font-size: 32px;
    font-weight: 700;
}

.catalog-content {
    display: flex;
    gap: 30px;
    margin: 30px 0;
    align-items: flex-start; /* Чтобы фильтры не растягивались на всю высоту */
}

/* =========================================
   БОКОВАЯ ПАНЕЛЬ ФИЛЬТРОВ
========================================= */
.filters {
    width: 280px;
    flex-shrink: 0; /* Чтобы фильтры не сужались */
    background: #fff;
    padding: 25px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    position: sticky;
    top: 20px;
}

.filters .title {
    color: #2e7d32;
    margin-bottom: 20px;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
}

.filter-group {
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.filter-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.filter-group p {
    color: #333;
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
}

.filter-option {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.filter-option:hover {
    transform: translateX(5px); /* Легкое смещение при наведении */
}

.filter-option input {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    accent-color: #2e7d32; /* Зеленые галочки в чекбоксах */
    cursor: pointer;
}

.filter-option span {
    font-size: 15px;
    color: #555;
}

/* Стили для ввода цены */
.price-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.price-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.price-input:focus {
    border-color: #2e7d32;
    outline: none;
}

.price-inputs span {
    color: #999;
}

/* Кнопки фильтров */
.filter-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 25px;
}

.btn-apply, .btn-reset {
    padding: 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s ease;
}

.btn-apply {
    background: #2e7d32;
    color: white;
}

.btn-apply:hover {
    background: #1b5e20;
    box-shadow: 0 4px 10px rgba(46,125,50,0.3);
}

.btn-reset {
    background: #f5f5f5;
    color: #555;
    border: 1px solid #ddd;
}

.btn-reset:hover {
    background: #e0e0e0;
    color: #333;
}

/* =========================================
   ОСНОВНОЙ БЛОК ТОВАРОВ
========================================= */
.products {
    flex: 1;
    min-width: 0; /* Фикс переполнения грида */
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    background: #fff;
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.products-count {
    color: #555;
    font-size: 15px;
    font-weight: 500;
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sort-options label {
    font-size: 14px;
    color: #666;
}

.sort-options select {
    padding: 8px 30px 8px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    appearance: none; /* Убирает стандартную стрелку ОС */
    background: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") no-repeat right 10px center;
    background-size: 15px;
    background-color: white;
}

/* =========================================
   СЕТКА И КАРТОЧКИ ТОВАРОВ
========================================= */
.products-grid {
    display: grid; /* ИСПРАВЛЕНО: было flex, из-за чего grid-template не работал */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.product-card {
    background: #fff;
    border-radius: 12px; /* Чуть больше скругление */
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: flex; /* Делаем карточку flex-контейнером */
    flex-direction: column;
    position: relative;
    border: 1px solid #f0f0f0;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.1);
}

.product-image {
    height: 220px;
    background: #fff;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #f9f9f9;
}

.product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* ИСПРАВЛЕНО: чтобы велосипед влезал целиком */
    transition: transform 0.4s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.08);
}

/* Кнопка "В избранное" (сердечко) */
.btn-fav {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    color: #ccc;
    font-size: 18px;
    transition: all 0.3s ease;
    z-index: 2;
}

.btn-fav:hover {
    color: #ff4757;
    transform: scale(1.1);
}

.product-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1; /* Растягивает блок, прижимая кнопку к низу */
}

.product-brand {
    color: #888;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.product-title {
    color: #333;
    margin-bottom: 12px;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    flex: 1; /* Позволяет заголовку занимать свободное место */
}

.product-price {
    color: #e44d26; /* Акцентный цвет для цены */
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 20px;
}

.btn-details {
    display: block;
    text-align: center;
    background: #2e7d32;
    color: white;
    padding: 12px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    transition: background 0.3s ease;
    text-decoration: none;
    margin-top: auto; /* Всегда прижимает кнопку к нижнему краю карточки */
}

.product-card:hover .btn-details {
    background: #1b5e20;
}

/* =========================================
   ПАГИНАЦИЯ (Показать еще)
========================================= */
.load-more-container {
    text-align: center;
    margin: 40px 0;
}

.btn-load-more {
    background: transparent;
    color: #2e7d32;
    border: 2px solid #2e7d32;
    padding: 14px 40px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-load-more:hover {
    background: #2e7d32;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(46,125,50,0.2);
}

/* =========================================
   КНОПКА НАВЕРХ
========================================= */
.scroll-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: #2e7d32;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scroll-top-btn.show {
    opacity: 1;
    visibility: visible;
}

.scroll-top-btn:hover {
    background: #1b5e20;
    transform: translateY(-5px);
}
.btn-fav.active {
    color: #ff4757 !important;
    transform: scale(1.1);
    text-shadow: 0 0 5px rgba(255, 71, 87, 0.3);
}

.btn-fav {
    transition: all 0.2s ease;
    outline: none;
}
.modal {
    display: none; 
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px); /* Размытие заднего фона */
}

/* Контентное окно */
.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 80%;
    max-width: 800px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Кнопка закрытия */
.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 30px;
    cursor: pointer;
    color: #888;
}

.close-modal:hover { color: #333; }

/* Верстка внутри модалки */
.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.modal-img img {
    width: 100%;
    border-radius: 10px;
}

.modal-info h2 { color: #2e7d32; margin-bottom: 15px; }
.modal-info p { margin-bottom: 10px; line-height: 1.6; }
.modal-price { font-size: 24px; font-weight: bold; color: #e44d26; }

/* =========================================
   АДАПТИВНОСТЬ (МЕДИА-ЗАПРОСЫ)
========================================= */
@media (max-width: 968px) {
    .catalog-content {
        flex-direction: column;
    }
    
    .filters {
        width: 100%;
        position: static;
        margin-bottom: 25px;
    }
    
    .products-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch; /* Растягиваем элементы на мобилках */
    }
    
    .sort-options {
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    .products-grid {
        /* На планшетах карточки чуть меньше */
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); 
        gap: 15px;
    }
    
    .btn-load-more {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .products-grid {
        /* На телефонах карточки идут в 1 колонку */
        grid-template-columns: 1fr; 
    }
    
    .scroll-top-btn {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}
.search-results-dropdown {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    width: 100%;
    max-width: 300px; /* или по ширине инпута */
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: none;
}

.search-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.search-item:hover {
    background-color: #f8f9fa;
    color: #27ae60;
}