/**
 * СТИЛИ ДЛЯ LAZY LOAD ПАГИНАЦИИ
 */

/* =====================================================
   АНИМАЦИЯ ЗАГРУЗКИ НОВЫХ ТОВАРОВ
   ===================================================== */

.product-card.lazy-loaded {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

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

/* =====================================================
   ИНДИКАТОР ЗАГРУЗКИ
   ===================================================== */

.loading-indicator {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
    margin: 40px 0;
}

.loading-indicator.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    margin-left: 15px;
    font-size: 16px;
    color: #666;
}

/* =====================================================
   КНОПКА "ПОКАЗАТЬ ЕЩЁ"
   ===================================================== */

.load-more-container {
    text-align: center;
    padding: 40px 0;
    margin: 40px 0;
}

.load-more-btn {
    display: inline-block;
    padding: 15px 40px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 123, 255, 0.2);
}

.load-more-btn:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 123, 255, 0.3);
}

.load-more-btn:active {
    transform: translateY(0);
}

.load-more-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* =====================================================
   СООБЩЕНИЕ "ВСЕ ТОВАРЫ ЗАГРУЖЕНЫ"
   ===================================================== */

.end-message {
    text-align: center;
    padding: 40px 0;
    margin: 40px 0;
    color: #28a745;
    font-size: 18px;
    font-weight: 600;
    border-top: 2px solid #e0e0e0;
    border-bottom: 2px solid #e0e0e0;
    background: #f8f9fa;
    border-radius: 8px;
}

.end-message p {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* =====================================================
   SCROLL SENTINEL (невидимый элемент для отслеживания)
   ===================================================== */

.scroll-sentinel {
    height: 1px;
    visibility: hidden;
}

/* =====================================================
   СЧЁТЧИК ТОВАРОВ
   ===================================================== */

.products-counter {
    text-align: center;
    padding: 20px 0;
    font-size: 14px;
    color: #666;
}

.products-counter strong {
    color: #333;
    font-weight: 600;
}

/* =====================================================
   АДАПТИВНОСТЬ
   ===================================================== */

@media (max-width: 768px) {
    .loading-indicator {
        padding: 30px 0;
        margin: 30px 0;
    }
    
    .spinner {
        width: 40px;
        height: 40px;
        border-width: 3px;
    }
    
    .loading-text {
        font-size: 14px;
    }
    
    .load-more-btn {
        padding: 12px 30px;
        font-size: 14px;
    }
    
    .end-message {
        font-size: 16px;
        padding: 30px 20px;
        margin: 30px 0;
    }
}

/* =====================================================
   ПЛАВНАЯ ПРОКРУТКА
   ===================================================== */

html {
    scroll-behavior: smooth;
}

/* =====================================================
   SKELETON LOADING (опционально)
   ===================================================== */

.product-card.skeleton {
    pointer-events: none;
}

.product-card.skeleton .product-image,
.product-card.skeleton .product-name,
.product-card.skeleton .product-price {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

.product-card.skeleton .product-image {
    height: 250px;
}

.product-card.skeleton .product-name {
    height: 20px;
    margin: 10px 0;
}

.product-card.skeleton .product-price {
    height: 24px;
    width: 100px;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* =====================================================
   СОСТОЯНИЕ ОШИБКИ
   ===================================================== */

.error-message {
    text-align: center;
    padding: 40px 20px;
    margin: 40px 0;
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
}

.error-message p {
    margin: 0 0 15px 0;
    font-size: 16px;
}

.retry-btn {
    padding: 10px 25px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.retry-btn:hover {
    background: #c82333;
}