/**
 * Estilos específicos para la página de listado de Productos, Categorías y Marcas.
 * Archivo: /assets/css/productos.css
 */

/* =========================================
   1. HERO BANNER
========================================= */
.productos-hero {
    height: 380px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-color: var(--black);
    /* Color por defecto */
}

.productos-hero .hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.productos-hero .hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    width: 100%;
}

.productos-hero h1 {
    font-family: var(--font-primary);
    color: var(--color-text-inverse);
    font-size: 64px;
    font-weight: 400;
    line-height: 1.1;
    margin: 0;
}

/* Responsive hero */
@media (max-width: 991px) {
    .productos-hero {
        height: 300px;
    }

    .productos-hero h1 {
        font-size: 48px;
    }
}

@media (max-width: 768px) {
    .productos-hero {
        height: 250px;
    }

    .productos-hero h1 {
        font-size: 36px;
    }
}

/* =========================================
   2. BREADCRUMB
========================================= */
.breadcrumb {
    margin-top: 80px;
    padding: var(--spacing-xs) 0;
    font-size: var(--text-small);
    color: var(--color-text-muted);
    font-weight: 400;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.breadcrumb a {
    color: var(--color-text-muted);
    transition: color 0.3s;
}

.breadcrumb a:hover {
    color: var(--color-primary);
}

.breadcrumb .active {
    color: #333;
    font-weight: 500;
}

.breadcrumb .separator {
    color: #ccc;
    font-size: 10px;
}

/* El componente search-banner ya tiene sus estilos en components.css */

/* =========================================
   3. SECCIÓN MARCAS
========================================= */
.productos-marcas {
    background-color: var(--color-background-light);
    padding: 0 0 0 0;
    text-align: center;
}

.marcas-header {
    margin-bottom: var(--spacing-lg);
}

.marcas-header h2 {
    font-size: var(--text-h3);
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    color: var(--color-text-main);
}

.marcas-header p {
    font-size: var(--text-small);
    color: var(--color-text-muted);
    max-width: 600px;
    margin: 0 auto;
}

.marcas-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-sm);
}

.marca-card {
    flex: 0 0 calc(12.5% - var(--spacing-sm));
    min-width: 140px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.marca-card:hover {
    transform: translateY(-5px);
}

.marca-card img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Responsive Marcas */
@media (max-width: 1200px) {
    .marca-card {
        flex: 0 0 calc(16.66% - var(--spacing-sm));
    }
}

@media (max-width: 991px) {
    .marca-card {
        flex: 0 0 calc(25% - var(--spacing-sm));
    }
}

@media (max-width: 576px) {
    .marca-card {
        flex: 0 0 calc(50% - var(--spacing-sm));
        min-width: 120px;
    }
}

/* =========================================
   4. LISTADO DE PRODUCTOS (Layout + Sidebar + Grid)
========================================= */
.productos-listing-section {
    padding: 48px 0 0px;
    background-color: var(--color-background-light);
}

.productos-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    align-items: start;
}

/* --- SIDEBAR --- */
.productos-sidebar {
    background-color: var(--color-surface-white);
    border-radius: var(--radius-card);
    position: sticky;
    top: 10px;
    border: 1px solid var(--color-border);
    max-height: calc(100vh - 20px);
    overflow-y: auto;
    overflow-x: hidden;
    word-break: break-word;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

.productos-sidebar::-webkit-scrollbar {
    width: 4px;
}

.productos-sidebar::-webkit-scrollbar-thumb {
    background-color: var(--color-border);
    border-radius: 10px;
}

.productos-sidebar .sidebar-cat-header span,
.productos-sidebar .sidebar-subcat-item span {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.3;
}

.productos-sidebar::-webkit-scrollbar {
    width: 4px;
}

.productos-sidebar::-webkit-scrollbar-thumb {
    background-color: var(--color-border);
    border-radius: 10px;
}

/* Categoría en el sidebar (activa/expandida) */
.sidebar-cat-item {
    border-bottom: 1px solid var(--color-border);
}

.sidebar-cat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-main);
    cursor: pointer;
    transition: background 0.18s ease;
    gap: 8px;
    background: none;
    border: none;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
    text-align: left;
    font-family: var(--font-primary);
    overflow-wrap: anywhere;
}

.sidebar-cat-header>span:first-child {
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
}

.sidebar-cat-header:hover {
    background-color: var(--color-background-light);
}

.sidebar-cat-header.active {
    color: var(--color-text-main);
    background-color: var(--color-background-light);
}

.sidebar-cat-header .chevron-icon {
    flex-shrink: 0;
    color: var(--color-text-muted);
    transition: transform 0.25s ease;
}

.sidebar-cat-item.is-open .chevron-icon {
    transform: rotate(180deg);
}

/* Botón toggle del chevron: abre el submenu sin navegar */
.chevron-toggle {
    background: transparent;
    border: none;
    padding: 4px;
    margin: -4px -4px -4px 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    flex-shrink: 0;
    color: inherit;
    transition: background-color 0.2s ease;
}

.chevron-toggle:hover {
    background-color: rgba(0, 0, 0, 0.06);
}

/* Submenu colapsado por defecto (categorías no activas) */
.sidebar-subcats-collapsed {
    display: none;
}

.sidebar-cat-item.is-open > .sidebar-subcats-collapsed {
    display: block;
    animation: sidebar-subcats-slide 0.25s ease;
}

@keyframes sidebar-subcats-slide {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Subcategorías expandidas */
.sidebar-subcats {
    background-color: #fafafa;
    border-top: 1px solid var(--color-border-light);
}

.filter-group {
    padding: 5px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    margin: 0;
}

.filter-group:last-child {
    border-bottom: none;
}

.filter-group-title {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    margin-bottom: 8px;
    font-weight: 700;
    opacity: 0.7;
}

.filter-group-options {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-subcat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 2px 0;
    cursor: pointer;
    font-size: 12.5px;
    color: var(--color-text-muted);
    transition: color 0.2s;
}

.sidebar-subcat-item:hover {
    color: var(--color-text-main);
}

.sidebar-subcat-item input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border: 1.5px solid #bbb;
    border-radius: 50%;
    flex-shrink: 0;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
}

.sidebar-subcat-item input[type="radio"]:checked {
    border-color: var(--color-text-main);
    background-color: var(--color-text-main);
    box-shadow: inset 0 0 0 3px white;
}

/* Otras categorías colapsadas (debajo de la activa) */
.sidebar-other-cats {
    padding: 4px 0;
    border-top: 1px solid var(--color-border);
}

.sidebar-other-cat {
    display: block;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 400;
    color: var(--color-text-muted);
    transition: color 0.2s, background 0.2s;
    border-bottom: 1px solid var(--color-border);
}

.sidebar-other-cat:last-child {
    border-bottom: none;
}

.sidebar-other-cat:hover {
    color: var(--color-text-main);
    background-color: var(--color-background-light);
}

/* --- GRID WRAPPER --- */
.productos-grid-wrapper {
    min-width: 0;
}

.productos-grid-header {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--color-border);
}

.productos-count {
    font-size: var(--text-small);
    color: var(--color-text-muted);
    margin: 0;
}

.productos-count strong {
    color: var(--color-text-main);
    font-weight: 600;
}

.productos-orderby {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--text-small);
    color: var(--color-text-muted);
    white-space: nowrap;
}

.productos-orderby label {
    font-weight: 500;
    color: var(--color-text-muted);
    letter-spacing: 0.01em;
}

.productos-orderby select {
    appearance: none;
    -webkit-appearance: none;
    background-color: var(--color-surface-white);
    border: 1px solid #d8d8d8;
    border-radius: 6px;
    padding: 7px 32px 7px 12px;
    font-size: var(--text-small);
    font-family: inherit;
    color: var(--color-text-main);
    font-weight: 500;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    min-width: 180px;
}

.productos-orderby select:hover {
    border-color: #bbb;
}

.productos-orderby select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(252, 194, 86, 0.18);
}

/* --- PAGINACIÓN --- */
.productos-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 40px;
    flex-wrap: wrap;
}

.pag-num,
.pag-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    border-radius: 6px;
    font-size: var(--text-small);
    font-weight: 500;
    border: 1px solid var(--color-border);
    background: var(--color-surface-white);
    color: var(--color-text-main);
    text-decoration: none;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    cursor: pointer;
    padding: 0 10px;
}

.pag-num:hover,
.pag-arrow:not(.disabled):hover {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: var(--color-secondary);
}

.pag-num.active {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
    color: #fff;
    pointer-events: none;
}

.pag-arrow {
    padding: 0;
}

.pag-arrow.disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.pag-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    color: var(--color-text-muted);
    font-size: var(--text-small);
}

/* --- PRODUCT GRID --- */
.productos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* Override: producto en el listing NO tiene aspect-ratio fijo en la imagen */
.producto-grid-item .product-card {
    width: 100%;
}

.producto-grid-item .product-card .product-image {
    aspect-ratio: unset;
    background: none;
}

.producto-grid-item .product-card .product-image img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    border-radius: var(--radius-card) var(--radius-card) 0 0;
}

.productos-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-muted);
}

/* --- RESPONSIVE LISTING --- */
@media (max-width: 1200px) {
    .productos-layout {
        grid-template-columns: 240px 1fr;
    }

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

@media (max-width: 991px) {
    .productos-layout {
        grid-template-columns: 1fr;
    }

    .productos-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* --- Drawer de filtros --- */
    .productos-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(85vw, 360px);
        max-height: 100vh;
        max-height: 100dvh;
        z-index: 9998;
        border-radius: 0;
        border: none;
        border-right: 1px solid var(--color-border);
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.165, 0.84, 0.44, 1);
        display: block;
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.25);
        will-change: transform;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .productos-sidebar-header {
        position: sticky;
        top: 0;
        z-index: 2;
    }

    .productos-sidebar.active {
        transform: translateX(0);
    }

    .productos-sidebar-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 0 var(--spacing-md);
        border-bottom: 1px solid var(--color-border);
        background-color: var(--color-surface-white);
        flex-shrink: 0;
    }

    .productos-sidebar-title {
        font-size: 1rem;
        font-weight: 600;
        color: var(--color-text);
    }

    .productos-sidebar-close {
        background: transparent;
        border: none;
        color: var(--color-text);
        cursor: pointer;
        padding: 6px;
        display: flex;
        align-items: center;
        border-radius: var(--radius-pill);
        transition: background-color 0.25s ease;
    }

    .productos-sidebar-close:hover {
        background-color: var(--color-background-light);
    }

    /* Backdrop */
    .filters-backdrop {
        position: fixed;
        inset: 0;
        background-color: rgba(0, 0, 0, 0.45);
        z-index: 9997;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .filters-backdrop.active {
        opacity: 1;
        visibility: visible;
    }

    /* Botón flotante (FAB) - compacto, abajo-izquierda, SIEMPRE visible */
    .filters-fab {
        position: fixed;
        left: 12px;
        bottom: 16px;
        z-index: 9999;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        padding: 0;
        gap: 0;
        background-color: var(--color-primary);
        color: var(--color-secondary);
        border: none;
        border-radius: 50%;
        cursor: pointer;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
        opacity: 0.9;
        transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                    box-shadow 0.25s ease,
                    background-color 0.25s ease,
                    opacity 0.25s ease;
        animation: filters-fab-pulse 2.4s ease-in-out infinite;
    }

    .filters-fab:hover {
        transform: scale(1.08);
        opacity: 1;
    }

    .filters-fab:active {
        transform: scale(0.92);
    }

    /* Estado cuando el drawer está abierto: el FAB se oculta con animación */
    .filters-fab.is-open {
        animation: none;
        transform: translateX(-140%) scale(0.8);
        opacity: 0;
        pointer-events: none;
    }

    .filters-fab .icon-md {
        width: 20px;
        height: 20px;
        transition: transform 0.3s ease;
    }

    /* Ocultar label textual: el FAB ahora es solo icono */
    .filters-fab-label {
        display: none;
    }

    /* Pulso sutil para llamar la atención sobre el FAB */
    @keyframes filters-fab-pulse {
        0%, 100% {
            box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28),
                        0 0 0 0 rgba(var(--color-primary-rgb, 252, 163, 17), 0.4);
        }
        50% {
            box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28),
                        0 0 0 10px rgba(var(--color-primary-rgb, 252, 163, 17), 0);
        }
    }
}

/* Ocultar FAB y backdrop en desktop por defecto */
.filters-fab,
.filters-backdrop,
.productos-sidebar-header {
    display: none;
}

@media (max-width: 576px) {
    .productos-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .producto-grid-item .product-card .product-image img {
        height: 150px;
    }
}

/* =====================================================
   SECCIÓN CONTENIDO SEO (H2 + descripción + FAQ)
   ===================================================== */
.category-content-section {
    padding: 80px 0 0 0;
    background-color: var(--color-background-light);
}

.category-intro-h2 {
    text-align: center;
    font-size: var(--text-h2);
    font-weight: 600;
    color: var(--color-text-main);
    margin-bottom: 24px;
}

.category-intro-p {
    text-align: center;
    max-width: 780px;
    margin: 0 auto 56px;
    color: var(--color-text-muted);
}

/* =====================================================
   AJAX TRANSITIONS
   ===================================================== */
.ajax-content-fade {
    transition: opacity 0.1s ease-in-out;
    opacity: 1;
}

.ajax-loading {
    opacity: 0.7;
    /* Sutil desvanecimiento para indicar carga sin distractores */
    pointer-events: none;
}

/* --- FAQ SECTION WITH BACKGROUND --- */
.home-faq {
    background-image: url('/3-Productos/orion-producto-fondo-ondas.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding: 0 0 100px 0;
}