/* ── Marketplace (P2P) ───────────────────────────────────────────────
   Tabs, filters, item grids, detail panes, buy modal, create-order
   form, and my-listings UI for the player marketplace.
   ──────────────────────────────────────────────────────────────────── */

/* ── Marketplace v2 ─────────────────────────────────────────────────── */
/* Diverges intentionally from .panel-tabs - equal-width flex tabs for marketplace top bar. */
.mp-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin: -4px -2px 12px;
}
.mp-tab {
    flex: 1;
    padding: 10px 6px;
    font-size: var(--font-size-md);
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: center;
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}
.mp-tab.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}
.mp-tab:hover:not(.active) {
    color: rgba(255, 255, 255, 0.6);
}

/* Stat strip */
.mp-stat-strip {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 120px), 1fr));
    gap: var(--space-xs);
    margin-bottom: 12px;
}
.mp-stat-pill {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    padding: 7px 9px;
}
.mp-stat-pill-label {
    font-size: var(--font-size-base);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 5px;
}
.mp-stat-chips {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xs);
}
.mp-stat-chip {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 2px 7px 2px 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    font-size: var(--font-size-md);
    color: rgba(200, 212, 224, 0.8);
    cursor: pointer;
    transition: border-color 0.12s;
    min-height: 32px;
}
.mp-stat-chip:hover {
    border-color: rgba(197, 160, 89, 0.3);
}
.mp-stat-chip-icon {
    font-size: var(--font-size-xl);
    line-height: 1;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.mp-stat-chip-icon .item-icon {
    width: 25px;
    height: 25px;
}
.mp-stat-chip-icon .item-icon__img {
    width: 25px;
    height: 25px;
    margin-bottom: 0;
}

/* Sub-tab row */
.mp-subtabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    margin-bottom: 10px;
}
.mp-subtab {
    padding: 6px 14px;
    font-size: var(--font-size-md);
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    transition: all 0.12s;
}
.mp-subtab.active {
    color: #c8d4e0;
    border-bottom-color: rgba(197, 160, 89, 0.6);
}
.mp-subtab:hover:not(.active) {
    color: rgba(255, 255, 255, 0.6);
}

/* Filter chips */
.mp-filter-bar {
    display: flex;
    gap: var(--space-xs);
    padding: 0 0 10px;
    overflow-x: auto;
    scrollbar-width: none;
}
.mp-filter-bar::-webkit-scrollbar {
    display: none;
}
.mp-filter-btn {
    padding: 10px 10px;
    font-size: var(--font-size-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.45);
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.12s;
    white-space: nowrap;
    flex-shrink: 0;
}
.mp-filter-btn.active,
.mp-filter-btn:hover {
    background: rgba(197, 160, 89, 0.1);
    border-color: rgba(197, 160, 89, 0.35);
    color: var(--gold);
}

/* Filter input */
.mp-filter-input {
    width: 100%;
    padding: 7px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(200, 212, 224, 0.85);
    border-radius: 3px;
    font-size: var(--font-size-md);
    font-family: var(--font-body);
    outline: none;
    margin-bottom: 12px;
    box-sizing: border-box;
    transition: border-color 0.12s;
}
.mp-filter-input:focus {
    border-color: rgba(197, 160, 89, 0.3);
}
.mp-filter-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

/* Category section headers */
.mp-cat-header {
    font-size: var(--font-size-md);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 8px 0 6px;
    margin-bottom: 6px;
}

/* Item grid */
.mp-item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--space-md);
    margin-bottom: 16px;
}
/* ── mp-item-card overrides ─────────────────────────────── */
/* No aspect-ratio - some cards contain buy/sell controls and must grow */
.mp-item-card {
    width: 100%;
    cursor: pointer;
    overflow: hidden;
    aspect-ratio: 1;
}
.mp-item-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-3xl);
    line-height: 1;
    flex-shrink: 0;
}
.mp-item-icon .item-icon {
    width: 100%;
    height: 100%;
}
.mp-item-icon .item-icon__img {
    width: 100%;
    height: 100%;
    margin-bottom: 0;
}
.mp-item-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}
.mp-item-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: var(--font-size-sm);
    color: rgba(200, 212, 224, 0.85);
    text-align: center;
    line-height: 1.2;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    background: rgba(0, 0, 0, 0.62);
    padding: 4px 4px 5px;
    border-radius: 0 0 4px 4px;
}
.mp-item-qty {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}
.mp-buy-btn {
    width: 100%;
    padding: 4px;
    font-size: var(--font-size-md);
    background: rgba(197, 160, 89, 0.1);
    border: 1px solid rgba(197, 160, 89, 0.3);
    color: var(--gold);
    border-radius: 2px;
    cursor: pointer;
}
.mp-buy-btn:hover {
    background: rgba(197, 160, 89, 0.2);
}
/* Owned-qty badge - gold, top-left, used on all item cards */
.mp-badge-count {
    position: absolute;
    top: -10px;
    left: -10px;
    font-size: var(--font-size-md);
    background: rgb(18 19 22);
    border: 1px solid rgb(39 40 42);
    color: rgb(186 152 85);
    border-radius: 3px;
    padding: 4px 6px 2px 6px;
    letter-spacing: 0.03em;
    font-weight: 600;
    pointer-events: none;
    z-index: 2;
}
/* Required-qty badge - top-right; turns red when you don't have enough */
.mp-badge-req {
    position: absolute;
    top: -10px;
    right: -10px;
    font-size: var(--font-size-md);
    background: rgb(18 19 22);
    border: 1px solid rgb(39 40 42);
    color: rgb(186 152 85);
    border-radius: 3px;
    padding: 4px 6px 2px 6px;
    letter-spacing: 0.03em;
    font-weight: 600;
    pointer-events: none;
    z-index: 2;
}
.mp-badge-req--ok {
    background: rgb(18 19 22);
    border-color: rgb(39 40 42);
    color: rgb(186 152 85);
}
.mp-badge-req--alert {
    background: rgb(35 15 17);
    border-color: rgba(200, 60, 60, 0.45);
    color: rgb(186 152 85);
}

/* Item detail page */
.mp-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0 10px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.mp-detail-heading {
    font-size: var(--font-size-md);
    letter-spacing: 0.1em;
    color: var(--gold);
    font-weight: 700;
    text-transform: uppercase;
}
.mp-detail-back-btn {
    background: none;
    border: none;
    color: var(--gold);
    font-size: var(--font-size-base);
    letter-spacing: 0.08em;
    cursor: pointer;
    padding: 0;
    opacity: 0.75;
    transition: opacity 0.12s;
}
.mp-detail-back-btn:hover {
    opacity: 1;
}
.mp-detail-item-block {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.mp-detail-icon-box {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    font-size: var(--font-size-4xl);
}
.mp-detail-icon-box .item-icon__img {
    width: 52px;
    height: 52px;
    object-fit: contain;
}
.mp-detail-info {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}
.mp-detail-name {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 4px;
    font-family: var(--font-heading);
}
.mp-detail-category {
    font-size: var(--font-size-md);
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 5px;
}
.mp-detail-desc {
    font-size: var(--font-size-base);
    color: rgba(200, 212, 224, 0.45);
    font-style: italic;
}
.mp-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-top: 6px;
}
.mp-item-stat-tag {
    font-size: var(--font-size-md);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(200, 212, 224, 0.7);
    border-radius: 3px;
    padding: 2px 8px;
    letter-spacing: 0.04em;
}
/* Diverges intentionally from .panel-section-title - muted white, compact, internal to marketplace detail pane. */
.mp-detail-section {
    margin-bottom: 16px;
}
.mp-detail-section-label {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding-bottom: 7px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 8px;
}
.mp-detail-section-empty {
    font-size: var(--font-size-md);
    color: rgba(255, 255, 255, 0.25);
    padding: 6px 0;
}
.mp-detail-fill-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: var(--font-size-base);
}
.mp-detail-fill-row:last-child {
    border-bottom: none;
}
.mp-detail-fill-time {
    flex: 1;
    color: rgba(255, 255, 255, 0.35);
}
.mp-detail-fill-qty {
    color: rgba(255, 255, 255, 0.5);
}
.mp-detail-fill-price {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--gold);
    font-weight: 600;
}
.mp-detail-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
}
.mp-detail-col {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 3px;
    padding: 10px 12px;
}
.mp-detail-col--sell {
    border-color: rgba(200, 80, 80, 0.2);
}
.mp-detail-col-label {
    font-size: var(--font-size-sm);
    font-weight: 700;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.mp-detail-col-label--sell {
    color: rgba(220, 80, 80, 0.7);
    border-bottom-color: rgba(200, 80, 80, 0.15);
}
.mp-detail-col-empty {
    font-size: var(--font-size-md);
    color: rgba(255, 255, 255, 0.2);
    padding: 4px 0;
}
.mp-detail-order-headers {
    display: grid;
    grid-template-columns: 3rem 1fr 1fr auto;
    gap: var(--space-xs);
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 4px;
}
.mp-detail-col--sell .mp-detail-order-headers {
    grid-template-columns: 3rem 1fr 1fr;
}
.mp-detail-order-row {
    display: grid;
    grid-template-columns: 3rem 1fr 1fr auto;
    gap: var(--space-xs);
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: var(--font-size-md);
}
.mp-detail-col--sell .mp-detail-order-row {
    grid-template-columns: 3rem 1fr 1fr;
}
.mp-detail-order-row:last-child {
    border-bottom: none;
}
.mp-detail-order-qty {
    color: rgba(200, 212, 224, 0.7);
}
.mp-detail-order-price {
    color: var(--gold);
    font-weight: 600;
}
.mp-detail-order-name {
    font-size: var(--font-size-sm);
    color: rgba(200, 212, 224, 0.55);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mp-detail-buy-btn {
    padding: 3px 10px;
    background: rgba(197, 160, 89, 0.1);
    border: 1px solid rgba(197, 160, 89, 0.3);
    color: var(--gold);
    border-radius: 3px;
    cursor: pointer;
    font-size: var(--font-size-base);
    white-space: nowrap;
    transition: background 0.12s;
}
.mp-detail-buy-btn:hover {
    background: rgba(197, 160, 89, 0.22);
}

/* Marketplace listing rows */
.mp-listing-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.mp-listing-row:last-child {
    border-bottom: none;
}
.mp-listing-seller-tag {
    font-size: var(--font-size-md);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    padding: 2px 8px;
}
.mp-listing-qty-name {
    flex: 1;
    font-size: var(--font-size-lg);
    color: #c8d4e0;
}
.mp-listing-price {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--gold);
    font-size: var(--font-size-lg);
    font-weight: 600;
}
.mp-listing-arrow {
    color: var(--text-muted);
    font-size: var(--font-size-xl);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s;
    border: none;
    background: rgba(255, 255, 255, 0.04);
}
.mp-listing-arrow:hover {
    background: rgba(197, 160, 89, 0.12);
    color: var(--gold);
}

/* ── Gold icon ────────────────────────────────────────────────────── */
.gold-icon {
    font-size: 1em;
    line-height: 1;
    vertical-align: middle;
    width: 1.8rem;
    height: 1.8rem;
}
