:root {
    --brand-primary: #2f3fa8;
    --brand-primary-dark: #232c7c;
}

* { box-sizing: border-box; }

html, body {
    overflow-x: hidden;
}

body {
    margin: 0;
    background: #dde3ee;
    color: #1e293b;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Page shell: caps width and centers on desktop ────────── */
.catalog-shell {
    max-width: 1280px;
    margin: 0 auto;
    background: #eef1f8;
    min-height: 100vh;
    box-shadow: 0 0 40px rgba(15, 23, 42, .08);
}

/* ── Header ─────────────────────────────────────────────── */
.catalog-header {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-dark) 100%);
    color: #fff;
    padding: 28px 20px 24px;
    border-radius: 0 0 22px 22px;
}
.catalog-header .brand-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.catalog-header .brand-dot {
    width: 26px; height: 26px; border-radius: 50%;
    background: rgba(255,255,255,.18);
    border: 2px solid rgba(255,255,255,.5);
    flex-shrink: 0;
}
.catalog-header h1 {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: .5px;
    margin: 0;
    text-transform: uppercase;
}
.catalog-header .subtitle {
    font-size: .72rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255,255,255,.75);
    margin-top: 2px;
}

.header-scope-row {
    display: flex;
    gap: 14px;
    margin-top: 18px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.branch-tabs {
    display: flex;
    gap: 10px;
    flex: 1 1 240px;
    flex-wrap: wrap;
}
.branch-tab {
    flex: 1 1 160px;
    min-width: 140px;
    text-align: center;
    padding: 12px 16px;
    border-radius: 12px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    background: rgba(255,255,255,.18);
    color: #fff;
    transition: background .15s, color .15s;
}
.branch-tab.active {
    background: #fff;
    color: var(--brand-primary-dark);
}

.type-tabs {
    display: flex;
    gap: 6px;
    flex: 0 0 auto;
    background: rgba(255,255,255,.12);
    padding: 4px;
    border-radius: 14px;
}
.type-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: 700;
    font-size: .85rem;
    color: rgba(255,255,255,.85);
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, color .15s;
}
.type-tab.active {
    background: #fff;
    color: var(--brand-primary-dark);
}
.type-tab:hover:not(.active) {
    background: rgba(255,255,255,.15);
    color: #fff;
}

/* ── Category pills ─────────────────────────────────────── */
.category-bar {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 16px 20px 6px;
    scrollbar-width: thin;
}
.category-bar::-webkit-scrollbar { height: 6px; }
.category-bar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.category-pill {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 12px;
    border: 2px solid #fff;
    background: #fff;
    font-weight: 700;
    color: #1e293b;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
    transition: border-color .15s, color .15s;
}
.category-pill.active {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

/* ── Search & filters ───────────────────────────────────── */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 6px 20px 12px;
}
.search-input {
    flex: 1 1 260px;
    min-width: 0;
    border-radius: 14px;
    padding: 14px 18px;
    border: 1px solid #dde2ee;
    font-size: .95rem;
    background-color: #fff;
}
.brand-select {
    flex: 1 1 200px;
    min-width: 0;
    border-radius: 14px;
    padding: 10px 14px;
    border: 1px solid #dde2ee;
    background-color: #fff;
}
.results-count {
    padding: 4px 20px 10px;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .5px;
    color: #64748b;
    text-transform: uppercase;
}

/* ── Category section header ────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px 8px;
}
.section-header .section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    color: var(--brand-primary);
    text-transform: uppercase;
    letter-spacing: .5px;
    font-size: .95rem;
}
.section-header .section-count {
    color: #94a3b8;
    font-weight: 700;
    font-size: .85rem;
}
.section-divider {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 0 20px 6px;
}

/* ── Product card ────────────────────────────────────────── */
.products-wrap { padding: 0 20px 40px; }

.product-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    padding: 16px 18px;
    margin-bottom: 14px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.product-media {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.product-thumb {
    width: 64px; height: 64px;
    border-radius: 10px;
    object-fit: cover;
    background: #f1f5f9;
    flex-shrink: 0;
    cursor: pointer;
}
.product-thumb-placeholder {
    width: 64px; height: 64px;
    border-radius: 10px;
    background: #f1f5f9;
    display: flex; align-items: center; justify-content: center;
    color: #cbd5e1;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.product-media .product-actions { margin-top: 0; }
.product-body { flex: 1; min-width: 0; }
.product-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}
.product-title {
    font-weight: 700;
    font-size: .98rem;
    color: #1e293b;
    line-height: 1.3;
}
.product-title a { color: inherit; text-decoration: none; }
.product-title a:hover { color: var(--brand-primary); }
.product-meta {
    font-size: .76rem;
    color: #94a3b8;
    margin-bottom: 8px;
}
.product-desc {
    font-size: .82rem;
    color: #64748b;
    line-height: 1.4;
    margin-bottom: 8px;
}
.product-gallery-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.product-gallery-thumb {
    width: 44px; height: 44px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: transform .1s, border-color .1s;
}
.product-gallery-thumb:hover {
    transform: scale(1.06);
    border-color: var(--brand-primary);
}
.badge-stock {
    display: inline-block;
    flex-shrink: 0;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .76rem;
    font-weight: 700;
    background: #dcfce7;
    color: #15803d;
}
.badge-stock.out {
    background: #fee2e2;
    color: #b91c1c;
}
.badge-stock.service {
    background: #e0e7ff;
    color: #4338ca;
}
.badge-promo-tag {
    display: inline-block;
    flex-shrink: 0;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .76rem;
    font-weight: 700;
}
.badge-promo-tag.badge-promo {
    background: #fee2e2;
    color: #b91c1c;
}
.badge-promo-tag.badge-clearance {
    background: #fef3c7;
    color: #92400e;
}
.product-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: 50%;
    border: none;
    color: #fff;
    text-decoration: none;
    font-size: 1rem;
    transition: transform .1s;
}
.btn-action:hover { transform: scale(1.08); color: #fff; }
.btn-whatsapp { background: #25d366; }
.btn-facebook { background: #1877f2; }

.product-side {
    text-align: right;
    flex-shrink: 0;
}
.product-price {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--brand-primary);
    white-space: nowrap;
}

/* ── Infinite scroll preloader ───────────────────────────── */
.scroll-sentinel {
    display: flex;
    justify-content: center;
    padding: 20px;
}
.spinner-ring {
    width: 34px; height: 34px;
    border: 3px solid #dde2ee;
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}
.empty-state i { font-size: 2.4rem; display: block; margin-bottom: 10px; }

/* ── Product detail page ─────────────────────────────────── */
.detail-wrap { padding: 24px 20px 60px; }
.detail-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--brand-primary);
    text-decoration: none;
    font-weight: 700;
    margin-bottom: 16px;
}
.detail-card {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 1px 6px rgba(0,0,0,.06);
    padding: 24px;
}
.detail-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}
.detail-gallery a img {
    width: 96px; height: 96px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
}
.detail-gallery-empty {
    width: 100%; height: 220px;
    background: #f1f5f9;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    color: #cbd5e1;
    font-size: 3rem;
}
.detail-title { font-weight: 800; font-size: 1.3rem; margin-bottom: 6px; }
.detail-price { font-weight: 800; font-size: 1.6rem; color: var(--brand-primary); margin: 10px 0; }
.detail-desc { color: #475569; white-space: pre-line; line-height: 1.6; }

@media (max-width: 576px) {
    .catalog-header h1 { font-size: 1.15rem; }
    .product-card { flex-wrap: wrap; }
    .product-side { text-align: left; margin-top: 10px; width: 100%; display: flex; justify-content: space-between; align-items: center; }
    .type-tabs { flex: 1 1 100%; }
    .type-tab { flex: 1 1 auto; justify-content: center; }
}

/* ── Floating WhatsApp button ────────────────────────────── */
.floating-whatsapp-wrap,
.floating-whatsapp-show {
    position: fixed;
    left: max(20px, calc((100vw - 1280px) / 2 + 20px));
    bottom: 20px;
    z-index: 1000;
}
.floating-whatsapp-wrap { display: flex; align-items: center; }
.floating-whatsapp {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: #25d366;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.7rem;
    box-shadow: 0 4px 16px rgba(37, 211, 102, .45);
    text-decoration: none;
    transition: transform .15s;
}
.floating-whatsapp:hover { transform: scale(1.08); color: #fff; }
.floating-whatsapp-close {
    position: absolute;
    top: -4px; right: -4px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #64748b;
    display: flex; align-items: center; justify-content: center;
    font-size: .68rem;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.floating-whatsapp-show {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: #25d366;
    color: #fff;
    border: none;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    opacity: .85;
    box-shadow: 0 2px 10px rgba(0,0,0,.2);
    cursor: pointer;
}
.floating-whatsapp-show:hover { opacity: 1; }
