/* =========================================
   ESTRUCTURA BASE (GLOBAL)
   ========================================= */
.geki-showcase-wrapper, .geki-showcase-wrapper * {
    box-sizing: border-box;
}

.geki-showcase-wrapper {
    display: flex;
    flex-direction: column;
    position: relative;
}

/* El contenedor siempre es flex */
.geki-gallery-container {
    display: flex;
    gap: 15px;
    width: 100%;
}

/* =========================================
   ORDENAMIENTO GLOBAL (Galería vs Selectores)
   ========================================= */
.geki-selectors-pos-top .geki-selectors-container { 
    order: -1; 
    margin-bottom: 15px; 
    padding-bottom: 10px; 
    border-bottom: 1px solid rgba(0,0,0,0.05); 
}
.geki-selectors-pos-top .geki-gallery-container { 
    order: 1; 
}

.geki-selectors-pos-bottom .geki-selectors-container { 
    order: 1; 
    margin-top: 15px; 
    padding-top: 10px; 
    border-top: 1px solid rgba(0,0,0,0.05); 
}
.geki-selectors-pos-bottom .geki-gallery-container { 
    order: -1; 
}


/* =========================================
   ELEMENTOS INTERNOS
   ========================================= */

/* --- IMAGEN PRINCIPAL --- */
.geki-main-image-wrap {
    flex-grow: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-width: 0; 
}

/* Wrapper interno */
.geki-image-holder {
    position: relative;
    display: inline-block;
    width: 100%;
    overflow: hidden;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    line-height: 0; 
}
.geki-image-holder:active { 
    cursor: grabbing; 
}

.geki-main-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: opacity 0.3s ease;
    pointer-events: none; 
}

/* Animación Fade */
.geki-fade-animation {
    animation: gekiFadeIn 0.4s ease-in-out;
}
@keyframes gekiFadeIn {
    from { opacity: 0.4; }
    to { opacity: 1; }
}

/* --- FLECHAS DE NAVEGACIÓN --- */
.geki-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0; 
    transition: all 0.2s ease;
    pointer-events: auto;
    line-height: 1;
}

.geki-image-holder:hover .geki-arrow { opacity: 1; }

@media (max-width: 767px) {
    .geki-arrow { opacity: 1; }
}

.geki-arrow:hover { 
    transform: translateY(-50%) scale(1.1); 
    filter: brightness(0.95); 
}
.geki-arrow-prev { left: 10px; }
.geki-arrow-next { right: 10px; }


/* =========================================
   MINIATURAS (ESTRUCTURA BASE)
   ========================================= */
.geki-thumbs-wrap {
    display: flex;
    gap: 10px;
    flex-shrink: 0; 

    /* --- NUEVO: OCULTAR SCROLLBAR (Mejora UX) --- */
    /* Firefox */
    scrollbar-width: none;
    /* IE y Edge anterior */
    -ms-overflow-style: none;
}

/* Chrome, Safari, Opera, Edge moderno */
.geki-thumbs-wrap::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.geki-thumb-item {
    cursor: pointer;
    border: 2px solid transparent; 
    padding: 1px;
    position: relative;
    min-width: 40px; 
    min-height: 40px;
}
.geki-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #f0f0f0; 
}


/* =========================================
   REGLAS DE LAYOUT (POSICIÓN) - SINCRONIZADO CON PHP
   ========================================= */

/* --- 1. DESKTOP (Aplicado siempre como base) --- */

/* Izquierda */
.geki-layout-desktop-left .geki-gallery-container { 
    flex-direction: row-reverse; 
}
.geki-layout-desktop-left .geki-thumbs-wrap { 
    flex-direction: column; 
    width: auto; 
    max-height: 500px; 
    overflow-y: auto; 
}

/* Derecha */
.geki-layout-desktop-right .geki-gallery-container { 
    flex-direction: row; 
}
.geki-layout-desktop-right .geki-thumbs-wrap { 
    flex-direction: column; 
    width: auto; 
    max-height: 500px; 
    overflow-y: auto; 
}

/* Arriba */
.geki-layout-desktop-top .geki-gallery-container { 
    flex-direction: column-reverse; 
}
.geki-layout-desktop-top .geki-thumbs-wrap { 
    flex-direction: row; 
    width: 100%; 
    justify-content: center; 
    overflow-x: auto; 
}

/* Abajo */
.geki-layout-desktop-bottom .geki-gallery-container { 
    flex-direction: column; 
}
.geki-layout-desktop-bottom .geki-thumbs-wrap { 
    flex-direction: row; 
    width: 100%; 
    justify-content: center; 
    overflow-x: auto; 
}


/* --- 2. TABLET (Overrides) --- */
/* Solo aplica si el usuario configuró una opción distinta en Tablet */
@media (max-width: 1024px) {
    /* Izquierda */
    .geki-layout-tablet-left .geki-gallery-container { flex-direction: row-reverse !important; }
    .geki-layout-tablet-left .geki-thumbs-wrap { flex-direction: column !important; width: auto !important; max-height: 400px; overflow-y: auto; }
    
    /* Derecha */
    .geki-layout-tablet-right .geki-gallery-container { flex-direction: row !important; }
    .geki-layout-tablet-right .geki-thumbs-wrap { flex-direction: column !important; width: auto !important; max-height: 400px; overflow-y: auto; }
    
    /* Arriba */
    .geki-layout-tablet-top .geki-gallery-container { flex-direction: column-reverse !important; } 
    .geki-layout-tablet-top .geki-thumbs-wrap { flex-direction: row !important; width: 100% !important; justify-content: flex-start; overflow-x: auto; }

    /* Abajo */
    .geki-layout-tablet-bottom .geki-gallery-container { flex-direction: column !important; } 
    .geki-layout-tablet-bottom .geki-thumbs-wrap { flex-direction: row !important; width: 100% !important; justify-content: flex-start; overflow-x: auto; }
}


/* --- 3. MOBILE (Overrides) --- */
/* Solo aplica si el usuario configuró una opción distinta en Mobile */
@media (max-width: 767px) {
    /* Izquierda */
    .geki-layout-mobile-left .geki-gallery-container { flex-direction: row-reverse !important; }
    .geki-layout-mobile-left .geki-thumbs-wrap { flex-direction: column !important; width: auto !important; max-height: 300px; overflow-y: auto;}
    
    /* Derecha */
    .geki-layout-mobile-right .geki-gallery-container { flex-direction: row !important; }
    .geki-layout-mobile-right .geki-thumbs-wrap { flex-direction: column !important; width: auto !important; max-height: 300px; overflow-y: auto;}
    
    /* Arriba */
    .geki-layout-mobile-top .geki-gallery-container { flex-direction: column-reverse !important; }
    .geki-layout-mobile-top .geki-thumbs-wrap { flex-direction: row !important; width: 100% !important; justify-content: center; }

    /* Abajo */
    .geki-layout-mobile-bottom .geki-gallery-container { flex-direction: column !important; }
    .geki-layout-mobile-bottom .geki-thumbs-wrap { flex-direction: row !important; width: 100% !important; justify-content: center; }
}


/* =========================================
   SELECTORES DE VARIACIÓN
   ========================================= */
.geki-selectors-container {
    box-sizing: border-box;
    display: flex; 
    flex-direction: column; 
    gap: 10px;
    width: 100%;
}

.geki-selectors-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.geki-selector-item {
    display: flex;
    align-items: center; 
    justify-content: center;
    cursor: pointer;
    box-sizing: content-box;
    gap: 5px; 
    transition: transform 0.2s ease;
}
.geki-selector-item:hover { transform: translateY(-2px); }

/* --- REGLAS DE DIRECCIÓN DEL TEXTO --- */
.geki-label-pos-top .geki-selector-item { flex-direction: column-reverse; } 
.geki-label-pos-bottom .geki-selector-item { flex-direction: column; } 
.geki-label-pos-left .geki-selector-item { flex-direction: row-reverse; } 
.geki-label-pos-right .geki-selector-item { flex-direction: row; } 

/* Wrapper IMAGEN (Selector) */
.geki-selector-img-wrap {
    position: relative;
    display: block;
    flex-shrink: 0;
    line-height: 0;
}

.geki-selector-img {
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    display: block;
    border: 2px solid transparent; 
}

/* Overlay Check */
.geki-selector-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.2s ease; pointer-events: none;
    font-size: 16px;
}
.geki-selector-item.active .geki-selector-overlay { opacity: 1; }

.geki-selector-label {
    display: block;
    text-align: center;
    line-height: 1.2;
}

/* =========================================
   CUSTOM LIGHTBOX (MODAL)
   ========================================= */
.geki-custom-lightbox {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.geki-custom-lightbox.open {
    opacity: 1;
    pointer-events: all;
}
.geki-lightbox-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}
.geki-lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    cursor: pointer;
    z-index: 100000;
}