
/* WebP Support Detection & Lazy Loading */
.webp .img-webp { 
    display: block; 
}
.no-webp .img-webp { 
    display: none; 
}
.webp .img-fallback { 
    display: none; 
}
.no-webp .img-fallback { 
    display: block; 
}

/* Lazy loading styles */
img[data-src] {
    opacity: 0;
    transition: opacity 0.3s;
}

img[data-src].lazyloaded {
    opacity: 1;
}

/* Placeholder для загружающихся изображений */
.img-placeholder {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

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

/* Responsive images */
.img-responsive {
    width: 100%;
    height: auto;
    max-width: 100%;
}

/* Critical images - no lazy loading */
.hero-image, .above-the-fold {
    opacity: 1 !important;
}

/* FAQ стили для статей */
.faq-item {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    background: white;
    transition: box-shadow 0.3s ease;
}

.faq-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.faq-question {
    color: #2D5016;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Стили для таблицы цен в FAQ */
.price-table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.price-table-wrapper table {
    margin-bottom: 0;
    font-size: 0.95rem;
}

.price-highlight {
    color: #28a745;
    font-weight: 700;
    font-size: 1.1em;
}

.calculator-cta {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px dashed #28a745;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.calculator-cta .btn {
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    border: none;
    padding: 12px 30px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.calculator-cta .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

/* Стили для блока цен на страницах марок */
.price-block {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #28a745;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.15);
}

.price-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0.5rem;
}

.price-label {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.price-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #28a745;
    text-shadow: 0 1px 2px rgba(40, 167, 69, 0.2);
}

.price-note {
    margin-bottom: 1rem;
}

.calculator-btn-wrapper .btn {
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    border: none;
    padding: 10px 25px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.calculator-btn-wrapper .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .price-block {
        padding: 1rem;
    }
    
    .price-value {
        font-size: 1.5rem;
    }
    
    .calculator-btn-wrapper .btn {
        padding: 8px 20px;
        font-size: 0.9rem;
    }
}

/* Стили для цен в карточках каталога */
.card-price {
    margin-top: 1rem;
    text-align: center;
}

.price-badge-small {
    display: inline-block;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.faq-answer {
    color: #555;
    line-height: 1.6;
}

.faq-answer ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.faq-answer li {
    margin-bottom: 0.5rem;
}

.faq-link-section {
    border-top: 3px solid #28a745;
}

/* === МОБИЛЬНАЯ ОПТИМИЗАЦИЯ ИЗОБРАЖЕНИЙ === */

/* Основные медиа-запросы для изображений */
@media (max-width: 575.98px) {
    /* Оптимизация изображений продукции */
    .product-card-img-container {
        height: 160px !important;
        padding: 10px;
    }
    
    .product-card .card-img-top {
        height: 140px !important;
        object-fit: contain;
    }
    
    /* Оптимизация hero изображений */
    .hero-image, .about-section-home img {
        object-fit: cover;
        height: auto;
        max-height: 250px;
        border-radius: 8px !important;
    }
    
    /* WebP изображения адаптивность */
    .img-responsive {
        height: auto !important;
        max-width: 100% !important;
        object-fit: cover;
    }
    
    /* Оптимизация галереи на мобильных */
    .gallery-photo {
        margin-bottom: 1rem;
        border-radius: 8px;
    }
    
    .gallery-photo img {
        max-height: 300px;
        object-fit: cover;
        border-radius: 8px;
    }
    
    /* Социальные иконки мобильные */
    .social-icon, .footer-social-icon {
        border-radius: 6px !important;
        transition: transform 0.2s ease;
    }
    
    /* Анимации плавнее на мобильных */
    .img-placeholder {
        animation-duration: 2s;
    }
    
    /* Ленивая загрузка быстрее на мобильных */
    img[data-src] {
        transition: opacity 0.2s;
    }
    
    /* Критические изображения приоритет */
    .hero-image, .above-the-fold {
        opacity: 1 !important;
        transform: none !important;
    }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    /* Планшеты портрет */
    .product-card-img-container {
        height: 180px !important;
    }
    
    .product-card .card-img-top {
        height: 160px !important;
    }
    
    .hero-image, .about-section-home img {
        max-height: 300px;
    }
    
    .gallery-photo img {
        max-height: 350px;
    }
}

@media (max-width: 991.98px) {
    /* Общие оптимизации для планшетов и мобильных */
    
    /* Оптимизация карточек марок бетона */
    .grade-card .grade-card-img-container {
        height: 150px !important;
        padding: 10px;
    }
    
    .grade-card .card-img-top {
        max-height: 130px !important;
        width: auto;
        object-fit: contain;
    }
    
    /* Оптимизация детальных изображений продуктов */
    .product-detail-image-container img {
        max-height: 300px !important;
        object-fit: contain;
        border-radius: 8px;
    }
    
    /* Улучшение производительности */
    img[loading="lazy"] {
        content-visibility: auto;
        contain-intrinsic-size: 1px 200px;
    }
}

/* Ультра-мобильные устройства */
@media (max-width: 399.98px) {
    .product-card-img-container {
        height: 140px !important;
        padding: 8px;
    }
    
    .product-card .card-img-top {
        height: 124px !important;
    }
    
    .grade-card .grade-card-img-container {
        height: 120px !important;
        padding: 8px;
    }
    
    .grade-card .card-img-top {
        max-height: 104px !important;
    }
    
    .hero-image, .about-section-home img {
        max-height: 200px;
        border-radius: 6px !important;
    }
    
    .social-icon, .footer-social-icon {
        width: 24px !important;
        height: 24px !important;
        border-radius: 4px !important;
    }
    
    .gallery-photo img {
        max-height: 250px;
        border-radius: 6px;
    }
}

/* Оптимизация для производительности на мобильных */
@media (max-width: 767.98px) {
    /* Отключаем сложные анимации на слабых устройствах */
    @media (prefers-reduced-motion: reduce) {
        .img-placeholder {
            animation: none;
            background: #f0f0f0;
        }
        
        img[data-src] {
            transition: none;
        }
        
        .social-icon, .footer-social-icon {
            transition: none;
        }
    }
    
    /* Оптимизация видео для мобильных */
    video {
        max-width: 100% !important;
        height: auto !important;
        object-fit: cover;
        border-radius: 8px;
    }
    
    /* Адаптивные изображения в статьях */
    .article-content img {
        max-width: 100% !important;
        height: auto !important;
        border-radius: 6px;
        margin: 0.5rem 0;
    }
}