/*
Theme Name: Vintech Child
Theme URI: https://casethemes.net/
Description: Tema hijo para Vintech (Personalizaciones Diprotec)
Author: LOF Marketing
Author URI: https://lofmarketing.com
Template: vintech
Version: 1.0.0
*/

/* ------------------------------------------------------------------------- *
 * CORRECCIONES DE WOOCOMMERCE
 * ------------------------------------------------------------------------- */

/* Ocultar icono de carrito en botones que no son de compra activa (ej. 'Leer Más' sin stock) */
.woocommerce ul.products li.product .woocommerce-product--buttons .woocommerce-add-to-cart a.button:not(.add_to_cart_button):before {
    content: none !important;
    display: none !important;
}

/* ------------------------------------------------------------------------- *
 * CORRECCIÓN DE WIDGET DE CATEGORÍAS (Select2 / WooCommerce)
 * Centra el texto, protege letras con cola (g, j, p) y fija la flecha rebelde
 * ------------------------------------------------------------------------- */

/* 1. Centrado vertical de la caja y el texto */
.widget_product_categories .select2-container--default .select2-selection--single {
    height: 52px !important;
    display: flex !important;
    align-items: center !important;
    border-radius: 34px !important; 
    position: relative !important;
}

.widget_product_categories .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 1 !important;
    padding-top: 0 !important;
    padding-bottom: 4px !important; /* Da espacio a la 'g' y la 'j' */
    padding-left: 20px !important;
    padding-right: 40px !important; /* Evita que el texto pise la flecha */
    color: #000 !important;
    width: 100% !important;
}

/* 2. Contenedor de la Flecha (Lo convertimos en una caja perfectamente centrada a la derecha) */
.widget_product_categories .select2-container--default .select2-selection--single .select2-selection__arrow {
    position: absolute !important;
    height: 100% !important;
    top: 0 !important;
    right: 0 !important;
    width: 45px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* 3. La Flecha inyectada por el Tema (Le quitamos los estilos que la sacan volando) */
.widget_product_categories .select2-container--default .select2-selection--single .select2-selection__arrow:after {
    position: static !important; /* Anula el absolute que la manda hacia arriba */
    transform: none !important; /* Anula el translateY */
    height: auto !important; /* Anula el 100% de altura */
    margin: 0 !important;
    display: block !important;
}

/* 4. Por si acaso: Respaldo para NiceSelect (si alguna vez se desactiva Select2) */
.widget_product_categories .nice-select {
    height: 52px !important;
    display: flex !important;
    align-items: center !important;
}
.widget_product_categories .nice-select .current {
    line-height: 1 !important;
    padding-bottom: 4px !important;
}
.widget_product_categories .nice-select:after {
    top: 50% !important;
    margin-top: -4px !important;
    transform: rotate(45deg) !important;
    right: 20px !important;
}

/* ==========================================================================
   ALINEACIÓN DE PRECIOS DE ENVÍO A LA DERECHA (Paso 4)
   ========================================================================== */
ul#shipping_method li {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    margin-bottom: 12px !important;
}

ul#shipping_method li input[type="radio"] {
    margin-right: 10px !important;
    margin-top: 0 !important;
}

ul#shipping_method li label {
    flex: 1 !important; /* Ocupa todo el espacio restante en la fila */
    display: flex !important;
    justify-content: space-between !important; /* Empuja el precio a la derecha */
    align-items: center !important;
    margin: 0 !important;
    font-weight: 600;
}

/* ==========================================================================
   ALINEACIÓN DE IMPUESTOS Y TOTALES A LA DERECHA (Paso 4)
   ========================================================================== */
table.woocommerce-checkout-review-order-table tfoot tr th {
    text-align: left !important;
}

table.woocommerce-checkout-review-order-table tfoot tr td {
    text-align: right !important;
}

/* Asegurar que el monto específico del impuesto destaque correctamente */
table.woocommerce-checkout-review-order-table tfoot tr.tax-rate td .woocommerce-Price-amount {
    font-weight: 600;
    color: #333;
}
/* Opcional: Darle un poco más de peso visual al precio para que destaque */
ul#shipping_method li label .woocommerce-Price-amount {
    font-weight: 700;
    color: #333;
}

/* Asegurar que la caja de agencias de Starken baje a su propia línea y se alinee bien */
ul#shipping_method li .diprotec-agencies-wrapper {
    width: 100% !important;
    margin-left: 25px !important; /* Alinea la caja con el texto, saltándose el radio button */
}

/* ==========================================================================
   REORDENAR TOTALES DEL CARRITO Y TÉRMINOS (FLEXBOX)
   ========================================================================== */
.woocommerce-cart .cart_totals {
    display: flex !important;
    flex-direction: column !important;
}

.woocommerce-cart .cart_totals h2 {
    order: 1 !important;
}

.woocommerce-cart .cart_totals .shop_table {
    order: 2 !important;
}

.woocommerce-cart .cart_totals .woocommerce-terms-and-conditions {
    order: 3 !important;
    margin-top: 15px !important;
    margin-bottom: 25px !important;
    padding: 15px !important;
    background-color: #f9f9f9 !important; /* Opcional: para que destaque un poco */
    border-radius: 8px !important;
}

.woocommerce-cart .cart_totals .wc-proceed-to-checkout {
    order: 4 !important;
}

/* ==========================================================================
   CARRITO DE COMPRAS - CORRECCIONES RESPONSIVAS (Móviles y Tablets)
   ========================================================================== */
@media screen and (max-width: 991px) {
    /* Forzar que los bloques del carrito se apilen verticalmente */
    body.woocommerce-cart .woocommerce {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
    }

    /* La tabla de productos debe ocupar el 100% del ancho */
    body.woocommerce-cart .woocommerce-cart-form {
        width: 100% !important;
        margin-bottom: 30px !important;
    }

    /* El resumen del carrito (Sidebar) debe ocupar el 100% del ancho */
    body.woocommerce-cart .cart-collaterals {
        width: 100% !important;
    }
    
    /* Centrar y expandir el bloque de totales para aprovechar el espacio en móvil */
    body.woocommerce-cart .cart-collaterals .cart_totals {
        max-width: 100% !important;
        margin: 0 auto !important;
    }
    
    /* Asegurar que las acciones del carrito (Cupón y Actualizar) no se rompan */
    .woocommerce-cart-form .shop_table .actions {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
        align-items: stretch !important;
    }
    
    .woocommerce-cart-form .shop_table .actions .coupon {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        width: 100% !important;
    }
    
    .woocommerce-cart-form .shop_table .actions .coupon .input-text {
        width: 100% !important;
        min-width: 100% !important;
        margin: 0 !important;
    }
    
    .woocommerce-cart-form .shop_table .actions > .button,
    .woocommerce-cart-form .shop_table .actions .coupon .button {
        width: 100% !important;
        margin: 0 !important;
    }
}