.marketplace-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    max-width: 1400px;
    margin: 80px auto 24px;
    padding: 0 20px;
    min-height: calc(100vh - 160px);
}

.marketplace-sidebar {
    position: sticky;
    top: 80px;
    align-self: start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    height: fit-content;
}

.filter-group {
    margin-bottom: 14px;
}

.filter-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.filter-group input,
.filter-group select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 8px 10px;
    font-size: 0.85rem;
    outline: none;
}

.filter-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.marketplace-main {
    min-width: 0;
}

.marketplace-header {
    margin-bottom: 20px;
}

.marketplace-header h1 {
    margin: 0 0 6px;
    font-size: 1.6rem;
}

.marketplace-header p {
    margin: 0 0 14px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.marketplace-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#status-msg {
    font-size: 0.85rem;
    margin-bottom: 14px;
    min-height: 1.4em;
}

#status-msg.error { color: var(--error); }
#status-msg.success { color: var(--success); }

.asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}

.asset-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.asset-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
}

.asset-preview {
    width: 100%;
    height: 140px;
    object-fit: cover;
    background: var(--bg);
    display: block;
}

.asset-info {
    padding: 12px;
}

.asset-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asset-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.badge {
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 12px;
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.badge.official {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    border-color: rgba(59, 130, 246, 0.3);
}

.badge.price {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.3);
}

.asset-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination button {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.pagination button.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-body {
    padding: 18px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 14px;
}

.detail-preview {
    width: 100%;
    max-height: 260px;
    object-fit: contain;
    background: var(--bg);
    border-radius: 8px;
    margin-bottom: 14px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-muted);
}

.detail-value {
    color: var(--text);
    font-weight: 500;
    text-align: right;
    max-width: 60%;
}

@media (max-width: 900px) {
    .marketplace-layout {
        grid-template-columns: 1fr;
        margin-top: 72px;
    }
    .marketplace-sidebar {
        position: static;
    }
}

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