/*
 Theme Name:   GeneratePress Child
 Version:      3.0 (Mobile Grid Force)
*/

/* =========================================================================
   1. CORRECCIÓN "FANTASMA" (Elimina primera posición vacía)
   ========================================================================= */
.woocommerce ul.products::before,
.woocommerce ul.products::after,
.woocommerce-page ul.products::before,
.woocommerce-page ul.products::after {
    display: none !important;
    content: none !important;
    flex-basis: 0 !important;
    width: 0 !important;
}

/* =========================================================================
   2. ESTILOS BASE DE TARJETA Y BOTONES (PC Y MÓVIL)
   ========================================================================= */

/* Diseño de tarjeta redondeada */
.woocommerce ul.products li.product {
    background-color: #ffffff;
    border-radius: 12px !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border: 1px solid #f2f2f2;
    overflow: hidden;
    display: flex !important;
    flex-direction: column;
    padding-bottom: 15px !important;
    box-sizing: border-box !important;
}

/* Imagen */
.woocommerce ul.products li.product a img {
    width: 100%;
    margin: 0 0 10px 0 !important;
    border-radius: 12px 12px 0 0 !important;
    object-fit: cover;
}

/* Títulos y Precios */
.woocommerce ul.products li.product .woocommerce-loop-product__title {
    font-size: 0.9rem !important;
    font-weight: 700;
    text-align: center;
    padding: 0 5px;
    margin-bottom: 5px !important;
    line-height: 1.3em;
}

.woocommerce ul.products li.product .price,
.woocommerce ul.products li.product .star-rating {
    text-align: center;
    margin-bottom: 10px !important;
}

/* BOTONES (Estilo píldora, no ancho completo) */
.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product .added_to_cart {
    width: 85% !important; /* Deja aire a los lados */
    margin: 5px auto !important; /* Centrado */
    display: block !important;
    text-align: center !important;
    border-radius: 50px !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
}

/* Color Botón Carrito */
.woocommerce ul.products li.product .add_to_cart_button {
    background-color: #c5a35e !important;
    color: #fff !important;
    border: none !important;
}

/* Color Botón Comprar Ahora */
.woocommerce ul.products li.product .buy-now-button {
    background-color: #333 !important;
    color: #fff !important;
    margin-top: 5px !important;
}

/* =========================================================================
   3. CONFIGURACIÓN PC (3 COLUMNAS)
   ========================================================================= */
@media (min-width: 769px) {
    .woocommerce ul.products {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 25px !important;
    }
    .woocommerce ul.products li.product {
        width: auto !important;
        margin: 0 !important;
    }
    /* Efecto hover solo en PC */
    .woocommerce ul.products li.product:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 25px rgba(0,0,0,0.15);
        transition: all 0.3s ease;
    }
}

/* =========================================================================
   4. RESTO DE AJUSTES (Checkout, Cart, etc)
   ========================================================================= */
.woocommerce-checkout .col2-set .col-1, .woocommerce-checkout .col2-set .col-2 { float: none; width: 100% !important; margin-bottom: 20px; }
body.woocommerce-checkout #billing_last_name_field, body.woocommerce-checkout #billing_country_field, body.woocommerce-checkout #billing_address_1_field, body.woocommerce-checkout #billing_city_field, body.woocommerce-checkout #billing_state_field, body.woocommerce-checkout #billing_postcode_field { display: none !important; }
.main-navigation.is-menu-open.nav-open { background: #fff !important; width: 100% !important; left: 0; }
.main-navigation.is-menu-open .main-nav > ul > li > a { padding: 15px 20px !important; border-bottom: 1px solid #eee; color: #222 !important; }
.whatsapp-floating-button { position: fixed; bottom: 25px; right: 25px; z-index: 9999; background-color: #25D366; color: #FFF; width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(0,0,0,0.3); }
.whatsapp-floating-button svg { width: 30px; height: 30px; fill: #FFF; }

/* =========================================================================
   5. ANIQUILACIÓN PARA MÓVILES (ESTA SECCIÓN AL FINAL ES CRUCIAL)
   ========================================================================= */
@media (max-width: 768px) {
    
    /* Forzar el contenedor a GRID de 2 columnas */
    ul.products,
    .woocommerce ul.products,
    .woocommerce-page ul.products {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important; /* minmax(0, 1fr) evita desbordes */
        gap: 15px 10px !important; /* Espacio vertical / horizontal */
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    /* Forzar al producto a NO tener ancho fijo */
    ul.products li.product,
    .woocommerce ul.products li.product,
    .woocommerce-page ul.products li.product {
        width: auto !important; /* Esto anula el width: 100% del tema */
        min-width: 0 !important;
        max-width: 100% !important;
        float: none !important;
        margin: 0 !important;
        clear: none !important;
    }
    
    /* Ajustar tamaño de botones en pantallas muy pequeñas */
    .woocommerce ul.products li.product .button {
        font-size: 11px !important;
        padding: 6px 4px !important;
        width: 90% !important;
    }
    
    /* Asegurar que los títulos no rompan la rejilla */
    .woocommerce ul.products li.product .woocommerce-loop-product__title {
        font-size: 13px !important;
        word-wrap: break-word !important;
    }
}

/* =========================================================================
   6. DISEÑO PÁGINA INDIVIDUAL DE PRODUCTO (MODERNIZACIÓN TOTAL)
   ========================================================================= */

/* 1. IMAGEN PRINCIPAL DEL PRODUCTO */
.woocommerce-product-gallery img {
    border-radius: 15px !important; /* Bordes redondeados */
    box-shadow: 0 4px 20px rgba(0,0,0,0.08); /* Sombra suave */
}

.woocommerce-product-gallery {
    margin-bottom: 30px !important;
}

/* 2. TÍTULO Y PRECIO */
.product_title.entry-title {
    font-size: 1.8rem !important;
    font-weight: 700 !important;
    color: #222 !important;
    margin-bottom: 10px !important;
    letter-spacing: -0.5px;
}

/* Precio grande y dorado */
.summary.entry-summary .price {
    font-size: 1.6rem !important;
    color: #c5a35e !important; /* Dorado */
    font-weight: 600 !important;
    opacity: 1 !important;
    margin-bottom: 20px !important;
}

/* 3. LIMPIEZA DE "CARACTERÍSTICAS" (SKU, CATEGORÍAS, ETIQUETAS) */
/* Esto elimina la basura visual debajo del botón de compra */
.product_meta {
    display: none !important;
}

/* 4. CAJA DE COMPRA (CANTIDAD + BOTÓN) */
form.cart {
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
    margin-top: 25px !important;
    background: #fdfdfd;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 15px; /* Caja contenedora redondeada */
}

/* Input de cantidad (Redondeado y limpio) */
.woocommerce .quantity .qty {
    border-radius: 50px !important;
    border: 1px solid #ddd !important;
    padding: 10px !important;
    font-weight: bold !important;
    width: 60px !important;
    text-align: center !important;
    height: 45px !important;
}

/* Botón "Añadir al carrito" (Estilo Píldora Dorado Grande) */
.single_add_to_cart_button.button {
    background-color: #c5a35e !important;
    color: #fff !important;
    border-radius: 50px !important;
    padding: 12px 40px !important; /* Más grande que en el catálogo */
    font-size: 1rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    border: none !important;
    height: 45px !important;
    line-height: 1 !important; /* Centrado vertical del texto */
    flex-grow: 1; /* Ocupa el espacio restante */
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease !important;
}

.single_add_to_cart_button.button:hover {
    background-color: #b08d4a !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(197, 163, 94, 0.4);
}

/* 5. PESTAÑAS (DESCRIPCIÓN / VALORACIONES) */
.woocommerce-tabs ul.tabs {
    border-bottom: 1px solid #eee !important;
    padding: 0 !important;
    margin-bottom: 20px !important;
    background: transparent !important;
}

.woocommerce-tabs ul.tabs li {
    background: transparent !important;
    border: none !important;
    margin-right: 20px !important;
}

.woocommerce-tabs ul.tabs li a {
    color: #999 !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    padding: 10px 0 !important;
    border-bottom: 2px solid transparent !important;
}

/* Pestaña activa */
.woocommerce-tabs ul.tabs li.active a {
    color: #000 !important;
    border-bottom: 2px solid #c5a35e !important; /* Subrayado dorado */
}

/* Contenido de las pestañas */
.woocommerce-Tabs-panel {
    background: #fff !important;
    border: none !important;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #444;
}

/* Título repetido "Descripción" dentro de la pestaña (Ocultar) */
.woocommerce-Tabs-panel h2 {
    display: none !important;
}

/* =========================================================================
   7. AJUSTES MÓVILES PARA PÁGINA DE PRODUCTO
   ========================================================================= */
@media (max-width: 768px) {
    /* Título un poco más pequeño */
    .product_title.entry-title {
        font-size: 1.5rem !important;
        text-align: center;
    }
    
    /* Centrar precio y descripción corta */
    .summary.entry-summary .price,
    .summary.entry-summary .woocommerce-product-details__short-description {
        text-align: center !important;
    }
    
    /* Botón de añadir al carrito fijo abajo (Opcional: Estilo App moderna) */
    /* Si prefieres que se quede en su sitio, omite esta parte. 
       Aquí solo aseguramos que se vea bien en columna */
    
    form.cart {
        flex-direction: column !important; /* Uno debajo del otro en pantallas muy pequeñas */
        width: 100% !important;
        box-sizing: border-box;
    }
    
    .single_add_to_cart_button.button {
        width: 100% !important; /* Botón ancho completo en móvil */
    }
    
    .woocommerce .quantity .qty {
        width: 100% !important; /* Input ancho en móvil para pulsar fácil */
        margin-bottom: 10px;
    }
}
/* =========================================================================
   8. ELIMINAR MIGAS DE PAN (Breadcrumbs)
   ========================================================================= */
.woocommerce-breadcrumb {
    display: none !important;
}

/* =========================================================================
   9. CHECKOUT FINAL (SHOPIFY STYLE + MÁRGENES SEGUROS)
   ========================================================================= */

/* --- 1. ESTRUCTURA Y MÁRGENES LATERALES (AIRE) --- */
@media (max-width: 768px) {
    /* Esto añade el espacio blanco a los lados sin romper el ancho */
    .woocommerce-checkout .entry-content,
    .woocommerce-checkout .inside-article {
        padding-left: 20px !important;
        padding-right: 20px !important;
        box-sizing: border-box !important;
    }

    form.checkout.woocommerce-checkout {
        padding: 0 !important; /* El padding ya lo da el contenedor padre */
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    /* Forzar que las columnas ocupen el espacio disponible sin salirse */
    .woocommerce-checkout .col2-set,
    .woocommerce-checkout .col-1,
    .woocommerce-checkout .col-2,
    .woocommerce-checkout #order_review {
        float: none !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        flex-basis: 100% !important;
    }
}

/* --- 2. INPUTS ESTILO SHOPIFY (GRIS SUAVE) --- */
.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce form .form-row select,
.select2-container .select2-selection--single {
    width: 100% !important;
    box-sizing: border-box !important;
    background-color: #fff !important;
    
    /* CAMBIO: Borde gris suave en lugar de negro */
    border: 1px solid #e1e1e1 !important; 
    
    border-radius: 5px !important;
    padding: 12px !important;
    font-size: 16px !important; /* Texto legible */
    color: #333 !important;
    height: 48px !important;
    margin: 0 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02) !important; /* Sombra ultra sutil */
}

/* Al tocar el input se pone negro (Focus) */
.woocommerce form .form-row input.input-text:focus,
.woocommerce form .form-row select:focus {
    border-color: #333 !important;
    box-shadow: 0 0 0 1px #333 !important;
    outline: none !important;
}

/* Etiquetas (Labels) */
.woocommerce form .form-row label {
    font-size: 13px !important;
    color: #444 !important;
    font-weight: 500 !important;
    margin-bottom: 6px !important;
}

/* --- 3. ALINEACIÓN NOMBRE/APELLIDO (FLEXBOX) --- */
.woocommerce-billing-fields__field-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 12px; /* Espacio entre columnas */
}

.woocommerce form .form-row {
    flex: 0 0 100%; /* Por defecto ancho completo */
    width: 100% !important;
    margin: 0 0 4px 0 !important; /* Poco margen abajo */
    padding: 0 !important;
}

/* En móvil: Nombre y Apellido al 50% */
@media (max-width: 768px) {
    #billing_first_name_field,
    #billing_last_name_field {
        flex: 0 0 calc(50% - 6px) !important; /* 50% menos la mitad del hueco */
        width: calc(50% - 6px) !important;
        margin: 0 !important;
    }
}

/* --- 4. TÍTULOS Y BOTÓN --- */
.woocommerce-checkout h3 {
    font-size: 1.1rem !important;
    margin-top: 25px !important;
    margin-bottom: 15px !important;
    color: #222;
    font-weight: 600;
}

/* Botón de pago */
#place_order {
    background-color: #c5a35e !important;
    color: #fff !important;
    border-radius: 5px !important;
    width: 100% !important;
    padding: 18px !important;
    font-weight: bold;
    border: none;
    margin-top: 20px;
    font-size: 1rem !important;
}

/* Corrección para Selectores de País/Estado */
.select2-container .select2-selection--single {
    height: 48px !important;
    display: flex !important;
    align-items: center !important;
    border-color: #e1e1e1 !important;
}

/* =========================================================================
   10. BOTÓN "PLACE ORDER" (VERSIÓN WOOCOMMERCE BLOCKS)
   ========================================================================= */

/* Selector específico para el botón de bloques */
.wc-block-components-button.wc-block-components-checkout-place-order-button {
    /* COLOR Y TEXTO */
    background-color: #c5a35e !important; /* Tu Dorado */
    color: #ffffff !important;
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    text-decoration: none !important;

    /* FORMA Y TAMAÑO */
    border-radius: 50px !important; /* Píldora total */
    padding: 18px 30px !important;
    width: 100% !important;
    border: none !important;
    
    /* EFECTOS VISUALES */
    box-shadow: 0 4px 15px rgba(197, 163, 94, 0.4) !important; /* Brillo dorado */
    transition: all 0.3s ease !important;
    cursor: pointer !important;
    display: block !important;
    opacity: 1 !important; /* Asegura que no se vea transparente */
}

/* Efecto Hover (Al pasar el mouse) */
.wc-block-components-button.wc-block-components-checkout-place-order-button:hover,
.wc-block-components-button.wc-block-components-checkout-place-order-button:focus {
    background-color: #b08d4a !important; /* Dorado un poco más oscuro */
    transform: translateY(-2px) !important; /* Se eleva */
    box-shadow: 0 6px 20px rgba(197, 163, 94, 0.6) !important;
    color: #ffffff !important;
}

/* Corrección para el texto interior del botón (a veces Woo Blocks añade estilos extraños ahí) */
.wc-block-components-checkout-place-order-button__text {
    color: #ffffff !important;
    font-weight: 700 !important;
}
/* =========================================================================
   11. OCULTAR SUSCRIPCIÓN NEWSLETTER EN CHECKOUT
   ========================================================================= */

/* Ocultar el contenedor típico de Mailchimp o newsletters en bloques */
#mailchimp_woocommerce_newsletter,
.wc-block-components-checkbox-control.mailchimp-newsletter,
.woocommerce-form-row.mailchimp-newsletter,
.mc4wp-checkbox-woocommerce,
.newsletter-permission {
    display: none !important;
}

/* Si es un bloque genérico de "Subscribe" justo debajo del email */
.wc-block-checkout__contact-fields .wc-block-components-checkbox-control {
    display: none !important;
}