/*
 Theme Name:   Astra Child para FPIntegra
 Theme URI:    https://tienda.fpintegra.com/
 Description:  Tema hijo para personalizaciones de la tienda en línea de FPIntegra.
 Author:       Victor Ruelas - FPIntegra
 Template:     astra
 Version:      1.0.1
*/

/* =========================================================
   1. ESTRUCTURA Y CONTENEDOR GLOBAL
   ========================================================= */

/* Ajuste del ancho máximo del sitio y centrado horizontal */
.ast-container {
    max-width: 1320px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 24px;
    padding-right: 24px;
}

/* Forzar que el header y footer ocupen todo el ancho de pantalla */
.site-header .ast-container,
.site-footer .ast-container {
    max-width: 100%;
}

/* Limpieza de decoración de enlaces (quitar subrayado por defecto) */
a:where(:not(.wp-element-button)) { 
    text-decoration: none; 
}

/* Ocultar el título de página nativo en la tienda de WooCommerce */
h1.woocommerce-products-header__title.page-title { 
    display: none; 
}

/* =========================================================
   2. CABECERA (HEADER) Y NAVEGACIÓN FIJA
   ========================================================= */

/* Eliminación de espacios vacíos o barras superiores no deseadas */
.ast-above-header-wrap, 
#ast-above-header, 
[data-section*="above"], 
#block-20 {
    display: none !important;
    height: 0 !important;
}

/* Fijar la barra de navegación superior para que siempre esté visible al hacer scroll */
.ast-primary-header-bar,
#ast-mobile-header .ast-primary-header-bar {
    position: fixed !important;
    top: 0 !important;
    left: 0;
    width: 100%;
    z-index: 99999 !important;
    background: #ffffff !important;
    height: 60px !important;
    border-bottom: 1px solid #eaeaea;
}

/* Configuración del menú desplegable móvil para que abra justo debajo del header fijo */
.ast-mobile-header-content {
    position: fixed !important;
    top: 60px !important; 
    left: 0;
    width: 100%;
    background: #ffffff !important;
    z-index: 99998 !important;
    height: auto !important; 
    overflow-y: auto !important;
    box-shadow: 0 10px 15px rgba(0,0,0,0.1);
    border-top: 2px solid #0c4c91;
}

/* Compensación de margen superior para que el contenido no quede oculto bajo el header fijo */
#content.site-content, 
.site-content {
    margin-top: 60px !important;
}

/* Ajuste de posición del header cuando la barra de administración de WordPress está activa */
.admin-bar .ast-primary-header-bar {
    top: 32px !important;
}

/* =========================================================
   3. ELEMENTOS DE TEXTO Y ENLACES PERSONALIZADOS
   ========================================================= */

/* Estilo para enlaces de privacidad (blanco con subrayado) */
.fp-privacy-link {
    color: #ffffff;
    text-decoration: underline;
    font-weight: 500;
}

.fp-privacy-link:hover { 
    color: #d1e9ff; 
    text-decoration: none; 
}

/* =========================================================
   4. COMPONENTES DE WOOCOMMERCE (CARRITO Y SIDEBAR)
   ========================================================= */

/* Estilo del texto en los productos del mini-carrito */
.widget_shopping_cart_content .woocommerce-mini-cart-item a,
.ast-site-header-cart .woocommerce-mini-cart-item a {
    color: #222 !important;
    font-weight: 600 !important;
}

/* Botón de eliminar producto en el carrito (rojo con borde) */
.woocommerce-mini-cart-item a.remove {
    color: #ff0000 !important;
    border: 1px solid #ff0000 !important;
}

/* Ajuste de espaciado en el filtro de precios de la barra lateral */
.wp-block-woocommerce-price-filter {
    padding-left: 10px !important;
    padding-right: 10px !important;
    box-sizing: border-box !important;
}

/* Control para evitar que textos largos rompan el diseño del sidebar */
#block-18, 
.ast-woo-sidebar-widget { 
    overflow: hidden !important; 
    word-wrap: break-word; 
}

/* =========================================================
   5. FILTRO DE CATEGORÍAS (ACORDEÓN DESPLEGABLE)
   ========================================================= */

/* Quitar viñetas y márgenes de la lista de categorías */
.wc-block-product-categories-list { 
    list-style: none !important; 
    margin: 0 !important; 
    padding: 0 !important; 
}

/* Línea divisoria entre categorías */
.wc-block-product-categories-list-item { 
    padding: 6px 0; 
    border-bottom: 1px solid #f2f2f2; 
    position: relative;
}

/* Ocultar subcategorías (niveles 2 y 3) por defecto */
.wc-block-product-categories-list--depth-1,
.wc-block-product-categories-list--depth-2 { 
    display: none; 
    padding-left: 15px !important; 
    border-left: 2px solid #0c4c91;
    margin-top: 5px;
    margin-bottom: 5px;
}

/* Mostrar subcategorías automáticamente al pasar el cursor sobre la categoría padre */
.wc-block-product-categories-list-item:hover > .wc-block-product-categories-list--depth-1,
.wc-block-product-categories-list-item:hover > .wc-block-product-categories-list--depth-2 {
    display: block !important;
}

/* Colores y estados hover para los enlaces de categorías */
.wc-block-product-categories-list-item a {
    color: #333 !important;
    font-size: 14px;
    font-weight: 500;
}

.wc-block-product-categories-list-item a:hover {
    color: #ff5f1e !important;
}

/* =========================================================
   6. PROCESO DE PAGO (CHECKOUT)
   ========================================================= */

/* Proporciones de la tabla de resumen del pedido (65% nombre / 35% precio) */
.woocommerce-checkout-review-order-table .product-name {
    width: 65% !important;
    padding: 12px 0 !important;
    vertical-align: middle !important;
}

.woocommerce-checkout-review-order-table .product-total {
    width: 35% !important;
    text-align: right !important;
    font-weight: 600;
}

/* Estilo visual para los métodos de envío como tarjetas individuales */
#shipping_method li {
    background: #ffffff;
    border: 1px solid #dddddd;
    border-radius: 6px;
    padding: 12px 15px !important;
    margin-bottom: 8px !important;
    display: flex !important;
    align-items: center;
    box-sizing: border-box !important;
}

/* =========================================================
   7. PÁGINAS LEGALES Y DISEÑO CORPORATIVO
   ========================================================= */

/* Título principal con estilo FPIntegra (Azul con borde naranja) */
.fpi-main-h1 {
    font-size: 2.4rem;
    color: #0c4c91;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 35px;
    padding-left: 15px;
    border-left: 6px solid #ff5f1e;
    line-height: 1.1;
}

/* Contenedor de texto legal con fondo gris muy suave y bordes redondeados */
.fpi-legal-container {
    line-height: 1.6;
    color: #333;
    padding: 20px;
    background: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 8px;
}

/* Evitar que el sistema transforme el texto legal a mayúsculas automáticamente */
.fpi-legal-container p, 
.fpi-legal-container li,
.fpi-legal-container h2 {
    text-transform: none !important;
}

/* Subtítulos de secciones legales en azul con línea naranja inferior */
.fpi-legal-container h2 {
    color: #0c4c91;
    border-bottom: 2px solid #ff5f1e;
    padding-bottom: 10px;
    margin-top: 30px;
    font-size: 1.4rem;
}

/* =========================================================
   8. VISTA MÓVIL: TARJETAS DE CONVERSIÓN (INICIO)
   ========================================================= */

@media (max-width: 767px) {
    /* Contenedor de la lista de acciones rápidas (WhatsApp, B2B, Maps) */
    .fpintegra-lista-movil {
        padding: 10px;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    /* Estructura de tarjeta compacta horizontal */
    .tarjeta-compacta-fpi {
        background: #ffffff;
        border-radius: 6px;
        padding: 10px 15px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        box-shadow: 0 2px 8px rgba(12, 76, 145, 0.08);
        border-left: 4px solid #ccc;
    }

    /* Ajustes para iconos, títulos y párrafos dentro de la tarjeta */
    .tarjeta-compacta-fpi img.icono-compacto,
    .tarjeta-compacta-fpi svg.icono-compacto {
        width: 28px;
        margin-right: 12px;
        flex-shrink: 0;
    }

    .tarjeta-compacta-fpi h3 {
        font-size: 0.95rem !important;
        margin: 0 !important;
        font-weight: 700;
    }

    .tarjeta-compacta-fpi p {
        font-size: 0.8rem !important;
        color: #777;
        margin: 1px 0 0 0 !important;
        line-height: 1.1;
    }

    /* Botones de acción en la tarjeta móvil */
    .tarjeta-compacta-fpi a.boton-compacto {
        color: #ffffff;
        padding: 6px 12px;
        border-radius: 4px;
        font-size: 0.75rem;
        font-weight: bold;
        white-space: nowrap;
    }

    /* Asignación de colores específicos por servicio */
    .fpi-whatsapp { border-left-color: #25d366 !important; }
    .fpi-whatsapp h3, .fpi-whatsapp .icono-compacto { color: #25d366 !important; fill: #25d366 !important; }
    .fpi-whatsapp .boton-compacto { background-color: #25d366 !important; }

    .fpi-b2b { border-left-color: #0c4c91 !important; }
    .fpi-b2b h3, .fpi-b2b .icono-compacto { color: #0c4c91 !important; fill: #0c4c91 !important; }
    .fpi-b2b .boton-compacto { background-color: #0c4c91 !important; }

    .fpi-maps { border-left-color: #00a7d4 !important; }
    .fpi-maps h3, .fpi-maps .icono-compacto { color: #00a7d4 !important; fill: #00a7d4 !important; }
    .fpi-maps .boton-compacto { background-color: #00a7d4 !important; }
}

/* =========================================================
   9. VISTA MÓVIL: CATÁLOGO DE PRODUCTOS (WOOCOMMERCE)
   ========================================================= */

@media (max-width: 767px) {
    /* Forzar el listado de productos a una sola columna vertical */
    .woocommerce ul.products[class*="columns-"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        padding: 10px !important;
    }

    /* Diseño de producto en formato "Fila" (Imagen izquierda / Texto derecha) */
    .woocommerce ul.products li.product {
        width: 100% !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important; 
        background: #ffffff;
        border: 1px solid #f0f0f0;
        border-radius: 6px;
        padding: 8px !important;
        margin: 0 0 10px 0 !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
        overflow: hidden;
    }

    /* Bloque de imagen fijo al 50% para asegurar alineación vertical del texto */
    .woocommerce ul.products li.product a:first-child,
    .woocommerce ul.products li.product .woocommerce-loop-product__link {
        flex: 0 0 50% !important; 
        min-width: 50% !important;
        margin-right: 15px !important;
        display: block !important;
    }

    /* Ajuste de la imagen del producto para que mantenga proporción */
    .woocommerce ul.products li.product a img {
        width: 100% !important;
        height: 110px !important;
        object-fit: contain !important;
        background: #fff;
    }

    /* Contenedor de información del producto (Título, Precio, Botón) */
    .astra-shop-summary-wrap {
        width: 100%;
        flex: 1 !important;
    }

    /* Limitar el título a máximo 2 líneas para uniformidad visual */
    .woocommerce-loop-product__title {
        font-size: 0.85rem !important;
        color: #0c4c91 !important;
        line-height: 1.2 !important;
        margin-bottom: 5px !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* Estilo del precio resaltado en naranja corporativo */
    .woocommerce ul.products li.product .price {
        font-size: 1rem !important;
        font-weight: bold !important;
        color: #ff5f1e !important;
        margin-bottom: 8px !important;
    }

    /* Botón de compra técnico y compacto */
    .woocommerce ul.products li.product .button {
        padding: 6px 12px !important;
        font-size: 0.75rem !important;
        background-color: #0c4c91 !important;
        color: #fff !important;
        border-radius: 3px;
        display: inline-block !important;
    }
}


/* =========================================================
   11. CARRUSEL DE CATEGORÍAS (VISTA MÓVIL)
   Esta sección define el menú de burbujas con desplazamiento 
   horizontal ubicado en la parte superior del catálogo.
   ========================================================= */
   
@media (min-width: 922px) {
    .fpi-categoria-carrusel,
    .fpi-buscador-movil{
        display:none !important;
    }
}

@media (max-width: 921px) {
    /* Ocultamos el contenedor secundario (Sidebar) */
    #secondary.secondary, 
    .ast-left-sidebar #secondary, 
    .ast-right-sidebar #secondary {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* Aseguramos que el contenedor principal no tenga márgenes residuales */
    #primary.primary {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }

    /* Opcional: Si Astra deja un espacio en blanco donde iba el sidebar */
    .ast-separate-container #secondary {
        display: none !important;
    }
    
    /* Configuración del contenedor con scroll horizontal oculto */
    .fpi-categoria-carrusel {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        gap: 15px !important;
        padding: 15px !important;
        width: 100% !important;
        -webkit-overflow-scrolling: touch;
        /* Ocultar barra de desplazamiento en Firefox y Edge */
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
    }

    /* Eliminar barra de desplazamiento visual en Chrome y Safari */
    .fpi-categoria-carrusel::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }

    /* Estructura de cada burbuja individual */
    .fpi-item-carrusel {
        flex: 0 0 100px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-decoration: none !important;
    }

    /* Diseño del círculo para el icono o miniatura */
    .fpi-circulo {
        width: 65px !important;
        height: 65px !important;
        border-radius: 50% !important;
        background: #f4f4f4 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin-bottom: 8px !important;
        overflow: hidden !important;
    }

    /* Ajuste de la imagen dentro del círculo */
    .fpi-circulo img {
        width: 70% !important;
        height: auto !important;
        object-fit: contain !important;
    }

    /* Estilo del nombre de la categoría */
    .fpi-item-carrusel span {
        font-size: 11px !important;
        line-height: 1.2 !important;
        color: #333 !important;
        font-weight: 600 !important;
        text-align: center !important;
        display: block !important;
        word-wrap: break-word !important;
    }
    
    /* Cambia color del icono (Azul FPIntegra) */
    .fpi-circulo img, 
    .fpi-circulo svg {
        /* Filtro para convertir negro a #0c4c91 aproximadamente */
        filter: invert(19%) sepia(94%) saturate(1834%) hue-rotate(198deg) brightness(92%) contrast(101%) !important;
        
        /* Ajuste de tamaño para los iconos de 24px */
        width: 60% !important; 
        height: auto !important;
        transition: transform 0.3s ease;
    }

    /* Efecto al tocar la categoría (Feedback visual) */
    .fpi-item-carrusel:active .fpi-circulo img {
        transform: scale(1.1);
        filter: invert(41%) sepia(91%) saturate(1352%) hue-rotate(345deg) brightness(101%) contrast(101%) !important; /* Cambia a Naranja FPIntegra al tocar */
    }
}

/*-*-*-*-*-*-*-*-*-*-*-*-*/

/* 1. Tarjetas compactas con altura natural ajustada y efecto de sombra */
.ast-woocommerce-container ul.products li.product {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important; /* Permite que la tarjeta sea tan chica como su contenido */
    background-color: #fff !important;
    padding: 0.5rem;
    border-radius: 6px !important; /* Subimos a 6px para que suavice mejor las esquinas con la sombra */
    
    /* Efecto de sombra sutil */
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.05) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important; /* Hace la transición suave */
}

/* Efecto de elevación al pasar el mouse (Hover) */
.ast-woocommerce-container ul.products li.product:hover {
    transform: translateY(-4px) !important; /* Eleva la tarjeta 4 píxeles */
    box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.1) !important; /* Sombra más profunda al interactuar */
}
