/* =========================================================
   RV Affiliate — Products Catalog Page Styles
   Inherits: variables.css, style.css
   Design System: Crimson Depth (#710014) + Obsidian Black (#161616) + Soft Pearl (#F2F1ED)
   ========================================================= */

/* ─── Visually Hidden (Accessibility) ─── */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ─────────────────────────────────────────────────────────
   HERO SECTION — Theme Adaptive Section
───────────────────────────────────────────────────────── */
.products-hero {
    position: relative;
    background: var(--hero-bg);
    color: var(--text-primary);
    padding: calc(var(--space-section) + 60px) 0 clamp(48px, 6vw, 80px);
    overflow: hidden;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.products-hero .hero-content {
    max-width: 780px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.products-hero h1 {
    font-size: clamp(36px, 4.5vw, 60px);
    font-weight: 500;
    line-height: 1.1;
    color: var(--text-primary);
    margin-bottom: 20px;
    letter-spacing: -0.025em;
}

.products-hero .hero-subtitle {
    font-size: var(--fs-body);
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 600px;
    margin-bottom: 30px;
}

.catalog-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--br-pill);
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.03em;
}

.catalog-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand);
    box-shadow: 0 0 10px rgba(162,13,42,0.8);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.85); }
}

/* ─────────────────────────────────────────────────────────
   CATALOG SECTION — Adaptive Page Background
───────────────────────────────────────────────────────── */
.catalog-section {
    background-color: var(--page-bg);
    padding: clamp(48px, 6vw, 96px) 0;
    min-height: 60vh;
}

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

/* ─────────────────────────────────────────────────────────
   SIDEBAR FILTERS
───────────────────────────────────────────────────────── */
.filter-sidebar {
    position: sticky;
    top: 100px;
    background: var(--surface);
    border-radius: var(--br-card);
    border: 1px solid var(--border);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    box-shadow: var(--shadow);
}

.filter-block {
    display: flex;
    flex-direction: column;
}

.filter-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* Search Box & Constrained Search Icon (20px) */
.search-wrap {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px !important;
    height: 20px !important;
    max-width: 20px !important;
    max-height: 20px !important;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 11px 14px 11px 42px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    font-family: var(--font-primary);
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.search-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(113,0,20,0.12);
    background: var(--surface);
}

.search-input::placeholder {
    color: var(--text-muted);
    opacity: 0.85;
}

/* Filter Pill Groups */
.filter-pill-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
    width: 100%;
}

.filter-pill:hover {
    background: var(--surface-soft);
    border-color: var(--border);
}

.filter-pill.active {
    background: rgba(113,0,20,0.12);
    border-color: var(--brand);
    color: var(--brand);
    font-weight: 600;
}

.filter-pill .pill-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-pill .pill-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--surface-soft);
    border-radius: var(--br-pill);
    padding: 2px 8px;
    min-width: 22px;
    text-align: center;
    margin-left: 8px;
}

.filter-pill.active .pill-count {
    background: rgba(113,0,20,0.18);
    color: var(--brand);
}

/* Reset Button */
.reset-btn {
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 16px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.reset-btn:hover {
    border-color: var(--brand);
    color: var(--brand);
    background: rgba(113,0,20,0.06);
}

/* ─────────────────────────────────────────────────────────
   CATALOG MAIN & TOOLBAR
───────────────────────────────────────────────────────── */
.catalog-main {
    display: flex;
    flex-direction: column;
}

.catalog-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
}

.result-count {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
}

.sort-select {
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 16px;
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.sort-select option {
    background: var(--surface);
    color: var(--text-primary);
}

.sort-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(113,0,20,0.12);
}

/* ─────────────────────────────────────────────────────────
   PRODUCT GRID (3 cols desktop, 2 cols tablet, 1 col mobile)
───────────────────────────────────────────────────────── */
.catalog-main .product-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

/* ─────────────────────────────────────────────────────────
   PRODUCT CARD (Aligned with Homepage Editor's Picks Cards)
───────────────────────────────────────────────────────── */
.catalog-main .product-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--br-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.catalog-main .product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px var(--shadow);
    border-color: var(--brand);
}

/* Card Image Wrap */
.product-image-wrap {
    height: 190px;
    background: var(--surface-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid var(--border);
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 18px;
    display: block;
    transition: transform var(--transition-fast);
}

.catalog-main .product-card:hover .product-image {
    transform: scale(1.04);
}

/* Clean Neutral Placeholder */
.product-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-soft);
    color: rgba(113,0,20,0.35);
}

/* Platform Tag Badge */
.platform-badge {
    position: absolute;
    bottom: 12px;
    right: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: var(--br-pill);
    box-shadow: 0 2px 6px var(--shadow);
}

/* Card Body Content */
.catalog-main .product-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.catalog-main .product-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.catalog-main .category {
    font-size: var(--fs-small);
    color: var(--brand);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.product-title {
    font-size: clamp(16px, 1.4vw, 19px);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}

.product-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Pricing Row */
.product-pricing {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.price-current {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.price-regular {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: line-through;
}

.price-discount {
    font-size: 11px;
    font-weight: 700;
    background: rgba(113,0,20,0.12);
    color: var(--brand);
    padding: 3px 8px;
    border-radius: var(--br-pill);
    letter-spacing: 0.03em;
}

.price-unavailable {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
}

/* Card Action Buttons */
.catalog-main .product-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.catalog-main .product-actions .btn-primary {
    text-align: center;
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 700;
    width: 100%;
}

.catalog-main .product-actions .text-link {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 4px;
}

.catalog-main .product-actions .text-link:hover {
    color: var(--brand);
}

/* ─────────────────────────────────────────────────────────
   EMPTY STATE
───────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 80px 24px;
    background: var(--surface);
    border-radius: var(--br-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.empty-icon {
    font-size: 48px;
    color: var(--text-muted);
    opacity: 0.4;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* ─────────────────────────────────────────────────────────
   RESPONSIVE BREAKPOINTS
/* Mobile Filter Bar & Drawer Controls */
.mobile-filter-bar {
    display: none;
}

.mobile-filter-backdrop {
    display: none;
}

.mobile-filter-header {
    display: none;
}

/* ─────────────────────────────────────────────────────────
   RESPONSIVE BREAKPOINTS
───────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .catalog-layout {
        grid-template-columns: 240px 1fr;
        gap: 28px;
    }

    .catalog-main .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }
}

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

    .mobile-filter-bar {
        display: flex;
        align-items: center;
        margin-bottom: 20px;
    }

    .mobile-filter-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 10px 18px;
        font-family: var(--font-primary);
        font-size: 14px;
        font-weight: 600;
        color: var(--text-primary);
        cursor: pointer;
        transition: all var(--transition-fast);
        box-shadow: var(--shadow);
    }

    .mobile-filter-btn:hover,
    .mobile-filter-btn:focus-visible {
        border-color: var(--brand);
        color: var(--brand);
        outline: none;
    }

    .mobile-filter-btn.has-active {
        border-color: var(--brand);
        color: var(--brand);
        background: rgba(113, 0, 20, 0.08);
    }

    .filter-count-badge {
        font-size: 13px;
        font-weight: 700;
        color: var(--brand);
    }

    .mobile-filter-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s ease;
        z-index: 1001;
    }

    .mobile-filter-backdrop.is-open {
        opacity: 1;
        visibility: visible;
    }

    .filter-sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        width: 100%;
        max-width: 100vw;
        max-height: 85vh;
        background: var(--surface);
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
        border: 1px solid var(--border);
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.3);
        padding: 20px 24px 28px;
        z-index: 1002;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
        visibility: hidden;
        overflow-y: auto;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        gap: 24px;
    }

    .filter-sidebar.is-open {
        transform: translateY(0);
        visibility: visible;
    }

    .mobile-filter-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-bottom: 14px;
        border-bottom: 1px solid var(--border);
    }

    .mobile-filter-title {
        font-family: var(--font-primary);
        font-size: 16px;
        font-weight: 700;
        color: var(--text-primary);
    }

    .mobile-filter-close {
        background: var(--surface-soft);
        border: 1px solid var(--border);
        border-radius: 50%;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--text-primary);
        cursor: pointer;
        transition: all var(--transition-fast);
    }

    .mobile-filter-close:hover {
        background: var(--brand);
        color: #FFFFFF;
        border-color: var(--brand);
    }
}

@media (max-width: 640px) {
    .products-hero {
        padding: calc(var(--space-section) + 40px) 0 40px;
    }

    .catalog-main .product-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .catalog-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .sort-select {
        width: 100%;
    }
}
