/* products/static/products/css/products.css */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.shop-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 30px 50px;
}

/* ============================================
   ФИЛЬТРЫ (без изменений)
   ============================================ */
.shop-filters {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.shop-filters form {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-weight: 600;
    font-size: 14px;
    color: #555;
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    min-width: 150px;
    background: white;
}

.btn-filter {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.btn-filter:hover {
    background: #0056b3;
}

.btn-reset {
    background: #6c757d;
    color: white;
    text-decoration: none;
    padding: 8px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    display: inline-block;
    text-align: center;
}

.btn-reset:hover {
    background: #5a6268;
    color: white;
}

/* ============================================
   СЕТКА ТОВАРОВ (оптимизировано)
   ============================================ */
.products-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

/* ============================================
   КАРТОЧКА ТОВАРА (БЕЗ АНИМАЦИЙ НАВЕДЕНИЯ)
   ============================================ */
.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Аппаратное ускорение без will-change */
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Убираем анимацию наведения — главный источник лагов */
.product-card:hover {
    /* НЕТ transform, НЕТ translateY */
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Изображение */
.product-image-link {
    display: block;
    background: #f8f9fa;
    padding: 0 5%;
}

.product-image {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f8f9fa;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Убираем анимацию при наведении */
}

/* Бейдж скидки */
.product-discount-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #ff4757, #ff6b81);
    color: white;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
    z-index: 2;
}

/* Информация о товаре */
.product-info {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    margin: 0 0 6px 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 39px;
}

.product-title a {
    color: #333;
    text-decoration: none;
}

.product-title a:hover {
    color: #007bff;
}

.product-category {
    font-size: 10px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.product-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 8px;
}

.product-price {
    font-size: 18px;
    font-weight: bold;
    color: #28a745;
    display: flex;
    align-items: baseline;
    gap: 5px;
    flex-wrap: wrap;
}

.old-price {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
    font-weight: normal;
}

/* Кнопка избранное (минимальная анимация) */
.favorite-btn {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #ccc;
}

.favorite-btn:hover {
    color: #ff4757;
}

.favorite-btn.active {
    color: #ff4757;
}

/* Кнопка добавления в корзину (минимальная анимация) */
.add-to-cart {
    width: 100%;
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    margin-top: auto;
}

.add-to-cart:hover {
    background: #218838;
}

.add-to-cart.added {
    background: #6c757d;
    cursor: default;
}

/* ============================================
   КОНТРОЛЫ КОРЗИНЫ (минимальные анимации)
   ============================================ */
.cart-quantity-controls {
    display: flex;
    align-items: center;
    gap: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
    margin-top: auto;
}

.cart-qty-btn {
    width: 36px;
    height: 38px;
    border: none;
    background: #f8f8f8;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}

.cart-qty-btn:hover {
    background: #e44c2c;
    color: white;
}

.cart-qty-value {
    flex: 1;
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: #333;
    background: white;
    padding: 0 5px;
    line-height: 38px;
}

.cart-remove-btn {
    background: #f8f8f8;
    border: none;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    padding: 0 12px;
    height: 38px;
    white-space: nowrap;
}

.cart-remove-btn:hover {
    background: #dc3545;
    color: white;
}

/* ============================================
   ОСТАЛЬНЫЕ СТИЛИ
   ============================================ */
.no-products {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    grid-column: 1 / -1;
}

.loading-spinner {
    text-align: center;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.end-of-list {
    text-align: center;
    padding: 30px;
    color: #999;
    font-size: 14px;
    grid-column: 1 / -1;
}

/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */
@media (max-width: 1400px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1100px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 800px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .shop-container {
        padding: 15px;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }


    .product-info {
        padding: 12px;
    }

    .cart-remove-btn {
        padding: 0 10px;
        font-size: 11px;
    }
}