/* CSS optimizado para imágenes responsivas - Via Motos Honda */

/* Configuración base para imágenes optimizadas */
.imagen-optimizada {
    display: inline-block;
    max-width: 100%;
    height: auto;
    position: relative;
    overflow: hidden;
}

/* Estilos para elementos picture */
picture {
    display: inline-block;
    max-width: 100%;
    height: auto;
}

/* Optimizaciones para imágenes específicas */

/* Logo Via Motos - Loading Screen */
.loading-logo .logo-viamotos {
    height: 50px;
    width: auto;
    filter: brightness(0) invert(1);
    object-fit: contain;
    transition: opacity 0.3s ease;
}

/* Logo Honda - Loading Screen */
.loading-logo .logo-honda {
    height: 50px;
    width: auto;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

/* Hero Section Logo */
.hero-logo {
    max-width: 240px;
    max-height: 60px;
    width: 100%;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.hero-logo:hover {
    transform: scale(1.05);
}

/* Barra de navegación logos */
.nav-logo {
    max-width: 108px;
    max-height: 50px;
    width: 100%;
    height: auto;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

/* Footer logo */
.footer-logo {
    max-width: 200px;
    max-height: 50px;
    width: 100%;
    height: auto;
    object-fit: contain;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.footer-logo:hover {
    opacity: 1;
}

/* Lazy loading optimizado */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.5s ease;
}

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

/* Placeholder para lazy loading */
.lazy-placeholder {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

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

/* Optimizaciones para diferentes tamaños de pantalla */
@media (max-width: 480px) {
    .hero-logo {
        max-width: 180px;
        max-height: 45px;
    }
    
    .nav-logo {
        max-width: 80px;
        max-height: 37px;
    }
    
    .footer-logo {
        max-width: 150px;
        max-height: 37px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .hero-logo {
        max-width: 200px;
        max-height: 50px;
    }
    
    .nav-logo {
        max-width: 90px;
        max-height: 42px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .hero-logo {
        max-width: 220px;
        max-height: 55px;
    }
    
    .nav-logo {
        max-width: 100px;
        max-height: 46px;
    }
}

@media (min-width: 1025px) {
    .hero-logo {
        max-width: 240px;
        max-height: 60px;
    }
    
    .nav-logo {
        max-width: 108px;
        max-height: 50px;
    }
}

/* Optimizaciones de rendimiento */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    backface-visibility: hidden;
    transform: translateZ(0);
    will-change: opacity;
}

/* Soporte para formatos modernos */
@supports (image-rendering: -webkit-optimize-contrast) {
    img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Optimizaciones para dispositivos de alta densidad */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero-logo {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Estados de carga y error */
.imagen-cargando {
    opacity: 0.7;
    filter: blur(1px);
}

.imagen-error {
    opacity: 0.5;
    filter: grayscale(100%);
}

.imagen-error::after {
    content: "⚠️ Error cargando imagen";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Optimizaciones para Core Web Vitals */
.imagen-lcp {
    /* Imágenes críticas para LCP */
    fetchpriority: high;
    loading: eager;
    decoding: sync;
}

.imagen-no-critica {
    /* Imágenes no críticas */
    loading: lazy;
    decoding: async;
}

/* Contenedores optimizados */
.imagen-container {
    contain: layout style paint;
    position: relative;
    overflow: hidden;
}

/* Efectos de hover optimizados */
.imagen-hover {
    transition: transform 0.3s ease, filter 0.3s ease;
}

.imagen-hover:hover {
    transform: scale(1.02);
    filter: brightness(1.05);
}

/* Optimizaciones para accesibilidad */
img[alt] {
    /* Asegurar que las imágenes con alt se muestren correctamente */
    display: inline-block;
}

img:not([alt]) {
    /* Marcar imágenes sin alt para desarrollo */
    border: 2px dashed #ff6b6b;
}

/* Soporte para prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    img,
    .imagen-hover {
        transition: none;
    }
    
    .lazy-placeholder {
        animation: none;
    }
}

/* Optimizaciones para modo oscuro */
@media (prefers-color-scheme: dark) {
    .lazy-placeholder {
        background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
    }
}

/* Clases utilitarias */
.imagen-centrada {
    display: block;
    margin: 0 auto;
}

.imagen-redondeada {
    border-radius: 8px;
}

.imagen-sombra {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.imagen-borde {
    border: 1px solid #e0e0e0;
}

/* Optimizaciones específicas para logos */
.logo-optimizado {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    filter: contrast(1.1);
}

/* Optimizaciones para imágenes de productos */
.producto-imagen {
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.producto-imagen:hover {
    transform: scale(1.05);
}

/* Optimizaciones para banners */
.banner-imagen {
    width: 100%;
    height: auto;
    object-fit: cover;
    max-height: 400px;
}

/* Optimizaciones para iconos */
.icono-optimizado {
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: brightness(0) saturate(100%);
}

/* Optimizaciones para avatares */
.avatar-optimizado {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Optimizaciones para thumbnails */
.thumbnail-optimizado {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.thumbnail-optimizado:hover {
    opacity: 0.8;
}

/* Optimizaciones para galerías */
.galeria-imagen {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.galeria-imagen:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Optimizaciones para sliders */
.slider-imagen {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 8px;
}

/* Optimizaciones para cards */
.card-imagen {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
}

/* Optimizaciones para modales */
.modal-imagen {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Optimizaciones para backgrounds */
.background-imagen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
    filter: brightness(0.8);
}

/* Optimizaciones para overlays */
.overlay-imagen {
    position: relative;
    overflow: hidden;
}

.overlay-imagen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(0,0,0,0.3), rgba(0,0,0,0.1));
    z-index: 1;
}

/* Optimizaciones para responsive design */
@media (max-width: 768px) {
    .producto-imagen {
        aspect-ratio: 4/3;
    }
    
    .banner-imagen {
        max-height: 200px;
    }
    
    .galeria-imagen {
        height: 150px;
    }
    
    .slider-imagen {
        height: 200px;
    }
    
    .card-imagen {
        height: 150px;
    }
}

/* Optimizaciones para impresión */
@media print {
    img {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid;
    }
    
    .imagen-no-print {
        display: none !important;
    }
} 