/* ─────────────────────────────────────────────────────────────────────
 * Services Marketplace — listing page chrome.
 *
 * Owns hero (centered title + pill search), left filter rail
 * (categories, price range, location, reset), main column controls
 * (results summary + sort dropdown), tile grid wrapper, and
 * numbered pagination.
 *
 * Tiles themselves stay rendered by partials/product-tile.php; the
 * .sat-marketplace scope below trims tile chrome (badge position,
 * description, verified badge) so the dense partial output reads as
 * the cleaner marketplace card in the design.
 *
 * Colors / radii / shadows / transitions all come from core/theme-system.css.
 * Local aliases below exist purely to make this file readable — they
 * resolve to tokens, never to literal hex.
 *
 * Source: app/Views/products/index.php
 * ───────────────────────────────────────────────────────────────────── */

.sat-marketplace {
    /* Token aliases — every value here resolves to a theme variable so
       this page tracks color-theme + light/dark switches. */
    --mkt-bg:           var(--bg-primary);
    --mkt-card:         var(--card-background, #ffffff);
    --mkt-ink:          var(--text-primary);
    --mkt-ink-soft:     var(--text-secondary);
    --mkt-muted:        var(--text-tertiary);
    --mkt-very-muted:   var(--text-quaternary);
    --mkt-border:       var(--border-primary);
    --mkt-pill-bg:      var(--bg-tertiary);

    background: var(--mkt-bg);
}

/* ── Hero ──────────────────────────────────────────────────────────── */
.sat-marketplace__hero {
    padding: 56px 0 28px;
    text-align: center;
}

.sat-marketplace__hero-title {
    /* Sized between site h1 (68px) and homepage hero (52px) so the
       page still scans as a top-level header but doesn't dwarf nav. */
    font-size: clamp(36px, 5.4vw, 52px);
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.05;
    letter-spacing: 0;
    margin: 0 0 18px;
}

.sat-marketplace__hero-subtitle {
    max-width: 560px;
    margin: 0 auto;
    font-size: 17px;
    line-height: 1.6;
    color: var(--text-tertiary);
}

.sat-marketplace__hero-search {
    margin: 32px auto 0;
    max-width: 640px;
    padding: 0 16px;
}

.sat-marketplace__search-shell {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--mkt-card);
    border: 1px solid var(--mkt-border);
    border-radius: var(--radius-pill);
    padding: 6px 6px 6px 22px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.sat-marketplace__search-shell:focus-within {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-subtle, var(--primary-50));
}

.sat-marketplace__search-icon {
    color: var(--mkt-very-muted);
    font-size: 18px;
    margin-right: 12px;
    flex-shrink: 0;
}

.sat-marketplace__search-input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    font-family: inherit;
    font-size: 15px;
    color: var(--text-primary);
    padding: 12px 0;
    min-width: 0;
}

.sat-marketplace__search-input::placeholder {
    color: var(--mkt-very-muted);
}

.sat-marketplace__search-submit {
    flex-shrink: 0;
    background: var(--brand-primary);
    color: var(--text-inverse);
    border: 0;
    border-radius: var(--radius-pill);
    padding: 11px 24px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.sat-marketplace__search-submit:hover {
    background: var(--brand-primary-hover);
}

/* ── Layout ────────────────────────────────────────────────────────── */
.sat-marketplace__layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 40px;
    padding: 24px 0 64px;
}

@media (max-width: 1023px) {
    .sat-marketplace__layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* ── Sidebar ───────────────────────────────────────────────────────── */
.sat-marketplace__sidebar {
    display: flex;
    flex-direction: column;
    gap: 28px;
    position: sticky;
    top: 96px;
    align-self: start;
}

@media (max-width: 1023px) {
    .sat-marketplace__sidebar {
        position: static;
    }
}

.sat-marketplace__filter-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sat-marketplace__filter-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

.sat-marketplace__filter-heading i {
    color: var(--brand-primary);
    font-size: 16px;
}

/* Category pills */
.sat-marketplace__cat-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.sat-marketplace__cat-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 14px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.sat-marketplace__cat-link:hover {
    background: var(--mkt-pill-bg);
    color: var(--text-primary);
}

.sat-marketplace__cat-link.is-active {
    background: var(--primary-100);
    color: var(--primary-800);
    font-weight: 600;
}

.sat-marketplace__cat-count {
    font-size: 12px;
    font-weight: 600;
    background: var(--mkt-pill-bg);
    color: var(--text-tertiary);
    padding: 2px 9px;
    border-radius: var(--radius-pill);
    min-width: 28px;
    text-align: center;
}

.sat-marketplace__cat-link.is-active .sat-marketplace__cat-count {
    background: var(--primary-200);
    color: var(--primary-800);
}

/* Price slider */
.sat-marketplace__price-track {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: var(--border-primary);
    border-radius: var(--radius-pill);
    outline: 0;
    margin: 10px 0 6px;
}

.sat-marketplace__price-track::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--brand-primary);
    border: 3px solid var(--card-background, #fff);
    box-shadow: var(--shadow-sm);
    border-radius: 50%;
    cursor: pointer;
}

.sat-marketplace__price-track::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--brand-primary);
    border: 3px solid var(--card-background, #fff);
    box-shadow: var(--shadow-sm);
    border-radius: 50%;
    cursor: pointer;
}

.sat-marketplace__price-labels {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-tertiary);
}

/* Location input */
.sat-marketplace__location-input {
    width: 100%;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--card-background, #fff);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.sat-marketplace__location-input:focus {
    outline: 0;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-subtle, var(--primary-50));
}

.sat-marketplace__location-input::placeholder {
    color: var(--mkt-very-muted);
}

/* Reset button */
.sat-marketplace__reset {
    display: inline-block;
    text-align: center;
    padding: 10px 18px;
    border: 1.5px solid var(--brand-primary);
    color: var(--brand-primary);
    background: transparent;
    border-radius: var(--radius-pill);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
    margin-top: 4px;
}

.sat-marketplace__reset:hover {
    background: var(--brand-primary);
    color: var(--text-inverse);
}

/* ── Main column ───────────────────────────────────────────────────── */
.sat-marketplace__main {
    min-width: 0;
}

.sat-marketplace__results-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.sat-marketplace__results-summary {
    font-size: 14px;
    color: var(--text-secondary);
}

.sat-marketplace__results-summary strong {
    color: var(--text-primary);
    font-weight: 700;
}

.sat-marketplace__sort {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.sat-marketplace__sort-select {
    -webkit-appearance: none;
    appearance: none;
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    padding-right: 18px;
    /* Inline SVG carat — recolored via `currentColor` would require a mask,
       so we hand-encode the dark stroke (matches --text-secondary). */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23374151' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right center;
    background-size: 12px;
}

.sat-marketplace__sort-select:focus {
    outline: 0;
}

/* Grid */
.sat-marketplace__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 1023px) {
    .sat-marketplace__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 639px) {
    .sat-marketplace__grid {
        grid-template-columns: 1fr;
    }
}

/* Empty state */
.sat-marketplace__empty {
    text-align: center;
    padding: 64px 24px;
    border: 1px dashed var(--border-primary);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-size: 15px;
}

/* ── Pagination ────────────────────────────────────────────────────── */
.sat-marketplace__pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
}

.sat-marketplace__page,
.sat-marketplace__page-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border-radius: var(--radius-pill);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: 0;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.sat-marketplace__page:hover,
.sat-marketplace__page-nav:hover {
    background: var(--primary-100);
    color: var(--primary-800);
}

.sat-marketplace__page.is-current {
    background: var(--brand-primary);
    color: var(--text-inverse);
}

.sat-marketplace__page-nav[aria-disabled="true"] {
    opacity: 0.45;
    pointer-events: none;
}

/* ── Tile chrome trims (scoped to marketplace) ─────────────────────── */
/* The product-tile partial is dense by design — the marketplace card
   is leaner. These rules hide rows that the design doesn't show and
   reposition the category badge to the top-left to match the mock. */
.sat-marketplace .hp2-services__card {
    padding: 10px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.sat-marketplace .hp2-services__card-img-wrap {
    border-radius: var(--radius-md);
}

.sat-marketplace .hp2-services__card-badge {
    top: 12px;
    left: 12px;
    bottom: auto;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.06em;
}

.sat-marketplace .hp2-services__card-desc {
    display: none;
}

/* Seller row: drop the top border the partial uses to separate it
   from the rating row above. */
.sat-marketplace .sat-product-tile__seller {
    border-top: 0;
    padding-top: 0;
    margin: 6px 0 0;
}

/* Rating row sits between seller and footer in the partial. Make it
   compact and right-aligned so it reads like a small rating chip
   without dominating the card. */
.sat-marketplace .hp2-services__card-rating {
    justify-content: flex-end;
    margin-bottom: 8px;
}

/* Hide the verified badge in marketplace context — design omits it. */
.sat-marketplace .sat-verified-badge {
    display: none;
}
