/* NexaCore V28: production catalog flow, filters, and card geometry. */
.nx-catalog-page .flexible-grid {
    --width: 16.25rem;
    grid-template-columns: var(--width) minmax(0, 1fr);
    align-items: start;
}

.nx-catalog-page .nx-catalog-product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.nx-catalog-page .nx-catalog-product-grid.product-list-view {
    grid-template-columns: minmax(0, 1fr);
}

.nx-catalog-page .nx-catalog-product-card {
    min-width: 0;
    overflow: hidden;
    border-color: #e5e4df !important;
    border-radius: 14px !important;
    background: #fff;
    box-shadow: 0 2px 9px rgba(23, 23, 23, .025);
}

:is(.nx-catalog-page, .nx-store-page) .nx-catalog-product-media {
    display: grid;
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 1 / 1;
    place-items: center;
    padding: 14px;
    border-bottom: 1px solid #efeee9;
    background: #fff;
}

:is(.nx-catalog-page, .nx-store-page) .nx-catalog-product-media .nx-product-image {
    display: flex;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    align-items: center;
    justify-content: center;
}

:is(.nx-catalog-page, .nx-store-page) .nx-catalog-product-media .nx-product-image img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain !important;
    object-position: center;
    transform: none !important;
}

.nx-catalog-page .nx-catalog-product-summary {
    min-width: 0;
    min-height: 0;
    padding: 11px 12px 12px;
    text-align: start;
}

.nx-catalog-page .nx-catalog-product-brand {
    overflow: hidden;
    color: #85868a;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .07em;
    line-height: 1.3;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.nx-catalog-page .nx-catalog-product-title {
    display: -webkit-box;
    min-height: 36px;
    margin: 2px 0 0;
    overflow: hidden;
    color: #171717;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.nx-catalog-page .nx-catalog-product-title a { color: inherit; }

.nx-catalog-page .nx-catalog-product-price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    margin-top: 6px;
}

.nx-catalog-page .nx-catalog-product-price strong {
    color: #171717;
    font-size: 15px;
    font-weight: 800;
}

.nx-catalog-page .nx-catalog-product-price del {
    color: #96979b;
    font-size: 11px;
}

.nx-catalog-page .nx-catalog-product-status {
    display: block;
    margin-top: 3px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.3;
}

.nx-catalog-page .nx-catalog-product-status--in { color: #2f7a54; }
.nx-catalog-page .nx-catalog-product-status--out { color: #9b4c42; }
.nx-catalog-page .nx-catalog-product-status--coming { color: #a67b35; }

@media (min-width: 992px) and (max-width: 1199px) {
    .nx-catalog-page .filter-toggle-aside { position: static; }
    .nx-catalog-page .nx-catalog-product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 991px) {
    .nx-catalog-page .flexible-grid { grid-template-columns: minmax(0, 1fr); }

    .nx-catalog-page .filter-toggle-aside {
        position: fixed;
        inset-inline-start: 0;
        inset-block-start: 0;
        z-index: 1055;
        width: min(18.75rem, 90vw);
        height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
    }

    .nx-catalog-page .filter-toggle-aside.active .card-body {
        max-height: calc(100dvh - 3.5rem);
        overflow-y: auto;
    }

    .nx-catalog-page .nx-catalog-product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
    .nx-catalog-page .nx-catalog-product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    :is(.nx-catalog-page, .nx-store-page) .nx-catalog-product-media { padding: 10px; }

    .nx-catalog-page .nx-catalog-product-summary { padding: 10px; }
    .nx-catalog-page .nx-catalog-product-title { min-height: 32px; font-size: 12.5px; line-height: 1.3; }
    .nx-catalog-page .nx-catalog-product-price { margin-top: 5px; }
    .nx-catalog-page .nx-catalog-product-price strong { font-size: 14px; }
}

@media (max-width: 340px) {
    .nx-catalog-page .nx-catalog-product-grid { grid-template-columns: minmax(0, 1fr); }
}

/* The generic product list sets fixed list-view dimensions with !important. Keep its compact row while retaining a complete, contained image. */
:is(.nx-catalog-page, .nx-store-page) .product-list-view .nx-catalog-product-media {
    width: clamp(116px, 14vw, 144px) !important;
    height: clamp(116px, 14vw, 144px) !important;
    min-width: clamp(116px, 14vw, 144px);
    flex: 0 0 clamp(116px, 14vw, 144px);
    aspect-ratio: 1 / 1;
    padding: 12px;
}

@media (max-width: 575px) {
    :is(.nx-catalog-page, .nx-store-page) .product-list-view .nx-catalog-product-media {
        width: 104px !important;
        height: 104px !important;
        min-width: 104px;
        flex-basis: 104px;
        padding: 9px;
    }
}

/* Product listing refinement: scoped structural layout for the public catalog only. */
.nx-products-page .nx-product-toolbar { margin-bottom: 20px !important; }
.nx-products-page .nx-product-toolbar__body { padding: 20px 22px; }
.nx-products-page .nx-product-toolbar .row { --bs-gutter-y: 14px; }
.nx-products-page .nx-product-toolbar__heading h3 { margin-bottom: 5px !important; }

.nx-products-page .nx-products-layout {
    --width: 16.5rem;
    display: grid;
    grid-template-columns: var(--width) minmax(0, 1fr);
    align-items: start;
    gap: 20px;
}

.nx-products-page .nx-products-sidebar {
    margin: 0;
    border-color: #e8e8e8;
    border-radius: 14px;
    box-shadow: none;
}

.nx-products-page .nx-products-sidebar .card-body { padding: 19px; gap: 0 !important; }
.nx-products-page .nx-products-sidebar .card-body > * + * { margin-top: 18px; padding-top: 18px; border-top: 1px solid #f0efec; }
.nx-products-page .nx-products-sidebar :is(input, select, .form-control, .form-select):focus { border-color: #c9a35e; box-shadow: 0 0 0 3px rgba(201, 163, 94, .16); }

.nx-products-page .nx-products-results { min-width: 0; }
.nx-products-page .nx-products-results-toolbar {
    min-height: 48px;
    gap: 14px;
    margin: 0 0 16px;
    padding: 4px 0;
}

.nx-products-page .nx-products-selected-tags { min-width: 0; }
.nx-products-page .nx-products-view-controls { flex: 0 0 auto; gap: 9px; }
.nx-products-page .nx-products-view-switcher {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin: 0;
    padding: 3px;
    border: 1px solid #e8e8e8;
    border-radius: 11px;
    background: #fff;
}

.nx-products-page .nx-products-view-switcher label > span {
    min-height: 38px;
    padding: 0 10px !important;
    border-radius: 8px;
    color: #666;
    font-size: 12px;
    font-weight: 700;
    transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}

.nx-products-page .nx-products-view-switcher label:hover > span,
.nx-products-page .nx-products-view-switcher input:checked ~ span {
    background: #f8f2e8;
    color: #171717;
    box-shadow: inset 0 -2px 0 #c9a35e;
}

.nx-products-page .nx-products-mobile-filter { width: 44px; height: 44px; padding: 0; border-color: #e8e8e8; color: #171717; }
.nx-products-page .nx-products-mobile-filter:hover { border-color: #c9a35e; background: #f8f2e8; color: #171717; }
.nx-products-page .nx-products-grid { margin: 0; }
.nx-products-page .nx-products-pagination { margin: 28px 0 0; }
.nx-products-page .nx-products-pagination .pagination { gap: 5px; margin: 0; }
.nx-products-page .nx-products-pagination .page-link { min-width: 36px; min-height: 36px; justify-content: center; border: 1px solid #e8e8e8; border-radius: 8px; background: #fff; color: #171717; }
.nx-products-page .nx-products-pagination .page-link.active { border-color: #c9a35e; background: #f8f2e8; color: #171717; }

@media (min-width: 1200px) {
    .nx-products-page .nx-products-sidebar { position: sticky; top: 16px; }
    .nx-products-page .nx-product-toolbar__controls { justify-content: flex-end !important; }
}

@media (max-width: 1199px) {
    .nx-products-page .nx-product-toolbar__controls { justify-content: flex-start !important; }
    .nx-products-page .nx-product-toolbar__search { flex-basis: 100%; max-width: none; }
}

@media (max-width: 991px) {
    .nx-products-page .nx-products-layout { grid-template-columns: minmax(0, 1fr); }
    .nx-products-page .nx-products-sidebar { width: min(19rem, 90vw); }
    .nx-products-page .nx-catalog-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
    .nx-products-page .nx-product-toolbar { margin-bottom: 16px !important; }
    .nx-products-page .nx-product-toolbar__body { padding: 16px; }
    .nx-products-page .nx-products-results-toolbar { align-items: stretch; flex-direction: column; gap: 10px; margin-bottom: 12px; }
    .nx-products-page .nx-products-selected-tags { min-height: 0; }
    .nx-products-page .nx-products-view-controls { justify-content: space-between; width: 100%; }
    .nx-products-page .nx-products-view-switcher { flex: 1 1 auto; justify-content: space-between; }
    .nx-products-page .nx-products-view-switcher li { flex: 1 1 0; }
    .nx-products-page .nx-products-view-switcher label > span { justify-content: center; width: 100%; }
    .nx-products-page .nx-products-pagination { margin-top: 22px; }
}
