/* ============================================================
   CATALOG — sidebar layout, aligned with the homepage style.
   Light, clean, green accents, Montserrat. Sticky left filter
   rail (categories + nested subcategories + price + delivery),
   right toolbar + 3-up product grid.
   Loaded AFTER autoreg-theme.css, scoped to .catalog-page.
   ============================================================ */

.catalog-page {
    background: #f8fafc;
    padding: 0 0 72px;
    min-height: calc(100vh - 200px);
}

/* Hidden legacy filter controls that products-filter.js binds to */
.catalog-legacy-controls { display: none !important; }

/* ---------- Light page header ---------- */
.catalog-head {
    padding: 16px 0 20px;
}

.catalog-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-size: 13px;
    font-weight: 600;
    color: #94a3b8;
}

.catalog-breadcrumb a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s ease;
}

.catalog-breadcrumb a:hover { color: #475569; }
.catalog-breadcrumb .sep { color: #cbd5e1; }
.catalog-breadcrumb .current { color: #475569; }

/* Title + subtitle on one line — title left, subtitle right (fills the width, cuts height) */
.catalog-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

/* Page-level toolbar on the right of the title row */
.catalog-head-tools {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.catalog-head-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    color: #64748b;
}
.catalog-head-count b {
    display: inline-block;
    color: #1e293b;
    font-weight: 800;
    line-height: 1;
}

.catalog-title {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 0;
    color: #1e293b;
}

/* Variant B — green accent bar instead of an icon badge */
.catalog-title__bar {
    flex: 0 0 auto;
    width: 5px;
    height: 30px;
    border-radius: 3px;
    background: var(--autoreg-accent, #8ff451);
}

/* Segment/collection landing — subtitle under the title */
.catalog-title-wrap { display: flex; flex-direction: column; gap: 7px; }
.catalog-collection-sub {
    margin: 0 0 0 17px;
    font-size: 13.5px;
    font-weight: 600;
    color: #94a3b8;
}
[data-theme="dark"] .catalog-collection-sub { color: #94a3b8; }

.catalog-page .section-badge {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    line-height: 1;
    background: #eafcdd;
    color: #16a34a;
}

.catalog-subtitle {
    margin: 0;
    max-width: 420px;
    font-size: 13.5px;
    line-height: 1.45;
    color: #94a3b8;
    text-align: right;
}

/* ---------- Layout: sidebar + main ---------- */
.catalog-layout {
    display: grid;
    grid-template-columns: 268px minmax(0, 1fr);
    gap: 26px;
    align-items: start;
}

.catalog-aside {
    position: sticky;
    top: 93px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ---------- Filter card ---------- */
.filter-card {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 12px 28px rgba(15, 23, 42, 0.04);
    padding: 8px;
}

.filter-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 12px 10px;
}

.filter-card__head h3 {
    margin: 0;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
}

.filter-reset {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    background: transparent;
    color: #b4bcc7;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.2s ease;
}

.filter-reset:hover { color: #16a34a; }

/* Category list */
.cat-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cat-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    border: 0;
    background: transparent;
    padding: 9px 12px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.cat-item:hover { background: #f4f6f9; }

.cat-item.active {
    background: #eafcdd;
    color: #143a07;
}

.cat-item__ic {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: #f4f6f9;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease;
}

.cat-item.active .cat-item__ic { background: #fff; }
.cat-item__ic img { width: 18px; height: 18px; object-fit: contain; }

.cat-item__ic .all-dots {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    width: 14px;
    height: 14px;
}
.cat-item__ic .all-dots span { background: #16a34a; border-radius: 2px; }

.cat-item__cnt {
    margin-left: auto;
    font-size: 12px;
    font-weight: 700;
    color: #b4bcc7;
}
.cat-item.active .cat-item__cnt { color: #16a34a; }

/* Nested subcategories with a guide line */
.cat-subs {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    margin: 3px 0 7px 28px;
    padding-left: 13px;
    border-left: 2px solid #edf0f4;
}

.cat-subs.open { display: flex; }

.cat-sub {
    border: 0;
    background: transparent;
    text-align: left;
    padding: 7px 13px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.cat-sub:hover { background: #f4f6f9; color: #1e293b; }
.cat-sub.active { background: #f1fae8; color: #16a34a; }

/* Generic filter block (price, delivery) */
.filter-divider { height: 1px; background: #f1f4f8; margin: 6px 12px; }

.filter-block { padding: 4px 12px 12px; }

.filter-block__label {
    display: block;
    margin: 8px 0 10px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #94a3b8;
}

.price-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.price-row input {
    width: 100%;
    height: 40px;
    border: 0;
    background: #f4f6f9;
    border-radius: 10px;
    padding: 0 12px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}

.price-row input::placeholder { color: #b4bcc7; font-weight: 500; }
.price-row input:focus { outline: none; box-shadow: 0 0 0 2px rgba(140, 255, 63, 0.45); }
.price-row .dash { color: #cbd5e1; font-weight: 700; }

/* Delivery toggle (instant only) */
.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.switch-row span {
    font-size: 13.5px;
    font-weight: 600;
    color: #475569;
}

.switch {
    position: relative;
    flex: 0 0 40px;
    width: 40px;
    height: 23px;
    border-radius: 999px;
    background: #e2e8f0;
    transition: background 0.2s ease;
}

.switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-row input:checked + .switch { background: #16a34a; }
.switch-row input:checked + .switch::after { transform: translateX(17px); }

/* ---------- Main column ---------- */
.catalog-main__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.catalog-main__count {
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
}
.catalog-main__count b { color: #1e293b; font-weight: 800; }

/* Sort pill */
.cat-field {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    height: 44px;
    box-sizing: border-box;
    padding: 0 14px;
    gap: 8px;
    border-radius: 11px;
    background: #fff;
    border: 1px solid transparent;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.cat-field--select {
    display: grid;
    grid-template-columns: auto minmax(148px, 1fr);
    column-gap: 16px;
    align-items: center;
    min-width: 310px;
    padding: 0 46px 0 18px;
    cursor: pointer;
}

.cat-field:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08); }
.cat-field:focus-within { border-color: #e2e8f0; box-shadow: 0 3px 10px rgba(15, 23, 42, 0.07); }

.catalog-page .catalog-head-tools .cat-field--select {
    box-shadow: 0 0 14px rgba(15, 23, 42, 0.08);
}

.catalog-page .catalog-head-tools .cat-field--select:hover,
.catalog-page .catalog-head-tools .cat-field--select:focus-within {
    box-shadow: 0 0 16px rgba(15, 23, 42, 0.1);
}

.cat-field__label {
    display: inline-flex;
    align-items: center;
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    height: 42px;
    line-height: 42px;
    color: #94a3b8;
    white-space: nowrap;
    cursor: pointer;
}

.cat-field select {
    width: 100%;
    min-width: 0;
    height: 42px;
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 42px;
    color: #1e293b;
    cursor: pointer;
    padding: 0;
    transform: translateY(0);
}

.cat-field--select::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid #94a3b8;
    border-bottom: 2px solid #94a3b8;
    transform: translateY(-50%) rotate(45deg);
    pointer-events: none;
}

/* Grid: V5 product card spec uses four cards per desktop row. */
.catalog-main .products-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 18px;
}

@media (max-width: 1024px) {
    .catalog-main .products-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}

/* ---------- Product card polish ---------- */
/* Price: keep current + struck original on ONE line so sale cards
   don't get taller than the rest (home stacks them; catalog keeps inline). */
.catalog-page .product-card-price {
    flex-direction: row;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
}

.catalog-page .product-discount-badge {
    background: #ff3b3b !important;
    color: #fff !important;
    font-weight: 700;
    border-radius: 999px;
    box-shadow: 0 4px 10px rgba(255, 59, 59, 0.28);
}
.catalog-page .product-price-row .product-discount-badge { display: none; }

/* ---------- Pagination ---------- */
.catalog-page .seo-pagination { margin-top: 36px; }
.catalog-page .pagination { display: flex; gap: 8px; padding: 0; list-style: none; }

.catalog-page .page-item .page-link {
    appearance: none;
    cursor: pointer;
    min-width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border: 0;
    border-radius: 11px;
    background: #fff;
    color: #475569;
    font-weight: 700;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.catalog-page .page-item.active .page-link {
    cursor: default;
}

.catalog-page .page-item .page-link:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08); }
.catalog-page .page-item.active .page-link { background: #eafcdd; color: #1f2937; box-shadow: inset 0 0 0 1px #bff08a; }

/* ---------- Dark theme ---------- */
[data-theme="dark"] .catalog-page { background: #0f172a; }
[data-theme="dark"] .catalog-title { color: #f1f5f9; }
[data-theme="dark"] .catalog-title__bar { background: var(--autoreg-accent, #8ff451); }
[data-theme="dark"] .catalog-subtitle,
[data-theme="dark"] .catalog-main__count { color: #94a3b8; }
[data-theme="dark"] .catalog-main__count b { color: #f1f5f9; }
[data-theme="dark"] .filter-card,
[data-theme="dark"] .cat-field,
[data-theme="dark"] .catalog-page .page-item .page-link { background: #1e293b; box-shadow: none; }
[data-theme="dark"] .catalog-page .catalog-head-tools .cat-field--select,
[data-theme="dark"] .catalog-page .catalog-head-tools .cat-field--select:hover,
[data-theme="dark"] .catalog-page .catalog-head-tools .cat-field--select:focus-within { box-shadow: none; }
[data-theme="dark"] .cat-item { color: #cbd5e1; }
[data-theme="dark"] .cat-item:hover { background: #243044; }
[data-theme="dark"] .cat-item.active { background: rgba(34, 197, 94, 0.18); color: #eafcdd; }
[data-theme="dark"] .cat-item__ic { background: #0f172a; }
[data-theme="dark"] .cat-sub { color: #94a3b8; }
[data-theme="dark"] .cat-sub.active { background: rgba(34, 197, 94, 0.16); color: #4ade80; }
[data-theme="dark"] .price-row input { background: #0f172a; color: #f1f5f9; }
[data-theme="dark"] .cat-field select { color: #f1f5f9; }
[data-theme="dark"] .catalog-page .section-badge { background: rgba(34, 197, 94, 0.18); color: #4ade80; }
[data-theme="dark"] .filter-divider { background: #243044; }
[data-theme="dark"] .cat-subs { border-left-color: #243044; }

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
    .catalog-layout { grid-template-columns: 1fr; }
    .catalog-aside { position: static; }
    .catalog-main .products-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}

@media (max-width: 768px) {
    .catalog-title { font-size: 23px; }
    .catalog-main .products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .cat-item, .cat-sub, .cat-field, .switch, .switch::after, .catalog-page .page-item .page-link { transition: none; }
}
