/* ============================================================
   Network Marketplace – marketplace.css
   ============================================================ */

/* ---------- Custom properties (easy to override in a theme) */
.nm-marketplace {
    --nm-accent:       #2563eb;
    --nm-accent-hover: #1d4ed8;
    --nm-sale:         #dc2626;
    --nm-text:         #111827;
    --nm-muted:        #6b7280;
    --nm-border:       #e5e7eb;
    --nm-bg-card:      #ffffff;
    --nm-radius:       10px;
    --nm-shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --nm-shadow-hover: 0 8px 20px rgba(0,0,0,.12);
    --nm-gap:          1.5rem;
    --nm-img-ratio:    1 / 1;

    box-sizing: border-box;
    font-family: inherit;
    color: var(--nm-text);
    width: 100%;
}

.nm-marketplace *,
.nm-marketplace *::before,
.nm-marketplace *::after {
    box-sizing: inherit;
}

/* ---------- Filter bar */
.nm-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.25rem;
    align-items: center;
}

.nm-filter-input,
.nm-filter-select {
    padding: .5rem .75rem;
    border: 1px solid var(--nm-border);
    border-radius: 6px;
    font-size: .9rem;
    color: var(--nm-text);
    background: #fff;
    line-height: 1.4;
    min-width: 0;
    flex: 1 1 160px;
    max-width: 260px;
}

.nm-filter-input:focus,
.nm-filter-select:focus {
    outline: 2px solid var(--nm-accent);
    outline-offset: 1px;
    border-color: var(--nm-accent);
}

.nm-btn-clear {
    padding: .5rem 1rem;
    border: 1px solid var(--nm-border);
    border-radius: 6px;
    font-size: .9rem;
    background: #f3f4f6;
    cursor: pointer;
    color: var(--nm-muted);
    transition: background .15s, color .15s;
    white-space: nowrap;
}

.nm-btn-clear:hover {
    background: var(--nm-border);
    color: var(--nm-text);
}

/* ---------- Result count */
.nm-result-count {
    font-size: .85rem;
    color: var(--nm-muted);
    margin: 0 0 1rem;
}

/* ---------- Grid */
.nm-grid {
    display: grid;
    gap: var(--nm-gap);
    grid-template-columns: repeat(2, 1fr);
}

.nm-cols-2 .nm-grid { grid-template-columns: repeat(2, 1fr); }
.nm-cols-3 .nm-grid { grid-template-columns: repeat(3, 1fr); }
.nm-cols-4 .nm-grid { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
    .nm-cols-4 .nm-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 700px) {
    .nm-cols-3 .nm-grid,
    .nm-cols-4 .nm-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .nm-grid,
    .nm-cols-2 .nm-grid,
    .nm-cols-3 .nm-grid,
    .nm-cols-4 .nm-grid {
        grid-template-columns: 1fr;
    }
    .nm-filter-input,
    .nm-filter-select {
        max-width: 100%;
    }
}

/* ---------- Card */
.nm-card {
    background: var(--nm-bg-card);
    border: 1px solid var(--nm-border);
    border-radius: var(--nm-radius);
    box-shadow: var(--nm-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow .2s, transform .2s;
}

.nm-card:hover {
    box-shadow: var(--nm-shadow-hover);
    transform: translateY(-2px);
}

/* hidden by JS when filtered out */
.nm-card--hidden {
    display: none;
}

/* ---------- Card image */
.nm-card__image-wrap {
    display: block;
    position: relative;
    overflow: hidden;
    aspect-ratio: var(--nm-img-ratio);
    background: #f9fafb;
    text-decoration: none;
}

.nm-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
    display: block;
}

.nm-card__image-wrap:hover .nm-card__image {
    transform: scale(1.04);
}

/* Sale badge */
.nm-card__badge {
    position: absolute;
    top: .6rem;
    left: .6rem;
    background: var(--nm-sale);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .2rem .55rem;
    border-radius: 4px;
}

/* ---------- Card body */
.nm-card__body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: .35rem;
}

.nm-card__vendor {
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--nm-accent);
}

.nm-card__title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.35;
}

.nm-card__title a {
    color: var(--nm-text);
    text-decoration: none;
}

.nm-card__title a:hover {
    color: var(--nm-accent);
}

.nm-card__cats {
    font-size: .78rem;
    color: var(--nm-muted);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Card footer */
.nm-card__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: .75rem;
    gap: .5rem;
    flex-wrap: wrap;
}

.nm-card__price {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--nm-text);
}

/* WooCommerce wraps sale prices in ins/del */
.nm-card__price ins {
    text-decoration: none;
    color: var(--nm-sale);
}
.nm-card__price del {
    color: var(--nm-muted);
    font-size: .85em;
    margin-right: .25rem;
}

.nm-card__cta {
    display: inline-block;
    padding: .4rem .9rem;
    background: var(--nm-accent);
    color: #fff !important;
    border-radius: 6px;
    font-size: .82rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s;
    white-space: nowrap;
}

.nm-card__cta:hover {
    background: var(--nm-accent-hover);
    color: #fff !important;
}

/* ---------- No results / empty */
.nm-empty,
.nm-no-results {
    color: var(--nm-muted);
    text-align: center;
    padding: 2rem;
    font-size: 1rem;
}

/* ---------- Pagination */
.nm-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    justify-content: center;
    margin-top: 2rem;
}

.nm-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.2rem;
    height: 2.2rem;
    padding: 0 .6rem;
    border: 1px solid var(--nm-border);
    border-radius: 6px;
    font-size: .9rem;
    color: var(--nm-text);
    text-decoration: none;
    background: #fff;
    transition: background .15s, color .15s, border-color .15s;
}

.nm-page-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.nm-page-btn--active {
    background: var(--nm-accent);
    border-color: var(--nm-accent);
    color: #fff;
    font-weight: 700;
    pointer-events: none;
}
