/**
 * Стили для динамической загрузки популярных товаров
 */

/* Спиннер загрузки */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    min-height: 200px;
    background-color: #1a1a1a;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #444;
    border-top: 4px solid #d4af37;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

.loading-spinner p {
    color: #cccccc;
    font-size: 16px;
    margin: 0;
}

/* Сообщение об ошибке */
.error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.error-message p {
    color: #f4d03f;
    font-size: 16px;
    margin-bottom: 20px;
}

.retry-btn {
    background-color: #d4af37;
    color: #1a1a1a;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid #d4af37;
}

.retry-btn:hover {
    background-color: #d4af37;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(244, 208, 63, 0.3);
}

/* Контейнер цен с зачеркнутой старой ценой */
.price-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

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

.price-container h4 {
    margin: 0;
    color: #d4af37;
    font-weight: 600;
}

/* Уведомления о добавлении в корзину */
.cart-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #d4af37;
    color: #1a1a1a;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
    z-index: 10000;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 350px;
    border: 1px solid #d4af37;
}

.cart-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.notification-content i {
    font-size: 18px;
    color: #d4af37;
}

.notification-content span {
    font-size: 14px;
    font-weight: 500;
}

/* Адаптивность */
@media (max-width: 768px) {
    .cart-notification {
        right: 10px;
        top: 10px;
        max-width: calc(100vw - 20px);
        transform: translateX(calc(100vw + 20px));
    }
    
    .loading-spinner {
        padding: 40px 15px;
        min-height: 150px;
    }
    
    .spinner {
        width: 32px;
        height: 32px;
        border-width: 3px;
    }
    
    .error-message {
        padding: 30px 15px;
    }
}

/* Улучшения для карточек товаров */
.product-item img {
    transition: transform 0.3s ease;
}

.product-item:hover img {
    transform: scale(1.05);
}

/* 🎯 АДАПТИВНЫЕ СТИЛИ ДЛЯ ИЗОБРАЖЕНИЙ ПОПУЛЯРНЫХ ТОВАРОВ */
.product-image {
    width: 100%;
    height: 250px;
    overflow: hidden;
    border-radius: 8px;
    position: relative;
    background-color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 8px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Fallback для случаев когда изображение не загружается */
.product-image:empty::before {
    content: "🎸";
    font-size: 48px;
    color: #d4a574;
    opacity: 0.3;
}

/* Адаптивность изображений на разных экранах */
@media (max-width: 1200px) {
    .product-image {
        height: 220px;
    }
}

@media (max-width: 768px) {
    .product-image {
        height: 200px;
    }
    
    .product-image img {
        border-radius: 6px;
    }
}

@media (max-width: 480px) {
    .product-image {
        height: 180px;
        border-radius: 6px;
    }
    
    .product-image img {
        border-radius: 4px;
    }
}

/* Плавная загрузка изображений */
.product-item img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-item img[loading="lazy"].loaded {
    opacity: 1;
}

/* Анимация появления карточек товаров */
.product-item {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.product-item:nth-child(1) { animation-delay: 0.1s; }
.product-item:nth-child(2) { animation-delay: 0.2s; }
.product-item:nth-child(3) { animation-delay: 0.3s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
