/* STP MARKET — MARKETPLACE PREMIUM V7 */

:root {
    --market-blue: #086bd9;
    --market-navy: #103d70;
    --market-border: #e1e8f3;
    --market-bg: #f5f8fe;
}

.stp-sticky-navigation {
    position: relative !important;
    top: auto !important;
    padding: 0 !important;
    margin: 0 0 15px !important;
    background: transparent !important;
    box-shadow: none !important;
}

.stp-category-section,
.stp-horizontal-filters,
.results-meta-bar {
    display: none !important;
}

.stp-market-top {
    background: #fff;
    border: 1px solid var(--market-border);
    border-radius: 16px;
    padding: 12px 15px;
    margin-bottom: 16px;
}

.stp-market-top-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.stp-market-search {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    border: 1px solid var(--market-border);
    background: #f8faff;
    border-radius: 11px;
    padding: 0 13px;
}

.stp-market-search i {
    color: var(--market-blue);
}

.stp-market-search input {
    height: 44px;
    width: 100%;
    min-width: 0;
    background: transparent;
    border: 0;
    outline: 0;
    color: #183c62;
    font-size: 13px;
}

.stp-market-search-submit {
    height: 44px;
    padding: 0 19px;
    border: 0;
    border-radius: 11px;
    background: var(--market-blue);
    color: #fff;
    font-weight: 800;
}

.stp-market-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.stp-market-sidebar {
    position: sticky;
    top: 15px;
    background: #fff;
    border: 1px solid var(--market-border);
    border-radius: 16px;
    padding: 18px;
    max-height: calc(100vh - 30px);
    overflow-y: auto;
}

.stp-market-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.stp-market-sidebar-header h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 900;
    color: var(--market-navy);
}

.stp-market-group {
    border-top: 1px solid #edf1f7;
    padding: 15px 0;
}

.stp-market-group h3 {
    font-size: 12px;
    font-weight: 900;
    color: #23456b;
    margin-bottom: 12px;
}

.stp-market-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 11px;
    color: #52677f;
    font-size: 12px;
    cursor: pointer;
}

.stp-market-radio input {
    accent-color: var(--market-blue);
}

.stp-market-price-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.stp-market-price-fields label {
    display: block;
    font-size: 11px;
    margin-bottom: 5px;
    color: #64748b;
}

.stp-market-price-fields input {
    width: 100%;
    min-width: 0;
    height: 39px;
    border: 1px solid var(--market-border);
    border-radius: 9px;
    padding: 0 8px;
    font-size: 12px;
}

.stp-market-select {
    width: 100%;
    height: 42px;
    border: 1px solid var(--market-border);
    border-radius: 10px;
    background: #f8faff;
    color: #183c62;
    padding: 0 9px;
    font-size: 12px;
}

.stp-market-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.stp-market-reset,
.stp-market-apply {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
}

.stp-market-reset {
    flex: 1;
    border: 1px solid #b7cef0;
    background: #fff;
    color: var(--market-blue);
}

.stp-market-apply {
    flex: 1.5;
    border: 0;
    background: var(--market-blue);
    color: #fff;
}

.stp-market-main {
    min-width: 0;
}

.stp-market-popular {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 0 15px;
    border-bottom: 1px solid var(--market-border);
    scrollbar-width: thin;
}

.stp-market-popular-label {
    font-size: 11px;
    font-weight: 900;
    white-space: nowrap;
    color: #45607d;
}

.stp-market-chip {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 11px;
    border: 1px solid #bdd4f7;
    border-radius: 999px;
    background: #fff;
    color: var(--market-blue);
    text-decoration: none;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 800;
}

.stp-market-chip:hover,
.stp-market-chip.is-active {
    background: var(--market-blue);
    border-color: var(--market-blue);
    color: #fff;
}

.stp-market-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 0;
    color: #60758b;
    font-size: 12px;
}

.stp-market-toolbar strong {
    color: var(--market-navy);
}

.stp-market-products {
    background: #fff;
    border: 1px solid var(--market-border);
    border-radius: 16px;
    padding: 12px;
    min-width: 0;
}

.stp-market-products .products-grid {
    align-items: stretch;
}

.stp-market-mobile-filter,
.stp-market-close,
.stp-market-overlay {
    display: none;
}

@media (min-width: 1400px) {
    .stp-market-products .products-grid > .col-xl-4 {
        width: 25%;
        flex: 0 0 25%;
    }
}

@media (max-width: 991.98px) {
    .stp-market-layout {
        display: block;
    }

    .stp-market-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 2100;
        width: min(340px, 90vw);
        max-height: 100dvh;
        border-radius: 0 18px 18px 0;
        transform: translateX(-105%);
        transition: transform .25s ease;
        box-shadow: 12px 0 35px rgba(0,0,0,.14);
    }

    .stp-market-sidebar.is-open {
        transform: translateX(0);
    }

    .stp-market-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        border: 0;
        border-radius: 8px;
        background: #edf5ff;
        color: var(--market-navy);
    }

    .stp-market-mobile-filter {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        padding: 9px 12px;
        border: 1px solid #bdd4f7;
        border-radius: 9px;
        background: #fff;
        color: var(--market-blue);
        font-size: 12px;
        font-weight: 800;
    }

    .stp-market-overlay.is-open {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 2090;
        background: rgba(4, 20, 40, .55);
    }

    body.stp-market-filters-open {
        overflow: hidden;
    }
}

@media (max-width: 575.98px) {
    .stp-market-top {
        padding: 8px;
        margin-bottom: 10px;
    }

    .stp-market-search input {
        height: 41px;
        font-size: 12px;
    }

    .stp-market-search-submit {
        height: 41px;
        padding: 0 12px;
    }

    .stp-market-search-submit span {
        display: none;
    }

    .stp-market-products {
        padding: 7px;
        border-radius: 12px;
    }

    .stp-market-popular {
        gap: 6px;
    }
}

html.is-pwa .stp-market-layout {
    display: block;
}

html.is-pwa .stp-market-sidebar {
    position: fixed;
}

html.is-pwa .stp-market-mobile-filter {
    display: inline-flex;
}

html.is-pwa .stp-market-products .products-grid > [class*="col-"] {
    width: 50%;
    flex: 0 0 50%;
}

/* Scroll infinito: preservar o fallback */
.stp-infinite-controls {
    margin: 18px 0 12px;
    min-height: 30px;
}

#infiniteSentinel {
    height: 1px;
}

.stp-infinite-controls.is-auto #loadMoreBtn {
    display: none !important;
}

.stp-infinite-controls.is-error #loadMoreBtn {
    display: inline-flex !important;
}

.stp-infinite-end {
    margin: 18px 0;
    font-size: 12px;
    color: #60758c;
}

.pagination-wrap {
    display: none !important;
}

/* STP MARKET — FIXED SIDEBAR V14 */

/* Desktop: painel lateral acompanha a navegação */
@media (min-width: 992px) {

    .stp-market-sidebar {
        position: sticky !important;
        top: 16px !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;

        align-self: start !important;
        height: calc(100dvh - 32px) !important;
        max-height: calc(100dvh - 32px) !important;

        display: flex !important;
        flex-direction: column !important;

        overflow: hidden !important;
        padding: 0 !important;
        margin: 0 !important;

        background: #fff !important;
        border: 1px solid #dce6f1 !important;
        border-radius: 14px !important;
        box-shadow: 0 6px 24px rgba(20,45,80,.07) !important;
        z-index: 20 !important;
    }

    .stp-market-sidebar-header {
        flex: 0 0 auto !important;
        padding: 16px !important;
        background: #fff !important;
        border-bottom: 1px solid #e5edf5 !important;
    }

    .stp-market-sidebar > form {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding: 8px 16px 16px !important;
        scrollbar-width: thin;
        overscroll-behavior: contain;
    }

    /* Botões normais, dentro do painel */
    .stp-market-actions {
        position: static !important;
        flex: 0 0 auto !important;
        display: grid !important;
        grid-template-columns: 1fr 1.5fr !important;
        gap: 8px !important;

        width: 100% !important;
        margin: 0 !important;
        padding: 12px 14px !important;

        background: #fff !important;
        border-top: 1px solid #e5edf5 !important;
        border-radius: 0 0 14px 14px !important;
        box-shadow: 0 -5px 18px rgba(20,45,80,.04) !important;
        z-index: auto !important;
    }

    .stp-market-reset,
    .stp-market-apply {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-height: 42px !important;
        width: 100% !important;
        padding: 8px 5px !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        border-radius: 9px !important;
        white-space: nowrap !important;
    }
}

/* Mobile: preservar menu deslizante */
@media (max-width: 991.98px) {

    .stp-market-sidebar {
        display: flex !important;
        flex-direction: column !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        overflow: hidden !important;
    }

    .stp-market-sidebar > form {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
    }

    .stp-market-actions {
        position: relative !important;
        flex: 0 0 auto !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 12px 14px max(12px, env(safe-area-inset-bottom)) !important;
        background: #fff !important;
        border-top: 1px solid #e5edf5 !important;
        z-index: 30 !important;
    }
}
