/* ================================================
   LIBERCLIMA — CATÁLOGO V2
   Estilos específicos del catálogo.
   Requiere base.css + home-v2.css cargados antes.
================================================ */

/* Nav always visible on catalog page */
.nav-v2 {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 1px 0 rgba(0,0,0,0.07);
    padding: 14px 0;
}

.nav-v2 .nav-logo { color: var(--color-primary); }
.nav-v2 .nav-links a { color: #374151; }
.nav-v2 .nav-links a:hover { color: var(--color-primary); }
.nav-v2 .nav-social-btn { border-color: #e5e7eb; color: #374151; }

.nav-v2 .nav-wa-btn {
    background: rgba(37,211,102,0.1);
    border-color: rgba(37,211,102,0.35);
    color: #1a8a3c;
}

.nav-v2 .nav-cart-btn {
    background: #fff;
    border-color: #e5e7eb;
    color: #374151;
}

.nav-v2 .nav-hamburger span { background: var(--color-dark); }

/* ── CATALOG SECTION ── */
.catalog-section {
    padding: 96px 0 56px;
    background:
        radial-gradient(ellipse 75% 65% at 0% 0%, rgba(11,60,93,0.28) 0%, transparent 100%),
        radial-gradient(ellipse 70% 60% at 100% 100%, rgba(243,112,33,0.24) 0%, transparent 100%),
        #eef1f5;
}

.catalog-section .container {
    max-width: 1360px;
}

/* Category tabs — reutiliza .products-tabs de home-v2.css */
.catalog-cat-tabs {
    margin-bottom: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    overflow: visible;
    padding-bottom: 0;
    min-width: 0;
    max-width: 100%;
}

.catalog-cat-tabs .tab-btn {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    text-align: left;
    border-radius: 8px;
    border: 1px solid transparent;
    border-left: 3px solid transparent;
    margin-bottom: 0;
    padding: 9px 12px 9px 10px;
    line-height: 1.3;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.catalog-cat-tabs .tab-btn:hover {
    background: rgba(11, 60, 93, 0.05);
}

.catalog-cat-tabs .tab-btn.active {
    background: rgba(11, 60, 93, 0.08);
    border-color: transparent;
    border-left-color: var(--color-accent);
    color: var(--color-primary);
    font-weight: 700;
}

.catalog-layout {
    display: grid;
    grid-template-columns: minmax(210px, 250px) minmax(0, 1fr);
    column-gap: clamp(20px, 2.4vw, 32px);
    row-gap: 20px;
    align-items: start;
}

.catalog-sidebar {
    position: sticky;
    top: 92px;
    display: grid;
    gap: 12px;
    align-self: start;
    min-width: 0;
    max-width: 100%;
}

.catalog-filter-toggle {
    display: none;
}

.catalog-filter-content {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.catalog-sidebar__panel,
.catalog-filters {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.catalog-sidebar__panel {
    padding: 14px;
}

.catalog-sidebar__head {
    margin-bottom: 10px;
}

.catalog-results {
    min-width: 0;
}

/* Filter bar */
.catalog-filters {
    display: grid;
    gap: 10px;
    margin-bottom: 0;
    padding: 14px;
}

.catalog-filters__label {
    font-size: 0.77rem;
    font-weight: 700;
    color: var(--color-gray);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.catalog-select,
.catalog-input {
    padding: 8px 34px 8px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
    color: var(--color-dark);
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s;
    outline: none;
    width: 100%;
    min-width: 0;
}

.catalog-select {
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
    cursor: pointer;
}

.catalog-input {
    background: #fff;
    padding-right: 14px;
}

.catalog-select:focus,
.catalog-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(11,60,93,0.08);
}

.catalog-category-filters {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.catalog-category-filter {
    display: grid;
    gap: 6px;
}

.catalog-category-filter span {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--color-gray);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.catalog-count {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-gray);
    line-height: 1.35;
}

/* Applied filters — recuadros estilo Ansal en la barra lateral */
.catalog-applied-filters {
    display: grid;
    gap: 10px;
    min-width: 0;
}

.catalog-applied-filters[hidden] {
    display: none;
}

.catalog-applied-filter {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    background: var(--color-primary);
    border-radius: 10px;
    padding: 14px 40px 14px 16px;
    box-shadow: 0 8px 20px rgba(11, 60, 93, 0.18);
    min-width: 0;
    max-width: 100%;
}

.catalog-applied-filter span {
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.35;
    color: #fff;
    overflow-wrap: anywhere;
}

.catalog-applied-filter__remove {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    background: rgba(255, 255, 255, 0.16);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}

.catalog-applied-filter__remove:hover {
    background: rgba(255, 255, 255, 0.32);
}

.catalog-applied-filter__remove svg {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
}

.catalog-applied-filters__clear {
    justify-self: start;
    background: none;
    border: none;
    padding: 2px 0;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: underline;
    cursor: pointer;
}

/* ── SKELETON DE IMÁGENES ── */
@keyframes img-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.catalog-section .prod-card__img-wrap {
    background: linear-gradient(90deg, #f0f2f5 25%, #e8eaed 50%, #f0f2f5 75%);
    background-size: 200% 100%;
    animation: img-shimmer 1.4s ease-in-out infinite;
    min-height: 150px;
    padding: 20px 16px 14px;
}

.catalog-section .prod-card__img-wrap img {
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.25s ease;
}

.catalog-section .prod-card__img-wrap img.is-loaded {
    opacity: 1;
}

.catalog-section .prod-card__img-wrap:has(img.is-loaded) {
    background: none;
    animation: none;
}

/* Catalog grid — matriz de 4 columnas en desktop */
.catalog-section .prod-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.catalog-section .prod-card {
    min-width: 0;
    border-radius: 12px;
}

.catalog-section .prod-card__name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.5em;
}

.catalog-section .prod-card__img-link,
.catalog-section .prod-card__name-link {
    text-decoration: none;
    color: inherit;
}

.catalog-section .prod-card__img-link {
    display: flex;
}

.catalog-section .prod-card__name-link {
    display: block;
}

.catalog-section .prod-card__name-link:hover {
    color: var(--color-primary);
}

.catalog-section .prod-card__price-line {
    min-width: 0;
    color: var(--color-gray);
    font-size: 0.78rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

/* Empty/error state */
.catalog-empty {
    grid-column: 1 / -1;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 40px 28px;
    text-align: center;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.06);
}

.catalog-empty h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.catalog-empty p {
    margin-bottom: 24px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}


/* ── PAGINADOR ── */
.catalog-paginador {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 36px;
    flex-wrap: wrap;
}

.paginador-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: var(--color-dark);
    font: 600 0.84rem 'Inter', sans-serif;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    white-space: nowrap;
}

.paginador-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.paginador-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    pointer-events: none;
}

.paginador-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 38px;
    color: var(--color-gray);
    font-size: 0.9rem;
    pointer-events: none;
    user-select: none;
}

.paginador-num {
    min-width: 38px;
    padding: 0 8px;
}

.paginador-prev,
.paginador-next {
    padding: 0 16px;
}

@media (max-width: 480px) {
    .paginador-prev,
    .paginador-next {
        font-size: 0;
    }
    .paginador-prev::before { content: "←"; font-size: 0.84rem; }
    .paginador-next::after  { content: "→"; font-size: 0.84rem; }
}

/* ── CTA SECTION ── */
.catalog-cta-section {
    padding: 56px 0;
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
}

.catalog-cta-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    flex-wrap: wrap;
}

.catalog-cta-inner h2 {
    font-size: clamp(1.6rem, 3vw, 2rem);
    margin-bottom: 10px;
    line-height: 1.2;
}

.catalog-cta-inner > div:first-child p {
    font-size: 0.95rem;
    max-width: 480px;
}

.catalog-cta-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
    flex-wrap: wrap;
    align-items: center;
}


/* ── SEARCH (dentro de la barra lateral, mismo ancho que el sidebar) ── */
.catalog-search-panel {
    display: grid;
    gap: 8px;
}

.catalog-filter-search {
    position: relative;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    transition: border-color 0.2s;
}

.catalog-search-bar__icon {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    fill: none;
    stroke: var(--color-gray);
    stroke-width: 2.3;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.catalog-filter-search:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(11,60,93,0.1);
}

.catalog-filter-search .catalog-input {
    padding-left: 38px;
    background: transparent;
    border-color: transparent;
}

.catalog-filter-search .catalog-input:focus {
    border-color: transparent;
    box-shadow: none;
}

/* ── RUBRO TOGGLE ── */
.catalog-rubro-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    gap: 8px;
}

.catalog-rubro-toggle svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: var(--color-gray);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.catalog-rubro-toggle[aria-expanded="false"] svg {
    transform: rotate(-90deg);
}

/* ── CATEGORY LIST (subcategorias en cascada) ── */
.catalog-cat-subtabs {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    margin-top: 6px;
    overflow: visible;
    padding-bottom: 0;
}


/* ── RESPONSIVE ── */

/* Laptop chico / tablet horizontal: la grilla baja a 3 columnas junto al sidebar */
@media (max-width: 1180px) {
    .catalog-section .prod-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px;
    }
}

@media (max-width: 900px) {
    .catalog-layout {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .catalog-sidebar {
        position: static;
        overflow: visible;
    }

    .catalog-filter-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        width: 100%;
        min-height: 44px;
        padding: 10px 14px;
        border: 1px solid #dbe4ee;
        border-radius: 10px;
        background: #fff;
        color: var(--color-dark);
        font: 700 0.86rem 'Inter', sans-serif;
        cursor: pointer;
        box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
    }

    .catalog-filter-toggle svg {
        width: 18px;
        height: 18px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2.4;
        stroke-linecap: round;
        stroke-linejoin: round;
        transition: transform 0.2s ease;
        flex: 0 0 auto;
    }

    .catalog-filter-toggle[aria-expanded="true"] svg {
        transform: rotate(180deg);
    }

    .catalog-filter-toggle[aria-expanded="false"] + .catalog-filter-content,
    .catalog-filter-content[hidden] {
        display: none;
    }

    .catalog-cat-tabs {
        display: flex;
        overflow-x: auto;
        width: 100%;
    }

    .catalog-cat-tabs .tab-btn {
        width: auto;
        min-width: auto;
        max-width: none;
        white-space: nowrap;
    }

    .catalog-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: end;
    }

    .catalog-filters__label,
    .catalog-count {
        grid-column: 1 / -1;
    }

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

    .catalog-cta-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 28px;
    }
}

@media (max-width: 640px) {
    .catalog-section { padding: 92px 0 44px; }
    .catalog-section .prod-grid { grid-template-columns: 1fr; }

    .catalog-filters { grid-template-columns: 1fr; }

    .catalog-select,
    .catalog-input { min-width: 0; width: 100%; }

    .catalog-cta-actions {
        flex-direction: column;
        width: 100%;
    }

    .catalog-cta-actions a {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}
