/*
 * WCPO Swatches - Estilos Finales RH Inspired (Borde Elegante con Espacio)
 */

/* --- TÍTULO --- */
.wcpo-swatches-title strong {
    color: var(--e-global-color-secondary);
    font-family: "Montserrat", Sans-serif;
    font-size: 18px;
    font-weight: 600;
    text-transform: uppercase;
    display: block;
    margin-bottom: 15px;
    letter-spacing: 0.5px;
}

/* --- CONTENEDOR DE SWATCHES --- */
.wcpo-swatches-wrapper {
    margin-bottom: 0px;
    clear: both;
    border-top: 1px solid #eee;
    padding-top: 0px;
}

.wcpo-swatches {
    display: flex;
    column-gap: 10px;
    row-gap: 5px;
    align-items: flex-start;
    flex-wrap: wrap;
}

/* Contenedor para cada opción (cuadrado + texto) */
.wcpo-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    width: 100px;
    position: relative;
    padding-bottom: 5px;
}

/* Estilo de cada swatch individual (cuadrado) */
.wcpo-option .wcpo-swatch {
    width: 100%;
    height: 100px;
    position: relative;
    border: 1px solid #dcdcdc;
    overflow: hidden;
    transition: all 0.15s ease-in-out;  
    background-color: #fff;
    margin-bottom: 15px;
    box-sizing: border-box;  
}

.wcpo-swatch img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wcpo-option .wcpo-swatch-label {
    font-family: "Montserrat", Sans-serif;
    font-size: 11px;
    color: #666;
    text-align: left;
    line-height: 1.3;
    min-height: 20px;
    width: 100%;
    transition: color 0.15s ease-in-out, font-weight 0.15s ease-in-out;
    display: flex;
    align-items: left;
    justify-content: left;
}

/* --- ESTILOS DE INTERACCIÓN --- */
.wcpo-option:hover .wcpo-swatch { border-color: #888; }
.wcpo-option:hover .wcpo-swatch-label { color: #333; }
.wcpo-option.selected .wcpo-swatch { border-color: #000; outline: 2px solid #000; outline-offset: 2px; }
.wcpo-option.selected .wcpo-swatch-label { color: #000; font-weight: 500; }

/* --- BOTÓN "LIMPIAR" --- */
.wcpo-reset-options {
    display: none;
    margin-top: 0px;
    margin-bottom:25px;
    font-size: .83em;
    color: red;
    font-family: 'Montserrat';
    text-decoration: none;
    cursor: pointer;
    clear: both;
    float: left;
    transition: color 0.2s ease;
}
.wcpo-reset-options:hover { color: #000; }

/* --- VISTA PREVIA FLOTANTE (Hover Preview) --- */
.wcpo-hover-preview {
    position: absolute;
    width: 250px;
    background-color: #fff;
    border: 1px solid #fff;
    border-radius:5px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 25px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0s 0.15s linear;
    pointer-events: none;
}
.wcpo-hover-preview img { display: block; width: 100%; height: auto; margin-bottom: 15px; }
.wcpo-hover-preview .wcpo-hover-label { font-family: "Montserrat", Sans-serif; font-size: 11px; font-weight: 400; color: #333; text-align: left; }
.wcpo-hover-preview.show { opacity: 1; visibility: visible; transition: opacity 0.15s ease, visibility 0s 0s linear; }

/* --- SUB-OPCIONES (Estilos Dinámicos y Lujosos) --- */
.wcpo-sub-options-container {
    margin: 10px 0 25px 0;
    clear: both;
    width: 100%;
    position: relative; 
    border-radius: 5px; 
}

.wcpo-swatches-sub-group {
    display: none; 
    padding: 15px 25px 15px 25px; 
    background: #fdfdfd; 
    border: 1px solid #e0e0e0; 
    border-radius: 5px; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); 
    position: relative;
}
.wcpo-swatches-sub-group.active { display: block; }

/* Flecha Dinámica */
.wcpo-swatches-sub-group.active::before {
    content: '';
    position: absolute;
    top: -12px;
    left: var(--wcpo-arrow-left-position, 50px); 
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 12px solid #e0e0e0;
    z-index: 2;
    transition: left 0.3s ease;
}

.wcpo-swatches-sub-group.active::after {
    content: '';
    position: absolute;
    top: -10px;
    left: var(--wcpo-arrow-left-position, 50px); 
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid #fdfdfd;
    z-index: 3;
    transition: left 0.3s ease;
}

.wcpo-sub-options-title strong {
    font-size: 15px; 
    text-transform: capitalize; 
    font-weight: 500; 
    color: #444; 
    letter-spacing: 0.3px;
    margin-bottom: 20px; 
    display: block;
    text-align: center; 
}

.wcpo-swatches-child {
    display: flex;
    justify-content: center;
    column-gap: 10px;
    row-gap: 5px;
    flex-wrap: wrap;
}
.wcpo-swatches-child .wcpo-option { width: 80px; }
.wcpo-swatches-child .wcpo-option .wcpo-swatch { height: 80px; margin-bottom: 10px; }
.wcpo-swatches-child .wcpo-swatch-label { font-size: 10px; text-align: center; }

/* --- AJUSTES RESPONSIVOS BASE --- */
@media (max-width: 767px) {
    .wcpo-swatches-wrapper { text-align: center; align-content: center; margin-bottom: 15px; padding-top: 5px; }
    .wcpo-swatches-wrapper .wcpo-swatches { justify-content: center; gap: 8px; column-gap: 15px; row-gap: 5px; margin-left: 0px; }
    .wcpo-option { width: calc(33.333% - 10px); padding-bottom: 6px; }
    .wcpo-option .wcpo-swatch { margin-bottom: 4px; }
    .wcpo-option .wcpo-swatch-label { font-size: 11px; min-height: 24px; padding-top:15px; }
    .wcpo-hover-preview { display: none !important; }
    .wcpo-swatches-title, .variations .label { text-align: center; }
    form.cart, .woocommerce-variation-add-to-cart { justify-content: center; }
    
    .wcpo-swatches-sub-group.active { padding: 20px 15px 10px 15px; }
    .wcpo-sub-options-title strong { text-align: center; }
    .wcpo-swatches-child .wcpo-option { width: calc(33.33% - 10px); }
    .wcpo-swatches-child .wcpo-option .wcpo-swatch { height: 0; padding-bottom: 100%; margin-bottom: 5px; }
    .wcpo-swatches-sub-group.active::before, .wcpo-swatches-sub-group.active::after { content: none; }
}

@media (min-width: 768px) {
    .elementor-add-to-cart { display: flex; flex-wrap: wrap; justify-content: flex-start; }
    form.cart table.variations, .wcpo-swatches-wrapper { flex-basis: 100%; }
    .woocommerce-variation-add-to-cart, .elementor-widget-woocommerce-product-add-to-cart form.cart:not(.variations_form) { display: flex !important; align-items: stretch !important; gap: 15px; width: 100%; }
    .quantity-wrapper { display: inline-flex; align-items: center; flex-grow: 0; flex-shrink: 0; }
    .quantity-wrapper .quantity-button { background-color: #f1f1f1; color: #333; border: 1px solid #e0e0e0; cursor: pointer; width: 44px !important; height: 44px !important; border-radius: 4px; font-size: 1.5em; padding: 0; line-height: 1; }
    .quantity-wrapper .quantity .input-text.qty { height: 44px !important; min-width: 50px; text-align: center; border-top: 1px solid #e0e0e0 !important; border-bottom: 1px solid #e0e0e0 !important; border-left: none !important; border-right: none !important; background-color: white !important; box-shadow: none !important; margin: 0 !important; padding: 0 5px; -moz-appearance: textfield; }
    .quantity-wrapper .quantity .input-text.qty::-webkit-outer-spin-button, .quantity-wrapper .quantity .input-text.qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
    .single_add_to_cart_button { flex-grow: 1; height: 44px !important; margin: 0 !important; }
    .wcpo-swatches { display: flex; column-gap: 25px; row-gap: 5px; margin-left: 0px; }
}

/* --- ESTILOS LUX EXTRAS (INTEGRACIÓN) --- */
.woocommerce div.product form.cart .variations td.value { display: flex !important; flex-wrap: nowrap !important; align-items: center !important; justify-content: space-between !important; width: 100% !important; position: relative; }
.woocommerce div.product form.cart .variations td.value > :not(.lux-ui-wrapper) { flex-grow: 1 !important; width: auto !important; min-width: 0 !important; margin-right: 20px !important; }
.lux-ui-wrapper { margin-left: auto !important; flex: 0 0 170px !important; width: 170px !important; min-width: 200px !important; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; position: relative; z-index: 10; }

.lux-switch-container { display: flex; align-items: center; justify-content: flex-start; gap: 8px; cursor: pointer; height: 24px; margin-bottom: 0; width: 100%; }
.lux-switch-label { font-size: 10px; text-transform: uppercase; font-weight: 700; color: #444; letter-spacing: 0.5px; }
.lux-switch { position: relative; display: inline-block; width: 32px; height: 18px; margin: 0; }
.lux-switch input { opacity: 0; width: 0; height: 0; }
.lux-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .3s; border-radius: 34px; }
.lux-slider:before { position: absolute; content: ""; height: 12px; width: 12px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; }
input:checked + .lux-slider { background-color: #000; }
input:checked + .lux-slider:before { transform: translateX(14px); }

.lux-reveal-box { max-height: 0; opacity: 0; overflow: hidden; transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1); margin-top: 0; width: 100%; display: flex; justify-content: flex-end; }
.lux-reveal-box.is-visible { max-height: 60px; opacity: 1; margin-top: 8px; }
.lux-controls-row { display: flex; align-items: center; justify-content: flex-end; }
.lux-addon-wrapper { display: inline-flex; align-items: stretch; width: fit-content !important; flex: 0 0 auto !important; background: #000; border: 1px solid #000; gap: 1px; height: 36px; }
.lux-btn { background: #fff !important; color: #000 !important; width: 36px !important; flex: 0 0 36px !important; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 18px; border: none !important; padding: 0 !important; margin: 0 !important; line-height: 1; }
.lux-btn:hover { background: #f5f5f5 !important; }
.lux-input { width: 40px !important; min-width: 40px !important; flex: 0 0 40px !important; height: 100% !important; text-align: center !important; border: none !important; border-left: 1px solid #fff !important; border-right: 1px solid #fff !important; margin: 0 !important; padding: 0 !important; font-weight: 700 !important; background: #fff !important; color: #000 !important; -moz-appearance: textfield; border-radius: 0 !important; }
.lux-input::-webkit-outer-spin-button, .lux-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.lux-dynamic-text { font-size: 9px; text-transform: uppercase; color: #666; margin-left: 8px; line-height: 1.1; display: block; text-align: left; max-width: 90px; white-space: normal; }


/* --- ESTILOS LUX EXTRAS (INTEGRACIÓN) --- */
.woocommerce div.product form.cart .variations td.value { display: flex !important; flex-wrap: nowrap !important; align-items: center !important; justify-content: space-between !important; width: 100% !important; position: relative; }
.woocommerce div.product form.cart .variations td.value > :not(.lux-ui-wrapper) { flex-grow: 1 !important; width: auto !important; min-width: 0 !important; margin-right: 20px !important; }
.lux-ui-wrapper { margin-left: auto !important; flex: 0 0 170px !important; width: 170px !important; min-width: 200px !important; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; position: relative; z-index: 10; }

.lux-switch-container { display: flex; align-items: center; justify-content: flex-start; gap: 8px; cursor: pointer; height: 24px; margin-bottom: 0; width: 100%; }
.lux-switch-label { font-size: 10px; text-transform: uppercase; font-weight: 700; color: #444; letter-spacing: 0.5px; }
.lux-switch { position: relative; display: inline-block; width: 32px; height: 18px; margin: 0; }
.lux-switch input { opacity: 0; width: 0; height: 0; }
.lux-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .3s; border-radius: 34px; }
.lux-slider:before { position: absolute; content: ""; height: 12px; width: 12px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; }
input:checked + .lux-slider { background-color: #000; }
input:checked + .lux-slider:before { transform: translateX(14px); }

.lux-reveal-box { max-height: 0; opacity: 0; overflow: hidden; transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1); margin-top: 0; width: 100%; display: flex; justify-content: flex-end; }
.lux-reveal-box.is-visible { max-height: 60px; opacity: 1; margin-top: 8px; }
.lux-controls-row { display: flex; align-items: center; justify-content: flex-end; }
.lux-addon-wrapper { display: inline-flex; align-items: stretch; width: fit-content !important; flex: 0 0 auto !important; background: #000; border: 1px solid #000; gap: 1px; height: 36px; }
.lux-btn { background: #fff !important; color: #000 !important; width: 36px !important; flex: 0 0 36px !important; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 18px; border: none !important; padding: 0 !important; margin: 0 !important; line-height: 1; }
.lux-btn:hover { background: #f5f5f5 !important; }
.lux-input { width: 40px !important; min-width: 40px !important; flex: 0 0 40px !important; height: 100% !important; text-align: center !important; border: none !important; border-left: 1px solid #fff !important; border-right: 1px solid #fff !important; margin: 0 !important; padding: 0 !important; font-weight: 700 !important; background: #fff !important; color: #000 !important; -moz-appearance: textfield; border-radius: 0 !important; }
.lux-input::-webkit-outer-spin-button, .lux-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.lux-dynamic-text { font-size: 9px; text-transform: uppercase; color: #666; margin-left: 8px; line-height: 1.1; display: block; text-align: left; max-width: 90px; white-space: normal; }


/* --- NUEVO: DESCRIPCIÓN DE VARIACIÓN (Nativa) --- */
.wcpo-variation-info {
    width: 100%;
    clear: both;
    margin-top: 15px;
    margin-bottom: 15px;
    padding: 12px 15px;
    background-color: #f8f8f8;
    border-left: 3px solid #333;
    font-size: 13px;
    line-height: 1.5;
    color: #555;
    display: none; /* Oculto por defecto */
}


/* --- NUEVO: CONTENEDOR PARA LIMPIAR VARIACIONES (Nativo) --- */
.wcpo-native-reset-wrapper {
    width: 100%;
    clear: both;
    margin-top: 5px;
    margin-bottom: 15px;
    padding-left: 0;
    /* Por defecto oculto el contenedor, JS lo mostrará cuando sea necesario */
    display: none; 
}

.wcpo-native-reset-wrapper .reset_variations {
    /* Eliminamos display y visibility forzados para que WC decida */
    font-size: 11px;
    color: red; 
    text-decoration: none;
    cursor: pointer;
}


/* --- NUEVO: ESTILO PARA LA DESCRIPCIÓN INDIVIDUAL POR ATRIBUTO --- */
.lux-variation-desc {
    width: 100%;
    font-size: 11px;
    color: #777;
    font-style: italic;
    margin-bottom: 8px;
    line-height: 1.3;
    padding-left: 2px;
    text-align: right; /* Alineado a la derecha como los controles */
    display: none; /* JS lo muestra */
}

/* --- DESCRIPCIÓN DEBAJO DEL SELECTOR (NUEVO) --- */
.wcpo-desc-row {
    width: 100%;
    display: block;
    clear: both; /* Fuerza el salto de línea */
    margin-top: 5px;
    margin-bottom: 10px;
    font-size: 12px;
    color: #666; /* Gris oscuro suave */
    text-align: left;
    line-height: 1.3;
    padding-left: 2px;
}



@media (max-width: 767px) {
    .woocommerce div.product form.cart .variations td.value { flex-wrap: wrap !important; }
    .woocommerce div.product form.cart .variations td.value > :not(.lux-ui-wrapper) { flex: 1 1 100% !important; margin-right: 0 !important; }
    .lux-ui-wrapper { width: 100% !important; flex: 1 1 100% !important; align-items: center; margin-top: 10px; margin-left: 0 !important; }
    .lux-switch-container { justify-content: center; }
    .lux-reveal-box { justify-content: center; }
    .lux-controls-row { justify-content: center; column-gap: 15px; }
    .lux-dynamic-text { text-align: center; margin-left: 0; margin-top: 5px; max-width: none;}
    .lux-variation-desc {
        text-align: center;
    }
    
    .wcpo-desc-row {
        text-align: center; /* En móvil puede verse mejor centrado */
        margin-top:10px;
    }
    
    .wcpo-native-reset-wrapper {
    align-items: center;
    align-content: center;
    text-align:center;
    margin-top:20px;

}

}