/* ========================================
   ТОВАРЫ И КАРТОЧКИ
   ======================================== */

.products-section {
    background-color: var(--primary-dark);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

/* Карточка товара */
.product-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-blue);
}

/* Изображение товара */
.product-card__image {
    position: relative;
    width: 100%;
    aspect-ratio: 1280 / 1067;
    background-color: var(--surface-alt);
    overflow: hidden;
}

.product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.product-card:hover .product-card__image img {
    transform: scale(1.1);
}

/* Бейдж "Новинка" или "Акция" */
.product-card__badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background-color: var(--accent-blue);
    color: var(--text-primary);
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 2;
}

.product-card__badge--sale {
    background-color: var(--error);
}

.product-card__badge--new {
    background-color: var(--success);
}

/* Причина уценки */
.product-card__discount-reason {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 152, 0, 0.95);
    color: #fff;
    padding: 8px 12px;
    font-size: 0.85rem;
    line-height: 1.3;
    text-align: center;
    font-weight: 500;
    border-top: 2px solid rgba(255, 152, 0, 1);
    z-index: 3;
}

/* Контент карточки */
.product-card__content {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card__category {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.product-card__title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.3;
}

.product-card__description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
    
    /* Ограничение высоты с троеточием */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 2.7em; /* примерно 2 строки */
}

/* Статус наличия */
.product-card__stock {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 10px;
}

.product-card__stock.in-stock {
    color: var(--success);
    background-color: rgba(76, 175, 80, 0.1);
}

.product-card__stock.out-of-stock {
    color: var(--text-muted);
    background-color: rgba(255, 152, 0, 0.1);
}

/* Доставка на карточке */
.product-card__delivery {
    margin-top: 8px;
    min-height: 24px;
}

.delivery-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 4px;
    background-color: var(--surface-alt);
    border: 1px solid var(--divider);
    font-weight: 500;
    transition: all 0.2s ease;
}

.delivery-badge svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    color: var(--accent-blue);
}

.delivery-badge.loading {
    opacity: 0.6;
    animation: delivery-pulse 1.5s ease-in-out infinite;
}

@keyframes delivery-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.3; }
}

/* Характеристики */
.product-card__specs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.product-spec {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.product-spec svg {
    width: 16px;
    height: 16px;
    color: var(--accent-blue);
}

/* Футер карточки */
.product-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 16px 16px;
    border-top: 1px solid var(--border-color);
}

.product-card__price {
    display: flex;
    flex-direction: column;
}

.product-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1b1e23;
    white-space: nowrap; /* Запрещаем перенос цены на новую строку */
}

.product-price--old {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
    text-decoration: line-through;
}

/* Цена при скидке (если добавлен класс) */
.product-price--discount {
    color: var(--success);
}

/* Кнопки карточки */
.product-card__actions {
    display: flex;
    gap: 10px;
}

.product-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.product-btn--primary {
    background-color: var(--surface-alt);
    color: var(--text-primary);
    border: 1px solid var(--divider);
}

.product-btn--primary:hover {
    background-color: #e7dfd3;
    border-color: var(--text-secondary);
}

.product-btn--outline {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--divider);
}

.product-btn--outline:hover {
    background-color: var(--surface-alt);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

/* Индикатор 3D модели */
.icon-3d-badge {
    position: absolute;
    bottom: 15px;
    right: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.95) 0%, rgba(25, 118, 210, 0.95) 100%);
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: default;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.4);
    transition: transform 0.2s ease;
}

.icon-3d-badge:hover {
    transform: scale(1.1);
}

/* Кнопка корзины */
.product-btn--cart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background-color: var(--surface-alt);
    color: var(--text-primary);
    border-radius: 8px;
    border: 1px solid var(--divider);
    transition: var(--transition);
}

.product-btn--cart:hover {
    background-color: #e7dfd3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.product-btn--cart svg {
    stroke-width: 2;
}

/* Действия над товарами */
.products-actions {
    text-align: center;
}

/* Пустое состояние */
.products-empty {
    text-align: center;
    padding: 60px 20px;
}

.products-empty__icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    opacity: 0.3;
}

.products-empty__title {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.products-empty__text {
    color: var(--text-muted);
}

/* Адаптивность */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .product-card__content {
        padding: 15px;
    }
    
    .product-card__footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 15px;
    }
    
    .product-card__actions {
        width: 100%;
    }
    
    .product-btn {
        flex: 1;
    }
}

/* Кнопка "Показать все" для популярных товаров */
.product-card.hidden {
    display: none;
}

.products-show-more {
    text-align: center;
    margin-top: 40px;
    margin-bottom: 30px;
}

.products-show-more .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    font-size: 1rem;
}

