/**
 * Fixed, platform-owned visual design — deliberately NOT driven by any
 * shop's chosen theme colors (unlike /markets/'s per-shop --card-bg-color
 * etc.), since this page mixes products from many shops at once and a
 * patchwork of different shop themes side by side would look inconsistent.
 * One consistent professional look for everyone instead.
 */

:root {
    --mp-primary: #4338ca;
    --mp-accent: #7c3aed;
    --mp-bg: #f8fafc;
    --mp-surface: #ffffff;
    --mp-border: #e2e8f0;
    --mp-text: #0f172a;
    --mp-muted: #64748b;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
}

body.mp-body {
    font-family: "Noto Sans Thai", "Segoe UI", sans-serif;
    background: var(--mp-bg);
    color: var(--mp-text);
}

.mp-header {
    background: linear-gradient(135deg, var(--mp-accent), var(--mp-primary));
    color: #ffffff;
    padding: 36px 20px 44px;
}
.mp-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
}
.mp-logo {
    display: inline-block;
    width: 200px;
    max-width: 70vw;
    height: auto;
    background: #ffffff;
    border-radius: 16px;
    padding: 10px 18px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.22);
    margin-bottom: 16px;
}
.mp-brand {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.85;
    margin-bottom: 10px;
}
.mp-header-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}
.mp-header-subtitle {
    margin: 8px 0 0;
    font-size: 0.9rem;
    opacity: 0.9;
}
.mp-cta {
    display: inline-block;
    margin-top: 18px;
    background: linear-gradient(90deg, #ff7a00, #ff3d68);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    padding: 11px 26px;
    border-radius: 999px;
    box-shadow: 0 6px 16px rgba(255, 61, 104, 0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.mp-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(255, 61, 104, 0.5);
}

/* Shown only when the marketplace has zero products — same palette as the
   default button, plus a slow pulse to draw the eye as the page's one call
   to action. */
.mp-cta-highlight {
    animation: mp-cta-pulse 1.8s ease-in-out infinite;
}
.mp-cta-highlight:hover {
    box-shadow: 0 10px 24px rgba(255, 61, 104, 0.6);
}
@keyframes mp-cta-pulse {
    0%, 100% { box-shadow: 0 6px 16px rgba(255, 61, 104, 0.4); }
    50% { box-shadow: 0 6px 24px rgba(255, 61, 104, 0.85); }
}

/* mp-body is a flex column so the footer sticks to the bottom of the
   viewport on short pages (few/no products) instead of floating mid-page. */
body.mp-body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.mp-main {
    flex: 1;
}

.mp-main {
    max-width: 1100px;
    margin: -24px auto 0;
    padding: 0 20px 60px;
}

/* Floating filter bar — overlaps the gradient header slightly (negative
   margin already pulled .mp-main up), a common "search bar over hero"
   pattern for a more polished, professional feel. */
.mp-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
    background: var(--mp-surface);
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}
.mp-filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.mp-filter-field label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--mp-muted);
}
.mp-filter-field select {
    appearance: none;
    -webkit-appearance: none;
    padding: 9px 32px 9px 12px;
    border: 1px solid var(--mp-border);
    border-radius: 8px;
    font-size: 0.88rem;
    font-family: inherit;
    color: var(--mp-text);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2364748b'/%3E%3C/svg%3E") no-repeat right 12px center;
    min-width: 150px;
    cursor: pointer;
}
.mp-filter-field select:focus {
    outline: none;
    border-color: var(--mp-primary);
    box-shadow: 0 0 0 3px rgba(67, 56, 202, 0.15);
}
.mp-filter-reset {
    align-self: center;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--mp-muted);
    text-decoration: none;
    padding-bottom: 9px;
}
.mp-filter-reset:hover {
    color: var(--mp-primary);
    text-decoration: underline;
}

.mp-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 0.82rem;
    line-height: 1.6;
    margin-bottom: 20px;
}
.mp-disclaimer-icon {
    flex-shrink: 0;
    font-size: 1rem;
}

.mp-empty {
    background: var(--mp-surface);
    border: 1px solid var(--mp-border);
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    color: var(--mp-muted);
}

.mp-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
@media (min-width: 560px) {
    .mp-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 860px) {
    .mp-grid { grid-template-columns: repeat(4, 1fr); }
}

.mp-card {
    display: flex;
    flex-direction: column;
    background: var(--mp-surface);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.mp-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
}

.mp-card-media {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f1f5f9;
}
.mp-card-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.mp-card-image-count {
    position: absolute;
    right: 6px;
    bottom: 6px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 999px;
}
.mp-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mp-muted);
    font-size: 0.75rem;
}

.mp-card-body {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px 12px 12px;
    flex: 1;
}
.mp-card-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.mp-card-game {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--mp-primary);
    background: rgba(67, 56, 202, 0.1);
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mp-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    white-space: nowrap;
}
.mp-badge-available { background: #dcfce7; color: #166534; }
.mp-badge-reserved { background: #fef3c7; color: #92400e; }
.mp-badge-sold { background: #e2e8f0; color: #475569; }

.mp-card-title {
    font-weight: 700;
    font-size: 0.88rem;
    line-height: 1.35;
    color: var(--mp-text);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.mp-card-title:hover {
    color: var(--mp-primary);
}

.mp-card-desc {
    font-size: 0.72rem;
    line-height: 1.4;
    color: #94a3b8;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mp-card-price {
    margin-top: auto;
    padding-top: 4px;
}
.mp-price-main {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--mp-primary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.mp-price-sub {
    font-size: 0.72rem;
    color: var(--mp-muted);
    margin-top: 2px;
}

.mp-shop-link {
    margin-top: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--mp-muted);
    text-decoration: none;
    border-top: 1px solid var(--mp-border);
    padding-top: 8px;
}
.mp-shop-link:hover {
    color: var(--mp-primary);
    text-decoration: underline;
}

.mp-footer {
    border-top: 1px solid var(--mp-border);
    background: var(--mp-surface);
    padding: 28px 20px;
}
.mp-footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
    color: var(--mp-muted);
}
.mp-footer-brand {
    font-weight: 700;
    color: var(--mp-text);
    margin-bottom: 4px;
}
.mp-footer-note {
    font-size: 0.8rem;
    line-height: 1.6;
}
