/**
 * LMX WooCommerce Gallery Lite - CSS Minimalista & Performático
 * Design clean, moderno e otimizado para Core Web Vitals
 * 
 * @package LMX_Woo_Gallery
 * @version 1.2.1
 */

/* =====================================================
   CONTAINER PRINCIPAL
   ===================================================== */
.woocommerce-product-gallery .lmx-product-gallery {
    position: relative;
    max-width: 100%;
}

/* =====================================================
   IMAGEM PRINCIPAL
   ===================================================== */
.lmx-gallery-main {
    position: relative;
    margin-bottom: 1rem;
    overflow: hidden;
}

.lmx-main-image {
    width: 100%;
    height: auto;
    display: block;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Estado de loading */
.lmx-main-image.lmx-loading {
    opacity: 0.6;
}

/* =====================================================
   CONTAINER DE MINIATURAS
   ===================================================== */
.lmx-gallery-thumbs {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    margin: 0;
    padding: 0.25rem 0;
    list-style: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.15) transparent;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;
}

/* Scrollbar customizada (Webkit) */
.lmx-gallery-thumbs::-webkit-scrollbar {
    height: 4px;
}

.lmx-gallery-thumbs::-webkit-scrollbar-track {
    background: transparent;
}

.lmx-gallery-thumbs::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 4px;
}

.lmx-gallery-thumbs::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.25);
}

/* =====================================================
   BOTÕES DAS MINIATURAS
   ===================================================== */
.lmx-thumb {
    flex: 0 0 auto;
    position: relative;
    padding: 0;
    margin: 0;
    border: 2px solid transparent;
    background: #fafafa;
    cursor: pointer;
    width: 64px;
    height: 64px;
    border-radius: 4px;
    overflow: hidden;
    transition: border-color 0.2s ease, transform 0.15s ease;
    scroll-snap-align: start;
}

.lmx-thumb:hover {
    border-color: rgba(0,0,0,0.2);
    transform: translateY(-2px);
}

.lmx-thumb.active {
    border-color: #000;
    transform: translateY(-2px);
}

.lmx-thumb:focus {
    outline: none;
    border-color: #000;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.1);
}

.lmx-thumb:active {
    transform: translateY(0);
}

/* =====================================================
   IMAGENS DAS MINIATURAS
   ===================================================== */
.lmx-thumb-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.lmx-thumb-image.active {
    opacity: 1;
}

/* =====================================================
   PLACEHOLDER
   ===================================================== */
.lmx-placeholder {
    opacity: 0.5;
}

/* =====================================================
   RESPONSIVO - TABLET
   ===================================================== */
@media (min-width: 768px) and (max-width: 1024px) {
    .lmx-thumb {
        width: 72px;
        height: 72px;
    }
}

/* =====================================================
   RESPONSIVO - DESKTOP
   ===================================================== */
@media (min-width: 1025px) {
    .lmx-thumb {
        width: 80px;
        height: 80px;
    }
    
    .lmx-gallery-thumbs {
        gap: 0.75rem;
    }
}

/* =====================================================
   RESPONSIVO - MOBILE
   ===================================================== */
@media (max-width: 767px) {
    .lmx-thumb {
        width: 56px;
        height: 56px;
        border-radius: 2px;
    }
    
    .lmx-gallery-thumbs {
        gap: 0.375rem;
        padding: 0.125rem 0;
    }
}

/* =====================================================
   IMPRESSÃO
   ===================================================== */
@media print {
    .lmx-gallery-thumbs {
        display: none;
    }
}

/* =====================================================
   ACESSIBILIDADE
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
    .lmx-thumb,
    .lmx-main-image {
        transition: none;
    }
    
    .lmx-gallery-thumbs {
        scroll-behavior: auto;
    }
}

/* =====================================================
   HIGH DPI / RETINA
   ===================================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .lmx-main-image,
    .lmx-thumb-image {
        image-rendering: -webkit-optimize-contrast;
    }
}
