/* ============================================
   WooCommerce CSS - Refrigeración Moreno
   Child theme Airvice
   ============================================ */

/* Reset general WooCommerce */
.woocommerce-page .woocommerce,
.woocommerce {
    max-width: 100%;
}

/* ============================================
   ARCHIVE / CATÁLOGO
   ============================================ */

/* Grilla de productos */
ul.products {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -12px;
    padding: 0;
    list-style: none;
}

ul.products li.product {
    padding: 0 12px;
    margin-bottom: 30px;
    width: 33.333%;
    float: none;
    clear: none;
}

@media (max-width: 767px) {
    ul.products li.product {
        width: 50%;
    }
}

@media (max-width: 480px) {
    ul.products li.product {
        width: 100%;
    }
}

/* Card de producto */
ul.products li.product .product-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    height: 100%;
}

ul.products li.product:hover .product-card {
    box-shadow: 0 6px 25px rgba(0,0,0,0.12);
    transform: translateY(-3px);
}

/* Imagen del producto */
ul.products li.product a img,
ul.products li.product img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

/* Título del producto */
ul.products li.product .woocommerce-loop-product__title,
ul.products li.product h2 {
    font-size: 15px;
    font-weight: 600;
    color: #1a2d5a;
    padding: 12px 15px 5px;
    margin: 0;
    line-height: 1.4;
}

/* Ocultar precio en el listado */
ul.products li.product .price {
    display: none;
}

/* Botón "Ver producto" en lugar de "Agregar al carrito" */
ul.products li.product .button,
ul.products li.product .add_to_cart_button {
    display: block;
    background: #f36f21;
    color: #fff;
    text-align: center;
    padding: 10px 15px;
    margin: 10px 15px 15px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    width: calc(100% - 30px);
}

ul.products li.product .button:hover,
ul.products li.product .add_to_cart_button:hover {
    background: #d4591a;
    color: #fff;
}

/* Categoría dentro de la card */
ul.products li.product .product-cat {
    font-size: 11px;
    color: #f36f21;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 15px;
    display: block;
}

/* Ordenamiento y resultados */
.woocommerce-ordering select {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 8px 12px;
    font-size: 14px;
    color: #555;
    background: #fff;
}

/* ============================================
   BUSCADOR DE PRODUCTOS (archive-product.php)
   El widget WC_Widget_Product_Search no tenía estilos reales
   aplicados — el CSS viejo apuntaba a .shop-sidebar, que este
   template no usa. Selectores acá scopeados al markup real.
   ============================================ */

.woocommerce-product-search {
    display: flex;
    gap: 0;
}

.woocommerce-product-search .search-field {
    flex: 1;
    min-width: 200px;
    height: 44px;
    box-sizing: border-box;
    border: 1px solid #dde4ee;
    border-right: none;
    border-radius: 8px 0 0 8px;
    padding: 0 14px;
    font-family: 'Raleway', sans-serif;
    font-size: 14px;
    color: #003366;
    outline: none;
    -webkit-appearance: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.woocommerce-product-search .search-field::placeholder {
    color: #9aa6b5;
}

.woocommerce-product-search .search-field:focus {
    border-color: #144898;
    box-shadow: 0 0 0 3px rgba(20,72,152,.12);
}

.woocommerce-product-search button[type="submit"] {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: none;
    height: 44px;
    background: #144898;
    color: #fff;
    border: none;
    padding: 0 20px;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    font-family: 'Raleway', sans-serif;
    font-size: 14px;
    font-weight: 600;
    transition: background .15s ease;
}

.woocommerce-product-search button[type="submit"]:hover {
    background: #0f3a7a;
}

.woocommerce-product-search button[type="submit"] svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

@media (max-width: 767px) {
    .woocommerce-product-search {
        width: 100%;
    }

    .woocommerce-product-search .search-field {
        width: 100%;
    }
}

/* Sidebar filtros */
.shop-sidebar .widget {
    margin-bottom: 0;
}

.shop-sidebar .widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.shop-sidebar .widget ul li {
    margin-bottom: 8px;
    font-size: 14px;
}

.shop-sidebar .widget ul li a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s;
}

.shop-sidebar .widget ul li a:hover {
    color: #f36f21;
}

/* Búsqueda en sidebar */
.shop-sidebar .woocommerce-product-search {
    display: flex;
    gap: 0;
}

.shop-sidebar .woocommerce-product-search input[type="search"] {
    flex: 1;
    border: 1px solid #ddd;
    border-right: none;
    border-radius: 5px 0 0 5px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
}

.shop-sidebar .woocommerce-product-search button[type="submit"] {
    background: #f36f21;
    color: #fff;
    border: none;
    padding: 10px 15px;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    font-size: 14px;
}

/* Paginación */
.woocommerce-pagination ul {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 5px;
}

.woocommerce-pagination ul li a,
.woocommerce-pagination ul li span {
    display: inline-block;
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 5px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.woocommerce-pagination ul li a:hover,
.woocommerce-pagination ul li span.current {
    background: #f36f21;
    color: #fff;
    border-color: #f36f21;
}

/* Breadcrumb */
.woocommerce-breadcrumb {
    color: #aaa;
    font-size: 13px;
    margin: 0;
    padding: 5px 0 0;
}

.woocommerce-breadcrumb a {
    color: #f36f21;
    text-decoration: none;
}

.woocommerce-breadcrumb a:hover {
    text-decoration: underline;
}

/* ============================================
   SINGLE PRODUCT
   ============================================ */

/* Ocultar elementos de tienda que no aplican */
.single-product .woocommerce-tabs,
.single-product form.cart,
.single-product .woocommerce-variation-add-to-cart,
.single-product .single_add_to_cart_button,
.single-product .wc-tabs,
.single-product .quantity {
    display: none !important;
}

/* Notificaciones WooCommerce */
.woocommerce-message,
.woocommerce-error,
.woocommerce-info {
    border-left: 4px solid #f36f21;
    background: #fff8f5;
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 0 5px 5px 0;
    font-size: 14px;
}

/* ============================================
   SIDEBAR JERÁRQUICO — CATÁLOGO (archive-product.php)
   Jerarquía visual: "Todos", "Repuestos" y "Equipos y Aires"
   son ítems de primer nivel con color fuerte (azul principal).
   Las categorías hijas usan color suave. El activo (donde estás
   parado) se marca en naranja, sea padre o hijo.
   ============================================ */

.rm-catalog-layout {
    display: flex;
    align-items: flex-start;
    gap: 32px;
}

.rm-sidebar {
    width: 230px;
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: sticky;
    top: 20px;
}

.rm-sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    font-family: 'Raleway', sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
    background: #144898;
    color: #fff;
}

.rm-sidebar-link:hover {
    background: #0f3a7a;
}

.rm-sidebar-link.is-active {
    background: #E24927;
}

.rm-sidebar-link.is-active:hover {
    background: #C13725;
}

.rm-sidebar-count {
    font-family: 'Raleway', sans-serif;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 20px;
    background: rgba(255,255,255,.25);
    color: #fff;
    flex: none;
}

/* Toggle accesible: oculto visualmente, no display:none (mantiene foco por teclado) */
.rm-sidebar-toggle-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.rm-sidebar-toggle-input:focus + .rm-sidebar-group-label {
    outline: 2px solid #003366;
    outline-offset: 2px;
}

/* "Repuestos": texto navega a la categoría padre, el signo +/- solo despliega */
.rm-sidebar-group-header {
    display: flex;
    align-items: stretch;
    background: #144898;
    border-radius: 8px;
    overflow: hidden;
    transition: background .15s ease;
}

.rm-sidebar-group-link {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 10px 14px;
    font-family: 'Raleway', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    transition: background .15s ease;
}

.rm-sidebar-group-link:hover {
    background: #0f3a7a;
}

.rm-sidebar-group-link.is-active {
    background: #E24927;
}

.rm-sidebar-group-link.is-active:hover {
    background: #C13725;
}

.rm-sidebar-toggle-btn {
    flex: none;
    width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #003366;
    cursor: pointer;
    user-select: none;
    transition: background .15s ease;
}

.rm-sidebar-toggle-btn:hover {
    background: #062c54;
}

.rm-sidebar-toggle-btn::after {
    content: "+";
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.rm-sidebar-toggle-input:checked ~ .rm-sidebar-group-header .rm-sidebar-toggle-btn::after {
    content: "–";
}

/* Hijos: cerrados por defecto en desktop.
   Técnica grid-template-rows 0fr→1fr: anima el alto sin
   conocerlo de antemano (varía según la cantidad de hijas). */
.rm-sidebar-group-children {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .3s ease;
}

.rm-sidebar-group-children-inner {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 4px;
}

.rm-sidebar-toggle-input:checked + .rm-sidebar-group-header + .rm-sidebar-group-children {
    grid-template-rows: 1fr;
}

/* Hijos: color suave (al revés que los padres) */
.rm-sidebar-child {
    background: #EAF1FA;
    color: #144898;
    padding-left: 22px;
}

.rm-sidebar-child:hover {
    background: #D7E6F7;
}

.rm-sidebar-child .rm-sidebar-count {
    background: rgba(20,72,152,.12);
    color: #144898;
}

.rm-sidebar-child.is-active {
    background: #E24927;
    color: #fff;
}

.rm-sidebar-child.is-active .rm-sidebar-count {
    background: rgba(255,255,255,.25);
    color: #fff;
}

/* ============================================
   GRILLA DE PRODUCTOS (archive-product.php)
   Reemplaza el grid-template-columns inline anterior,
   que no tenía breakpoints y quedaba roto en mobile.
   ============================================ */

.rm-catalog-main {
    flex: 1;
    min-width: 0;
}

.rm-product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 991px) {
    .rm-catalog-layout {
        flex-direction: column;
    }

    .rm-sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 10px;
        position: static;
        padding-bottom: 14px;
        margin-bottom: 24px;
        border-bottom: 1px solid #eaedf2;
    }

    .rm-sidebar-link {
        flex: none;
        white-space: nowrap;
        border-radius: 30px;
        background: #f1f4f8;
        padding: 11px 18px;
    }

    /* En mobile no hay espacio para el acordeón: los hijos quedan
       siempre visibles como pills horizontales, sin animación,
       sin importar el estado del checkbox (que además se oculta
       junto al header). */
    .rm-sidebar-toggle-input,
    .rm-sidebar-group-header {
        display: none;
    }

    .rm-sidebar-group-children {
        grid-template-rows: 1fr;
        transition: none;
    }

    .rm-sidebar-group-children-inner {
        overflow: visible;
        flex-direction: row;
        gap: 10px;
        padding-top: 0;
    }

    .rm-sidebar-child {
        padding-left: 14px;
    }

    .rm-product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .rm-product-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 991px) {
    .shop-sidebar {
        margin-bottom: 30px;
    }
}

@media (max-width: 767px) {
    .product-info {
        padding-left: 0 !important;
        margin-top: 20px;
    }
}
