/**
 * Elementor 3D Gallery - Styles
 * 
 * @since 1.0.0
 */

/* ============================================
   CSS VARIABLES
   ============================================ */

:root {
    --gallery-gap: 10px;
    --gallery-item-height: 250px;
    --gallery-overlay-padding: 20px;
    --gallery-title-size: 16px;
    --gallery-desc-size: 13px;
    --gallery-zoom-size: 50px;
    --gallery-border-radius: 8px;
    --gallery-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    --transition-speed: 0.3s;
}

/* ============================================
   CONTAINER & LAYOUTS
   ============================================ */

.elementor-gallery-3d-container {
    width: 100%;
    position: relative;
}

.gallery-3d-side-by-side {
    display: flex;
    gap: 20px;
    align-items: stretch;
}

.gallery-3d-side-by-side .gallery-3d-side-item {
    flex: 1;
    min-width: 0;
}

/* ============================================
   RESPONSIVE - SIDE BY SIDE
   ============================================ */

@media (max-width: 1024px) {
    .gallery-3d-side-by-side {
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .gallery-3d-side-by-side {
        flex-direction: column;
        gap: 20px;
    }
    
    .gallery-3d-side-by-side .gallery-3d-side-item {
        width: 100% !important;
    }
}

/* ============================================
   TABS LAYOUT
   ============================================ */

.gallery-3d-tabs {
    width: 100%;
}

.gallery-3d-tabs-nav {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.gallery-3d-tabs-nav::-webkit-scrollbar {
    display: none;
}

.gallery-3d-tab-btn {
    padding: 14px 28px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    transition: all var(--transition-speed) ease;
    margin-bottom: -2px;
    white-space: nowrap;
    flex-shrink: 0;
}

.gallery-3d-tab-btn:hover {
    color: #333;
}

.gallery-3d-tab-btn.active {
    color: #61dafb;
    border-bottom-color: #61dafb;
}

.gallery-3d-tab-panel {
    display: none;
}

.gallery-3d-tab-panel.active {
    display: block;
}

/* Mobile tabs adjustments */
@media (max-width: 480px) {
    .gallery-3d-tabs-nav {
        gap: 0;
        justify-content: space-between;
    }
    
    .gallery-3d-tab-btn {
        padding: 12px 16px;
        font-size: 13px;
        flex: 1;
        text-align: center;
    }
}

/* ============================================
   3D MODEL VIEWER - RESPONSIVE
   ============================================ */

.elementor-3d-model-wrapper {
    position: relative;
    width: 100%;
    min-height: 400px;
    max-height: 70vh;
    border-radius: 12px;
    overflow: hidden;
    background-color: #f0f0f0;
}

.elementor-3d-model-wrapper model-viewer {
    width: 100%;
    height: 100%;
    min-height: inherit;
    background-color: transparent;
    --progress-bar-color: #61dafb;
    --progress-bar-height: 4px;
}

/* AR Button */
.ar-button {
    position: absolute;
    bottom: 16px;
    right: 16px;
    padding: 12px 24px;
    background-color: #000;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.ar-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.ar-button:active {
    transform: scale(0.98);
}

/* Mobile AR button */
@media (max-width: 768px) {
    .ar-button {
        padding: 10px 18px;
        font-size: 12px;
        bottom: 12px;
        right: 12px;
    }
}

@media (max-width: 480px) {
    .ar-button {
        padding: 8px 14px;
        font-size: 11px;
        bottom: 10px;
        right: 10px;
    }
}

/* Progress Bar */
.progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.3);
    z-index: 5;
}

.progress-bar.hide {
    display: none;
}

.update-bar {
    height: 100%;
    background: linear-gradient(90deg, #61dafb, #4fc3f7);
    width: 0%;
    transition: width 0.3s ease;
}

/* Loading State */
.elementor-3d-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #666;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

.elementor-3d-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid #e0e0e0;
    border-top-color: #61dafb;
    border-radius: 50%;
    animation: elementor-3d-spin 1s linear infinite;
}

@keyframes elementor-3d-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error State */
/* Fallback cuando model-viewer falla: muestra el poster + badge */
.elementor-3d-error {
    position: absolute;
    inset: 0;
    display: none; /* JS lo activa */
    background-color: #f5f5f5;
    /* background-image se inyecta por JS si hay poster */
}

/* Badge "3D no disponible" en la esquina inferior */
.elementor-3d-error::after {
    content: '3D no disponible';
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 5px 14px;
    border-radius: 20px;
    white-space: nowrap;
    pointer-events: none;
}

/* Fallback en el product viewer */
.e3dg-pv__fallback {
    width: 100%;
    height: 100%;
    position: relative;
}

.e3dg-pv__fallback-badge {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 20px;
    white-space: nowrap;
    pointer-events: none;
}

/* Responsive 3D wrapper */
@media (max-width: 768px) {
    .elementor-3d-model-wrapper {
        min-height: 350px;
        max-height: 50vh;
        border-radius: 8px;
    }
}

@media (max-width: 480px) {
    .elementor-3d-model-wrapper {
        min-height: 280px;
        max-height: 45vh;
        border-radius: 6px;
    }
    
    .elementor-3d-loading {
        font-size: 12px;
    }
    
    .elementor-3d-loading-spinner {
        width: 36px;
        height: 36px;
    }
}

/* ============================================
   GALLERY - GRID LAYOUT (RESPONSIVE)
   ============================================ */

.elementor-gallery {
    width: 100%;
}

.gallery-layout-grid {
    display: grid;
    gap: var(--gallery-gap);
}

.gallery-layout-grid .gallery-item {
    position: relative;
    overflow: hidden;
}

/* Desktop columns */
.gallery-layout-grid[data-columns="1"] { grid-template-columns: repeat(1, 1fr); }
.gallery-layout-grid[data-columns="2"] { grid-template-columns: repeat(2, 1fr); }
.gallery-layout-grid[data-columns="3"] { grid-template-columns: repeat(3, 1fr); }
.gallery-layout-grid[data-columns="4"] { grid-template-columns: repeat(4, 1fr); }
.gallery-layout-grid[data-columns="5"] { grid-template-columns: repeat(5, 1fr); }
.gallery-layout-grid[data-columns="6"] { grid-template-columns: repeat(6, 1fr); }

/* Tablet - Large (1024px) */
@media (max-width: 1024px) {
    .gallery-layout-grid { 
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tablet - Medium (768px) */
@media (max-width: 768px) {
    .gallery-layout-grid { 
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile - Small (480px) */
@media (max-width: 480px) {
    .gallery-layout-grid { 
        grid-template-columns: 1fr !important;
        gap: calc(var(--gallery-gap) * 0.8);
    }
}

/* Force specific columns at breakpoints */
.gallery-layout-grid.cols-tablet-1 { grid-template-columns: repeat(1, 1fr) !important; }
.gallery-layout-grid.cols-tablet-2 { grid-template-columns: repeat(2, 1fr) !important; }
.gallery-layout-grid.cols-tablet-3 { grid-template-columns: repeat(3, 1fr) !important; }

.gallery-layout-grid.cols-mobile-1 { grid-template-columns: repeat(1, 1fr) !important; }
.gallery-layout-grid.cols-mobile-2 { grid-template-columns: repeat(2, 1fr) !important; }

/* ============================================
   GALLERY - MASONRY LAYOUT (RESPONSIVE)
   ============================================ */

.gallery-layout-masonry {
    display: block;
    column-count: 3;
    column-gap: var(--gallery-gap);
}

.gallery-layout-masonry .gallery-item {
    break-inside: avoid;
    margin-bottom: var(--gallery-gap);
}

@media (max-width: 1024px) {
    .gallery-layout-masonry {
        column-count: 2;
    }
}

@media (max-width: 600px) {
    .gallery-layout-masonry {
        column-count: 1;
    }
}

@media (max-width: 480px) {
    .gallery-layout-masonry {
        column-count: 1;
        column-gap: calc(var(--gallery-gap) * 0.8);
    }
    
    .gallery-layout-masonry .gallery-item {
        margin-bottom: calc(var(--gallery-gap) * 0.8);
    }
}

/* ============================================
   GALLERY - SLIDER LAYOUT (RESPONSIVE)
   ============================================ */

.gallery-layout-slider {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    gap: var(--gallery-gap);
    padding-bottom: var(--gallery-gap);
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}

.gallery-layout-slider::-webkit-scrollbar {
    height: 6px;
}

.gallery-layout-slider::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.gallery-layout-slider::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.gallery-layout-slider::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.gallery-layout-slider .gallery-item {
    flex: 0 0 300px;
    scroll-snap-align: start;
}

/* Tablet slider */
@media (max-width: 768px) {
    .gallery-layout-slider .gallery-item {
        flex: 0 0 250px;
    }
}

/* Mobile slider */
@media (max-width: 480px) {
    .gallery-layout-slider {
        gap: calc(var(--gallery-gap) * 0.8);
        padding-bottom: calc(var(--gallery-gap) * 0.8);
    }
    
    .gallery-layout-slider .gallery-item {
        flex: 0 0 200px;
    }
}

/* Hide scrollbar on very small devices */
@media (max-width: 360px) {
    .gallery-layout-slider .gallery-item {
        flex: 0 0 160px;
    }
}

/* ============================================
   GALLERY - JUSTIFIED LAYOUT (RESPONSIVE)
   ============================================ */

.gallery-layout-justified {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gallery-gap);
}

.gallery-layout-justified .gallery-item {
    flex: 1 1 auto;
    min-width: 200px;
    max-width: 400px;
    height: 250px;
}

.gallery-layout-justified .gallery-item .gallery-image {
    height: 100%;
    object-fit: cover;
}

@media (max-width: 768px) {
    .gallery-layout-justified .gallery-item {
        min-width: 150px;
        height: 200px;
    }
}

@media (max-width: 480px) {
    .gallery-layout-justified {
        gap: calc(var(--gallery-gap) * 0.8);
    }
    
    .gallery-layout-justified .gallery-item {
        min-width: 100%;
        max-width: 100%;
        height: 180px;
    }
}

/* ============================================
   GALLERY ITEM (RESPONSIVE)
   ============================================ */

.gallery-item {
    position: relative;
}

.gallery-item-inner {
    position: relative;
    overflow: hidden;
    border-radius: var(--gallery-border-radius);
    box-shadow: var(--gallery-shadow);
}

.gallery-lightbox-link {
    display: block;
    text-decoration: none;
}

.gallery-image {
    width: 100%;
    height: var(--gallery-item-height);
    object-fit: cover;
    display: block;
    /* Zoom: velocidad y escala controladas por CSS vars del widget */
    transition: transform var(--e3dg-zoom-speed, 0.4s) ease,
                opacity var(--transition-speed) ease;
    background-color: #f0f0f0;
}

.gallery-layout-masonry .gallery-image {
    height: auto;
}

/* La lupa real se gestiona por JS — no usamos transform CSS.
   El cursor crosshair lo aplica JS al activar la lupa. */

/* Responsive image heights */
@media (max-width: 768px) {
    .gallery-image {
        height: 200px;
    }
}

@media (max-width: 480px) {
    .gallery-image {
        height: 180px;
    }
}

@media (max-width: 360px) {
    .gallery-image {
        height: 150px;
    }
}

/* ============================================
   GALLERY ITEM OVERLAY (RESPONSIVE)
   ============================================ */

.gallery-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.85) 0%,
        rgba(0, 0, 0, 0.4) 40%,
        rgba(0, 0, 0, 0) 100%
    );
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: var(--gallery-overlay-padding);
    opacity: 0;
    transition: opacity var(--transition-speed) ease;
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

/* Always show overlay on touch devices */
@media (hover: none) {
    .gallery-item-overlay {
        opacity: 1;
        background: linear-gradient(
            to top,
            rgba(0, 0, 0, 0.7) 0%,
            rgba(0, 0, 0, 0.2) 50%,
            rgba(0, 0, 0, 0) 100%
        );
    }
    
    .gallery-item-zoom {
        display: none;
    }
}

.gallery-item-title {
    margin: 0 0 4px;
    font-size: var(--gallery-title-size);
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
}

.gallery-item-description {
    margin: 0 0 8px;
    font-size: var(--gallery-desc-size);
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.4;
}

.gallery-item-zoom {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: var(--gallery-zoom-size);
    height: var(--gallery-zoom-size);
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-speed) ease;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.gallery-item:hover .gallery-item-zoom {
    transform: translate(-50%, -50%) scale(1);
}

.gallery-item-zoom svg {
    width: 24px;
    height: 24px;
}

/* Responsive overlay */
@media (max-width: 768px) {
    .gallery-item-overlay {
        padding: 15px;
    }
    
    .gallery-item-title {
        font-size: 14px;
    }
    
    .gallery-item-description {
        font-size: 12px;
        display: none;
    }
    
    .gallery-item-zoom {
        width: 44px;
        height: 44px;
    }
    
    .gallery-item-zoom svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 480px) {
    .gallery-item-overlay {
        padding: 12px;
    }
    
    .gallery-item-title {
        font-size: 13px;
    }
    
    .gallery-item-description {
        display: none;
    }
    
    .gallery-item-zoom {
        width: 36px;
        height: 36px;
    }
    
    .gallery-item-zoom svg {
        width: 18px;
        height: 18px;
    }
}

/* ============================================
   LIGHTBOX (GLightbox) - Fix 7
   El CSS base viene del CDN (glightbox.min.css).
   Solo sobreescribimos lo necesario para integrarlo
   con el diseño del plugin.
   ============================================ */

/* Fondo más oscuro para mejor contraste */
.glightbox-clean .goverlay {
    background: rgba(0, 0, 0, 0.95);
}

/* Título y descripción */
.glightbox-clean .gdesc-inner {
    padding: 12px 20px;
}

.glightbox-clean .gslide-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
}

.glightbox-clean .gslide-desc {
    font-size: 12px;
    color: rgba(255,255,255,0.75);
}

/* Botones de navegación */
.glightbox-clean .gnext,
.glightbox-clean .gprev {
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    transition: background 0.2s ease;
}

.glightbox-clean .gnext:hover,
.glightbox-clean .gprev:hover {
    background: rgba(255,255,255,0.30);
}

/* Contador */
.glightbox-clean .gslide-counter {
    color: rgba(255,255,255,0.7);
    font-size: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .glightbox-clean .gdesc-inner {
        padding: 8px 14px;
    }
    .glightbox-clean .gslide-title {
        font-size: 13px;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

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

.gallery-item {
    animation: fadeInUp 0.5s ease forwards;
}

.gallery-item:nth-child(1) { animation-delay: 0s; }
.gallery-item:nth-child(2) { animation-delay: 0.05s; }
.gallery-item:nth-child(3) { animation-delay: 0.1s; }
.gallery-item:nth-child(4) { animation-delay: 0.15s; }
.gallery-item:nth-child(5) { animation-delay: 0.2s; }
.gallery-item:nth-child(6) { animation-delay: 0.25s; }
.gallery-item:nth-child(7) { animation-delay: 0.3s; }
.gallery-item:nth-child(8) { animation-delay: 0.35s; }
.gallery-item:nth-child(n+9) { animation-delay: 0.4s; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .gallery-item {
        animation: none;
    }
    
    .gallery-image {
        transition: none;
    }
    
    .gallery-item-overlay {
        transition: none;
    }
}

/* ============================================
   UTILITIES
   ============================================ */

.hide {
    display: none !important;
}

.visible {
    display: block !important;
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .gallery-item-inner {
        -webkit-tap-highlight-color: transparent;
    }
    
    .gallery-item:active .gallery-image {
        transform: scale(1.05);
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .gallery-image {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Print styles */
@media print {
    .gallery-item-overlay,
    .ar-button,
    .progress-bar,
    .gallery-item-zoom {
        display: none !important;
    }
    
    .gallery-image {
        height: auto !important;
    }
}


/* ============================================================
   PRODUCT VIEWER LAYOUT — e3dg-pv
   Todos los valores personalizables usan CSS custom properties
   inyectadas inline desde PHP. Los valores aquí son fallbacks.
   ============================================================ */

.e3dg-pv {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    user-select: none;
    /* CSS vars con fallbacks — sobreescritas por el widget */
    --e3dg-pv-bg:              #f5f5f5;
    --e3dg-pv-h:               500px;
    --e3dg-pv-arr-size:        40px;
    --e3dg-pv-arr-icon:        24px;
    --e3dg-pv-arr-radius:      50px;
    --e3dg-pv-arr-bg:          rgba(255,255,255,0.90);
    --e3dg-pv-arr-color:       #333;
    --e3dg-pv-arr-bg-hover:    #fff;
    --e3dg-pv-arr-color-hover: #000;
    --e3dg-pv-th-size:         72px;
    --e3dg-pv-th-radius:       8px;
    --e3dg-pv-th-gap:          8px;
    --e3dg-pv-th-border:       #61dafb;
    --e3dg-pv-th-border-hover: #aaaaaa;
    --e3dg-pv-th-border-width: 2px;
    --e3dg-pv-badge-bg:        #61dafb;
    --e3dg-pv-badge-color:     #000;
    --e3dg-pv-badge-font:      9px;
    /* Zoom vars — sobreescritas por el widget */
    --e3dg-pv-zoom:            1.1;
    --e3dg-pv-zoom-speed:      400ms;
}

/* Lupa real en product viewer — gestionada 100% por JS.
   NO aplicamos transform al img ni al model-wrap para no
   interferir con los controles de cámara del model-viewer. */

/* Garantizar que model-viewer nunca recibe transform */
.e3dg-pv__model-wrap,
.e3dg-pv__model-wrap model-viewer {
    transform: none !important;
    will-change: auto;
}

/* Lupa: div circular que se posiciona sobre la imagen */
.e3dg-pv__lens {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.8);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.15), 0 4px 20px rgba(0,0,0,0.3);
    pointer-events: none;
    overflow: hidden;
    display: none;
    z-index: 50;
    background-repeat: no-repeat;
    /* cursor crosshair se aplica al img-wrap en JS */
}

.e3dg-pv__img-wrap.lens-active {
    cursor: crosshair;
}

/* Lupa en galería clásica */
.e3dg-gallery-lens-wrap {
    position: relative;
    overflow: visible;
}

.e3dg-gallery-lens {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.8);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.15), 0 4px 20px rgba(0,0,0,0.3);
    pointer-events: none;
    overflow: hidden;
    display: none;
    z-index: 50;
    background-repeat: no-repeat;
}

.gallery-item-inner.lens-active {
    cursor: crosshair;
    overflow: visible;
}

/* ── Visor principal (arriba) ────────────────────────────── */
.e3dg-pv__main {
    position: relative;
    width: 100%;
    height: var(--e3dg-pv-h);
    min-height: 200px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--e3dg-pv-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.e3dg-pv__img-wrap,
.e3dg-pv__model-wrap {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.e3dg-pv__img-wrap.active,
.e3dg-pv__model-wrap.active {
    opacity: 1;
    pointer-events: auto;
}

.e3dg-pv__img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    transition: opacity 0.25s ease;
}

/* model-viewer dentro del visor */
.e3dg-pv__model-wrap model-viewer {
    width: 100%;
    height: 100%;
    --progress-bar-color: #61dafb;
}

/* ── Flechas de navegación ───────────────────────────────── */
/* !important en propiedades clave para blindar contra temas
   (Hello Elementor, Astra, etc.) que sobreescriben botones */
.e3dg-pv__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: var(--e3dg-pv-arr-size) !important;
    height: var(--e3dg-pv-arr-size) !important;
    background: var(--e3dg-pv-arr-bg) !important;
    border: none !important;
    border-radius: var(--e3dg-pv-arr-radius) !important;
    font-size: var(--e3dg-pv-arr-icon);
    line-height: 1 !important;
    color: var(--e3dg-pv-arr-color) !important;
    cursor: pointer;
    z-index: 10;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    padding: 0 !important;
    margin: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    -webkit-appearance: none;
    appearance: none;
    outline: none !important;
}

/* Cubrir TODOS los pseudo-estados para que ningún tema gane */
.e3dg-pv__arrow:hover,
.e3dg-pv__arrow:focus,
.e3dg-pv__arrow:focus-visible {
    background: var(--e3dg-pv-arr-bg-hover) !important;
    color: var(--e3dg-pv-arr-color-hover) !important;
    border: none !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2) !important;
    outline: none !important;
    text-decoration: none !important;
    transform: translateY(-50%) scale(1.08);
}

.e3dg-pv__arrow:active,
.e3dg-pv__arrow:visited {
    background: var(--e3dg-pv-arr-bg) !important;
    color: var(--e3dg-pv-arr-color) !important;
    border: none !important;
    outline: none !important;
    text-decoration: none !important;
}

.e3dg-pv__arrow--prev { left: 12px; }
.e3dg-pv__arrow--next { right: 12px; }

.e3dg-pv__arrow:disabled,
.e3dg-pv__arrow:disabled:hover,
.e3dg-pv__arrow:disabled:focus {
    opacity: 0.3;
    cursor: default;
    transform: translateY(-50%);
    background: var(--e3dg-pv-arr-bg) !important;
    color: var(--e3dg-pv-arr-color) !important;
    box-shadow: none !important;
}

/* ── Tira de miniaturas (abajo) ──────────────────────────── */
.e3dg-pv__thumbs {
    display: flex;
    gap: var(--e3dg-pv-th-gap);
    justify-content: center;
    flex-wrap: wrap;
    overflow-x: auto;
    padding: 4px 2px 8px;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.e3dg-pv__thumbs::-webkit-scrollbar { height: 4px; }
.e3dg-pv__thumbs::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

/* Miniatura individual */
.e3dg-pv__thumb {
    flex: 0 0 auto;
    width: var(--e3dg-pv-th-size);
    height: var(--e3dg-pv-th-size);
    /* Permitir que se encojan si no caben */
    max-width: calc((100% - var(--e3dg-pv-th-gap) * 4) / 5);
    border-radius: var(--e3dg-pv-th-radius);
    overflow: hidden;
    /* Reset total de estilos de botón del tema (Hello Elementor, etc.) */
    border: var(--e3dg-pv-th-border-width) solid transparent;
    border-color: transparent;
    cursor: pointer;
    padding: 0;
    margin: 0;
    background: #f0f0f0;
    color: inherit;
    position: relative;
    transition: border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none;
    text-decoration: none;
    aspect-ratio: 1 / 1;
}

/* Neutralizar focus-visible del tema */
.e3dg-pv__thumb:focus,
.e3dg-pv__thumb:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border-color: transparent !important;
    color: inherit !important;
    background: #f0f0f0 !important;
}

.e3dg-pv__thumb:hover {
    border-color: var(--e3dg-pv-th-border-hover) !important;
    color: inherit !important;
    background: #f0f0f0 !important;
    transform: translateY(-2px);
}

.e3dg-pv__thumb.active {
    border-color: var(--e3dg-pv-th-border) !important;
    box-shadow: 0 0 0 1px var(--e3dg-pv-th-border) !important;
    background: #f0f0f0 !important;
}

.e3dg-pv__thumb.active:hover,
.e3dg-pv__thumb.active:focus {
    border-color: var(--e3dg-pv-th-border) !important;
    box-shadow: 0 0 0 1px var(--e3dg-pv-th-border) !important;
    background: #f0f0f0 !important;
    color: inherit !important;
}

/* Si el borde está desactivado (width=0), ocultar también el box-shadow activo */
.e3dg-pv__thumb.active[style*="--e3dg-pv-th-border-width: 0"] {
    box-shadow: none;
}

.e3dg-pv__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

/* Miniatura 3D
   background-clip: padding-box es la clave:
   sin él, el fondo #1a1a2e se pinta también DEBAJO del borde transparente
   y crea la ilusión de un borde oscuro visible aunque border-color sea transparent. */
.e3dg-pv__thumb--3d {
    background: #1a1a2e;
    background-clip: padding-box;
    border-color: transparent;
    outline: none;
    color: #333;
}

.e3dg-pv__thumb--3d img {
    opacity: 0.85;
}

.e3dg-pv__thumb--3d:hover img {
    opacity: 1;
}

/* Badge "3D" sobre la miniatura */
.e3dg-pv__3d-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: var(--e3dg-pv-badge-bg);
    color: var(--e3dg-pv-badge-color);
    font-size: var(--e3dg-pv-badge-font);
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 2px 5px;
    border-radius: 4px;
    line-height: 1.4;
    pointer-events: none;
}

/* Placeholder si no hay poster */
.e3dg-pv__thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #61dafb;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
    .e3dg-pv__main {
        border-radius: 10px;
    }
}

@media (max-width: 768px) {
    .e3dg-pv__main {
        border-radius: 8px;
        min-height: 200px;
    }
    /* Miniaturas: flex-wrap para que se ajusten al ancho */
    .e3dg-pv__thumbs {
        justify-content: center;
        padding-left: 4px;
        padding-right: 4px;
        flex-wrap: wrap;
    }
    /* Limitar tamaño máximo para que quepan bien */
    .e3dg-pv__thumb {
        max-width: calc((100% - var(--e3dg-pv-th-gap) * 3) / 4);
    }
}

@media (max-width: 480px) {
    .e3dg-pv__main {
        border-radius: 6px;
        min-height: 160px;
    }
    .e3dg-pv__arrow--prev { left: 6px; }
    .e3dg-pv__arrow--next { right: 6px; }
    /* Miniaturas: máximo 4 por fila, se encojen si es necesario */
    .e3dg-pv__thumbs {
        justify-content: center;
        gap: var(--e3dg-pv-th-gap);
        padding: 4px 2px 10px;
        flex-wrap: wrap;
    }
    .e3dg-pv__thumb {
        /* Forzar que no sean más anchas que 1/4 del contenedor */
        max-width: calc((100% - var(--e3dg-pv-th-gap) * 3) / 4);
        /* Si el valor de la CSS var es mayor, height auto sigue aspect-ratio */
        height: auto;
    }
}

@media (max-width: 360px) {
    /* Pantallas muy pequeñas: máximo 3 por fila */
    .e3dg-pv__thumb {
        max-width: calc((100% - var(--e3dg-pv-th-gap) * 2) / 3);
    }
}

@media (prefers-reduced-motion: reduce) {
    .e3dg-pv__img-wrap,
    .e3dg-pv__model-wrap,
    .e3dg-pv__img,
    .e3dg-pv__thumb,
    .e3dg-pv__arrow { transition: none; }
}
