/* Адаптивные изображения для мобильных устройств */

/* Базовые стили для всех изображений */
img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

/* Контейнеры изображений */
.image-container {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* Responsive изображения в зависимости от размера экрана */
.responsive-image {
    width: 100%;
    height: auto;
    transition: all 0.3s ease;
}

/* Hero изображения */
.hero-image {
    width: 100%;
    max-width: 600px;
    height: auto;
    border-radius: 16px;
    box-shadow: none; /* Убираем тень */
}

@media (max-width: 768px) {
    .hero-image {
        max-width: 100%;
        border-radius: 20px;
        margin: 20px 0;
    }
}

@media (max-width: 480px) {
    .hero-image {
        border-radius: 16px;
        margin: 16px 0;
    }
}

/* Изображения в карточках */
.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 12px 12px 0 0;
}

@media (max-width: 768px) {
    .card-image {
        height: 180px;
        border-radius: 16px 16px 0 0;
    }
}

@media (max-width: 480px) {
    .card-image {
        height: 160px;
        border-radius: 12px 12px 0 0;
    }
}

/* Галерея изображений */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

@media (max-width: 768px) {
    .image-gallery {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 12px;
        margin: 16px 0;
    }
}

@media (max-width: 480px) {
    .image-gallery {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.gallery-item {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.gallery-item:hover {
    transform: scale(1.02);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

/* Изображения логотипов */
.logo-image {
    width: auto;
    height: 40px;
    max-width: 200px;
}

@media (max-width: 768px) {
    .logo-image {
        height: 36px;
        max-width: 180px;
    }
}

@media (max-width: 480px) {
    .logo-image {
        height: 32px;
        max-width: 160px;
    }
}

/* Иконки и маленькие изображения */
.icon-image {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 4px;
}

@media (max-width: 768px) {
    .icon-image {
        width: 28px;
        height: 28px;
        border-radius: 6px;
    }
}

/* Изображения в блоках контента */
.content-image {
    width: 100%;
    max-width: 800px;
    height: auto;
    margin: 20px 0;
    border-radius: 12px;
    box-shadow: none; /* Убираем тень */
}

@media (max-width: 768px) {
    .content-image {
        margin: 16px 0;
        border-radius: 16px;
    }
}

/* Изображения в сетке (для тарифов, услуг) */
.grid-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .grid-image {
        height: 140px;
        border-radius: 12px;
    }
}

@media (max-width: 480px) {
    .grid-image {
        height: 120px;
        border-radius: 8px;
    }
}

/* Фоновые изображения */
.bg-image {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

.bg-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.bg-image > * {
    position: relative;
    z-index: 2;
}

/* Lazy loading стили */
.lazy-image {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-image.loaded {
    opacity: 1;
}

.lazy-image.loading {
    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;
    }
}

/* Picture элемент для разных разрешений */
picture {
    display: block;
    width: 100%;
}

picture img {
    width: 100%;
    height: auto;
}

/* WebP поддержка */
.webp-image {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Изображения с соотношением сторон */
.aspect-ratio-16-9 {
    aspect-ratio: 16/9;
}

.aspect-ratio-4-3 {
    aspect-ratio: 4/3;
}

.aspect-ratio-1-1 {
    aspect-ratio: 1/1;
}

.aspect-ratio-3-2 {
    aspect-ratio: 3/2;
}

/* Контейнеры с фиксированным соотношением */
.aspect-container {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.aspect-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Изображения в слайдерах */
.slider-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 12px;
}

@media (max-width: 768px) {
    .slider-image {
        height: 250px;
        border-radius: 16px;
    }
}

@media (max-width: 480px) {
    .slider-image {
        height: 200px;
        border-radius: 12px;
    }
}

/* Аватары и круглые изображения */
.avatar-image {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: none; /* Убираем тень */
}

@media (max-width: 768px) {
    .avatar-image {
        width: 56px;
        height: 56px;
        border-width: 2px;
    }
}

.avatar-large {
    width: 120px;
    height: 120px;
}

@media (max-width: 768px) {
    .avatar-large {
        width: 100px;
        height: 100px;
    }
}

/* Изображения в отзывах */
.testimonial-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 16px;
}

@media (max-width: 768px) {
    .testimonial-image {
        width: 70px;
        height: 70px;
        margin: 0 auto 12px;
    }
}

/* Изображения партнеров */
.partner-logo {
    width: auto;
    height: 60px;
    max-width: 150px;
    object-fit: contain;
    filter: grayscale(100%);
    opacity: 0.7;
    transition: all 0.3s ease;
}

.partner-logo:hover {
    filter: grayscale(0%);
    opacity: 1;
}

@media (max-width: 768px) {
    .partner-logo {
        height: 50px;
        max-width: 120px;
    }
}

@media (max-width: 480px) {
    .partner-logo {
        height: 40px;
        max-width: 100px;
    }
}

/* Оптимизация для Retina дисплеев */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .retina-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: optimize-contrast;
    }
}

/* Изображения с эффектами */
.image-hover-zoom {
    overflow: hidden;
    border-radius: 12px;
}

.image-hover-zoom img {
    transition: transform 0.3s ease;
}

.image-hover-zoom:hover img {
    transform: scale(1.05);
}

/* Изображения с overlay */
.image-overlay {
    position: relative;
}

.image-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.7));
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-overlay:hover::after {
    opacity: 1;
}

/* Изображения в модальных окнах */
.modal-image {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

/* Плейсхолдеры для изображений */
.image-placeholder {
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 14px;
    border-radius: 8px;
    min-height: 150px;
}

@media (max-width: 768px) {
    .image-placeholder {
        min-height: 120px;
        font-size: 12px;
        border-radius: 12px;
    }
}

/* Анимации для изображений */
.image-fade-in {
    opacity: 0;
    animation: fadeIn 0.5s ease-in-out forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.image-slide-up {
    opacity: 0;
    transform: translateY(20px);
    animation: slideUp 0.6s ease-out forwards;
}

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

/* Оптимизация производительности */
.image-optimized {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}