/* ============================================================
   PineScriptLab Marketplace
   Supplemental styles only.

   Index + detail intentionally reuse the /scripts visual system:
   - header / wrapper
   - section
   - card-v / card-no-hover
   - trading-strategy-card
   - scripts-grid
   - script-detail-section
   - item-single-preview
   - nav-tabs-purple
   - script-info-list

   Do not recreate those components here.
   ============================================================ */

.marketplace-header .wrapper-content {
    min-height: inherit;
}

.marketplace-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.8rem 0 1rem;
}

.marketplace-card-tags > span {
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    opacity: 0.78;
    padding: 0.28rem 0.55rem;
}

.marketplace-detail-description {
    max-width: 760px;
}

.marketplace-item-preview .item-single-img {
    align-items: center;
    display: flex;
    justify-content: center;
    max-height: 480px;
    overflow: hidden;
}

.marketplace-item-preview .item-single-img img {
    height: auto;
    max-height: 480px;
    object-fit: contain;
    width: 100%;
}

.marketplace-preview-placeholder {
    min-height: 280px;
}

.marketplace-preview-placeholder i {
    font-size: 3rem;
}

.marketplace-screenshot-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.marketplace-screenshot-link {
    border-radius: 8px;
    display: block;
    min-width: 0;
    overflow: hidden;
}

.marketplace-screenshot-link img {
    aspect-ratio: 16 / 9;
    display: block;
    object-fit: cover;
    width: 100%;
}

.marketplace-feature-card {
    height: 100%;
}

/*
 * Task 490 wrapper is intentionally neutral inside the existing
 * script-tabs-card. The surrounding card-v supplies the surface/border.
 */
.marketplace-tabs-card .public-bot-tabs-panel {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
}

.marketplace-tabs-card .public-bot-tabs {
    margin-bottom: 1rem;
}

.marketplace-tabs-card .public-bot-tabs-content {
    min-width: 0;
}

/* Public-safe Positions table remains Marketplace-specific. */
.public-bot-tab-heading {
    align-items: flex-start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.public-bot-tab-heading h3 {
    font-size: 1rem;
    margin: 0 0 0.25rem;
}

.public-bot-tab-heading p {
    margin: 0;
}

.public-bot-tab-heading > span {
    border-radius: 999px;
    flex: 0 0 auto;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.35rem 0.6rem;
}

.public-bot-table-scroll {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.public-bot-data-table {
    border-collapse: collapse;
    min-width: 680px;
    width: 100%;
}

.public-bot-data-table th,
.public-bot-data-table td {
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    padding: 0.75rem;
    text-align: left;
    vertical-align: middle;
}

.public-bot-data-table th {
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
}

.public-bot-data-table td {
    font-size: 0.82rem;
}

.public-bot-data-table td strong,
.public-bot-data-table td small {
    display: block;
}

.public-bot-data-table td small {
    font-size: 0.7rem;
    margin-top: 0.2rem;
    opacity: 0.72;
}

.public-bot-direction {
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 0.3rem 0.55rem;
}

.public-bot-direction.is-long {
    background: rgba(34, 197, 94, 0.14);
    color: #22c55e;
}

.public-bot-direction.is-short {
    background: rgba(244, 63, 94, 0.14);
    color: #f43f5e;
}

.is-profit {
    color: #22c55e !important;
}

.is-loss {
    color: #f43f5e !important;
}

/* Match the existing /scripts light-mode surfaces instead of maintaining
   a separate Marketplace theme. Only Marketplace-specific helpers need
   explicit light-mode values here. */
html[data-theme="light"] .marketplace-card-tags > span {
    color: var(--ui-text-secondary, #667085);
}

html[data-theme="light"] .public-bot-data-table {
    color: var(--ui-text, #1f2937);
}

html[data-theme="light"] .public-bot-data-table th,
html[data-theme="light"] .public-bot-data-table td {
    border-bottom-color: var(--ui-border, #deddd8);
}

html[data-theme="light"] .public-bot-data-table th {
    color: var(--ui-text-secondary, #667085);
}

html[data-theme="light"] .public-bot-tab-heading p,
html[data-theme="light"] .public-bot-data-table td small {
    color: var(--ui-text-secondary, #667085);
}

@media (max-width: 767.98px) {
    .marketplace-screenshot-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .public-bot-tab-heading {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 575.98px) {
    .marketplace-screenshot-grid {
        grid-template-columns: 1fr;
    }

    .marketplace-tabs-card {
        padding: 1rem !important;
    }
}

/* Marketplace index: compact /scripts card adapter */
/*
 * Marketplace intentionally reuses the /scripts trading-strategy-card
 * component. This adapter only constrains Marketplace-specific density so
 * the preview cannot consume the full card and hide the content below it.
 */
.marketplace-index-section .scripts-grid {
    align-items: stretch;
}

.marketplace-index-section .public-bot-script-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    margin-bottom: 0;
    min-width: 0;
}

.marketplace-index-section .public-bot-script-card .strategy-chart-preview {
    display: block;
    flex: 0 0 160px;
    height: 160px !important;
    max-height: 160px !important;
    min-height: 160px !important;
    overflow: hidden;
    text-decoration: none;
}

.marketplace-index-section .public-bot-script-card .strategy-chart-preview .chart-image,
.marketplace-index-section .public-bot-script-card .strategy-chart-preview .chart-placeholder {
    display: flex;
    height: 100% !important;
    max-height: 160px !important;
    min-height: 0 !important;
    width: 100%;
}

.marketplace-index-section .public-bot-script-card .strategy-chart-preview .chart-image {
    object-fit: cover;
}

.marketplace-index-section .public-bot-script-card .strategy-chart-preview .chart-placeholder {
    align-items: center;
    flex-direction: column;
    justify-content: center;
}

.marketplace-index-section .public-bot-script-card .strategy-info {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    padding: 1.25rem;
}

.marketplace-index-section .public-bot-script-card .strategy-title {
    font-size: 1.05rem;
    line-height: 1.35;
    margin-bottom: 0.55rem;
    min-height: 0;
}

.marketplace-index-section .public-bot-script-card .strategy-title-link {
    color: inherit;
    overflow-wrap: anywhere;
    text-decoration: none;
}

.marketplace-index-section .public-bot-script-card .strategy-disclaimer {
    font-size: 0.78rem;
    line-height: 1.45;
    margin-bottom: 0.8rem;
    min-height: 0;
    padding: 0.65rem;
}

.marketplace-index-section .public-bot-script-card .performance-metrics {
    margin-bottom: 0.8rem;
}

.marketplace-index-section .public-bot-script-card .metrics-row {
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.marketplace-index-section .public-bot-script-card .performance-metrics .metric-card {
    min-width: 0;
    padding: 0.65rem;
}

.marketplace-index-section .public-bot-script-card .performance-metrics .metric-card-content {
    min-height: 42px;
}

.marketplace-index-section .public-bot-script-card .performance-metrics .metric-label {
    font-size: 0.68rem;
}

.marketplace-index-section .public-bot-script-card .performance-metrics .metric-value {
    font-size: 1rem;
}

.marketplace-index-section .public-bot-script-card .marketplace-card-tags {
    margin-bottom: 0.8rem;
}

.marketplace-index-section .public-bot-script-card .strategy-actions {
    margin-top: auto !important;
}

.marketplace-index-section .public-bot-script-card .strategy-actions .btn {
    min-height: 40px;
}

@media (max-width: 575.98px) {
    .marketplace-index-section .public-bot-script-card .strategy-chart-preview {
        flex-basis: 150px;
        height: 150px !important;
        max-height: 150px !important;
        min-height: 150px !important;
    }

    .marketplace-index-section .public-bot-script-card .strategy-chart-preview .chart-image,
    .marketplace-index-section .public-bot-script-card .strategy-chart-preview .chart-placeholder {
        max-height: 150px !important;
    }

    .marketplace-index-section .public-bot-script-card .strategy-info {
        padding: 1rem;
    }
}
/* End Marketplace index compact /scripts card adapter */

/* Marketplace Positions: explicit light-mode cell contrast */
/*
 * The Marketplace detail page now uses .marketplace-detail-page after
 * adopting the /scripts detail structure. Explicitly color table cells
 * because global/script table rules can override inherited table color.
 */
html[data-theme="light"] .marketplace-detail-page .public-bot-data-table {
    color: var(--ui-text, #1f2937) !important;
}

html[data-theme="light"] .marketplace-detail-page .public-bot-data-table thead th {
    background: var(--ui-surface-subtle, #f7f6f3) !important;
    border-bottom-color: var(--ui-border, #deddd8) !important;
    color: var(--ui-text-secondary, #667085) !important;
}

html[data-theme="light"] .marketplace-detail-page .public-bot-data-table tbody td {
    background: transparent !important;
    border-bottom-color: var(--ui-border, #deddd8) !important;
    color: var(--ui-text, #1f2937) !important;
}

/* Trade number was the most visible regression. */
html[data-theme="light"] .marketplace-detail-page .public-bot-data-table tbody td:first-child {
    color: var(--ui-text, #1f2937) !important;
    font-weight: 700;
}

html[data-theme="light"] .marketplace-detail-page .public-bot-data-table tbody td strong {
    color: var(--ui-text, #1f2937) !important;
}

html[data-theme="light"] .marketplace-detail-page .public-bot-data-table tbody td small {
    color: var(--ui-text-secondary, #667085) !important;
    opacity: 1;
}

html[data-theme="light"] .marketplace-detail-page .public-bot-data-table tbody tr:hover td {
    background: var(--ui-surface-hover, #f7f6f3) !important;
}

/* Preserve semantic P&L colors after the stronger cell rule above. */
html[data-theme="light"] .marketplace-detail-page .public-bot-data-table tbody td.is-profit {
    color: #16a34a !important;
}

html[data-theme="light"] .marketplace-detail-page .public-bot-data-table tbody td.is-loss {
    color: #ef4444 !important;
}

/* Keep Long / Short pills readable in light mode. */
html[data-theme="light"] .marketplace-detail-page .public-bot-direction.is-long {
    background: #dcfce7 !important;
    color: #16a34a !important;
}

html[data-theme="light"] .marketplace-detail-page .public-bot-direction.is-short {
    background: #ffe4e6 !important;
    color: #e11d48 !important;
}
/* End Marketplace Positions light-mode cell contrast */

/* Marketplace Positions header contrast fix
   The /scripts-style Marketplace wrapper does not always define the older
   --pb-* color variables. Keep the Positions heading and table headers
   readable in both theme modes with scoped explicit fallbacks. */
html:not([data-theme="light"]) #marketplace-positions-pane .public-bot-tab-heading h3 {
    color: #f8fafc !important;
}

html:not([data-theme="light"]) #marketplace-positions-pane .public-bot-tab-heading p {
    color: #b8b2c7 !important;
    opacity: 1 !important;
}

html:not([data-theme="light"]) #marketplace-positions-pane .public-bot-tab-heading > span {
    background: rgba(139, 92, 246, 0.16) !important;
    border: 1px solid rgba(167, 139, 250, 0.32) !important;
    color: #e9e5ff !important;
    opacity: 1 !important;
}

html:not([data-theme="light"]) #marketplace-positions-pane .public-bot-data-table thead th {
    color: #f1eef9 !important;
    opacity: 1 !important;
}

html[data-theme="light"] #marketplace-positions-pane .public-bot-tab-heading h3 {
    color: var(--ui-text, #1f2937) !important;
}

html[data-theme="light"] #marketplace-positions-pane .public-bot-tab-heading p {
    color: var(--ui-text-secondary, #667085) !important;
    opacity: 1 !important;
}

html[data-theme="light"] #marketplace-positions-pane .public-bot-tab-heading > span {
    background: #f3efff !important;
    border: 1px solid #ddd2ff !important;
    color: #6d28d9 !important;
    opacity: 1 !important;
}

html[data-theme="light"] #marketplace-positions-pane .public-bot-data-table thead th {
    color: var(--ui-text, #1f2937) !important;
    opacity: 1 !important;
}
/* End Marketplace Positions header contrast fix */

/* Marketplace Positions comfortable light-mode typography */
html[data-theme="light"] #marketplace-positions-pane {
    --marketplace-position-heading: #344054;
    --marketplace-position-text: #475467;
    --marketplace-position-muted: #667085;
}

html[data-theme="light"] #marketplace-positions-pane .public-bot-tab-heading h3 {
    color: var(--marketplace-position-heading) !important;
    font-weight: 600;
}

html[data-theme="light"] #marketplace-positions-pane .public-bot-data-table thead th {
    color: var(--marketplace-position-text) !important;
    font-weight: 700;
}

html[data-theme="light"] #marketplace-positions-pane .public-bot-data-table tbody td {
    color: var(--marketplace-position-text) !important;
    font-weight: 400;
}

html[data-theme="light"] #marketplace-positions-pane .public-bot-data-table tbody td:first-child,
html[data-theme="light"] #marketplace-positions-pane .public-bot-data-table tbody td strong {
    color: var(--marketplace-position-heading) !important;
    font-weight: 600;
}

html[data-theme="light"] #marketplace-positions-pane .public-bot-data-table tbody td small {
    color: var(--marketplace-position-muted) !important;
    font-weight: 400;
}

html[data-theme="light"] #marketplace-positions-pane .public-bot-data-table tbody td.is-profit {
    color: #16a34a !important;
}

html[data-theme="light"] #marketplace-positions-pane .public-bot-data-table tbody td.is-loss {
    color: #ef4444 !important;
}
/* End Marketplace Positions comfortable light-mode typography */

/* Marketplace open-position unrealized P&L semantic color */
html[data-theme="light"] #marketplace-positions-pane .marketplace-open-position-table tbody td.is-profit > small:first-of-type {
    color: #16a34a !important;
}

html[data-theme="light"] #marketplace-positions-pane .marketplace-open-position-table tbody td.is-loss > small:first-of-type {
    color: #ef4444 !important;
}
/* End Marketplace open-position unrealized P&L semantic color */

/* Marketplace open-position dark-mode status hierarchy */
html:not([data-theme="light"]) #marketplace-positions-pane .marketplace-open-position-table tbody td.is-profit > strong,
html:not([data-theme="light"]) #marketplace-positions-pane .marketplace-open-position-table tbody td.is-loss > strong {
    color: #f1eef9 !important;
}

html:not([data-theme="light"]) #marketplace-positions-pane .marketplace-open-position-table tbody td.is-profit > small:first-of-type {
    color: #22c55e !important;
}

html:not([data-theme="light"]) #marketplace-positions-pane .marketplace-open-position-table tbody td.is-loss > small:first-of-type {
    color: #f43f5e !important;
}

html:not([data-theme="light"]) #marketplace-positions-pane .marketplace-open-position-table tbody td.is-profit > small:not(:first-of-type),
html:not([data-theme="light"]) #marketplace-positions-pane .marketplace-open-position-table tbody td.is-loss > small:not(:first-of-type) {
    color: #b8b2c7 !important;
}
/* End Marketplace open-position dark-mode status hierarchy */

/* Marketplace public Copiers tab: privacy-safe presentation */
/* Marketplace Copiers theme v2 */
#marketplace-copiers-pane {
    --marketplace-copier-heading: #f5f3ff;
    --marketplace-copier-text: #e7e2f0;
    --marketplace-copier-muted: #b8b2c7;
    --marketplace-copier-surface: #120d20;
    --marketplace-copier-surface-raised: #191329;
    --marketplace-copier-surface-hover: #201733;
    --marketplace-copier-border: rgba(167, 139, 250, 0.22);
    --marketplace-copier-border-soft: rgba(148, 163, 184, 0.18);
    --marketplace-copier-accent: #a78bfa;
    --marketplace-copier-accent-strong: #8b5cf6;
    --marketplace-copier-accent-soft: rgba(139, 92, 246, 0.16);
    --marketplace-copier-table-head: #1d1530;
    color: var(--marketplace-copier-text);
}

html[data-theme="light"] #marketplace-copiers-pane {
    --marketplace-copier-heading: #344054;
    --marketplace-copier-text: #475467;
    --marketplace-copier-muted: #667085;
    --marketplace-copier-surface: #ffffff;
    --marketplace-copier-surface-raised: #f8f7f4;
    --marketplace-copier-surface-hover: #f3f1ed;
    --marketplace-copier-border: #ddd2ff;
    --marketplace-copier-border-soft: #deddd8;
    --marketplace-copier-accent: #7c3aed;
    --marketplace-copier-accent-strong: #6d28d9;
    --marketplace-copier-accent-soft: #f3efff;
    --marketplace-copier-table-head: #f7f6f3;
}

#marketplace-copiers-pane .public-bot-tab-heading {
    align-items: center;
    margin-bottom: 1.25rem;
}

#marketplace-copiers-pane .public-bot-tab-heading h3 {
    color: var(--marketplace-copier-heading) !important;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.35;
}

#marketplace-copiers-pane .public-bot-tab-heading p {
    color: var(--marketplace-copier-muted) !important;
    line-height: 1.55;
    opacity: 1 !important;
}

#marketplace-copiers-pane .public-bot-tab-heading > span {
    background: var(--marketplace-copier-accent-soft) !important;
    border: 1px solid var(--marketplace-copier-border) !important;
    color: var(--marketplace-copier-accent) !important;
    opacity: 1 !important;
}

#marketplace-copiers-pane .public-copiers-summary {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

#marketplace-copiers-pane .public-copiers-summary-badge,
#marketplace-copiers-pane .public-copiers-summary-pnl {
    background: var(--marketplace-copier-accent-soft);
    border: 1px solid var(--marketplace-copier-border);
    border-radius: 999px;
    color: var(--marketplace-copier-accent);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.4rem 0.7rem;
}

#marketplace-copiers-pane .public-copiers-summary-pnl {
    align-items: center;
    display: inline-flex;
    gap: 0.35rem;
}

#marketplace-copiers-pane .public-copiers-summary-pnl small {
    color: var(--marketplace-copier-muted);
    font-size: inherit;
}

#marketplace-copiers-pane .public-copiers-table {
    color: var(--marketplace-copier-text) !important;
    min-width: 560px;
}

#marketplace-copiers-pane .public-copiers-table thead th {
    background: var(--marketplace-copier-table-head) !important;
    border-bottom-color: var(--marketplace-copier-border) !important;
    color: var(--marketplace-copier-heading) !important;
    opacity: 1 !important;
}

#marketplace-copiers-pane .public-copiers-table tbody td {
    background: var(--marketplace-copier-surface) !important;
    border-bottom-color: var(--marketplace-copier-border-soft) !important;
    color: var(--marketplace-copier-text) !important;
}

#marketplace-copiers-pane .public-copiers-table tbody tr:hover td {
    background: var(--marketplace-copier-surface-hover) !important;
}

#marketplace-copiers-pane .public-copiers-table td strong {
    color: var(--marketplace-copier-heading) !important;
    font-weight: 700;
}

#marketplace-copiers-pane .public-copiers-table td small {
    color: var(--marketplace-copier-muted) !important;
    opacity: 1 !important;
}

.public-copier-identity {
    align-items: center;
    display: flex;
    gap: 0.7rem;
}

#marketplace-copiers-pane .public-copier-avatar {
    align-items: center;
    background: var(--marketplace-copier-accent-soft);
    border: 1px solid var(--marketplace-copier-border);
    border-radius: 50%;
    color: var(--marketplace-copier-accent);
    display: inline-flex;
    flex: 0 0 2.25rem;
    height: 2.25rem;
    justify-content: center;
    width: 2.25rem;
}

/* Marketplace Copiers Positions-style empty state v1 */
#marketplace-copiers-pane .public-copiers-state {
    align-items: center;
    background: var(--marketplace-copier-surface-raised);
    border: 1px solid var(--marketplace-copier-border-soft);
    border-radius: 0.75rem;
    color: var(--marketplace-copier-muted) !important;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    justify-content: center;
    min-height: 180px;
    padding: 1.75rem;
    text-align: center;
}

#marketplace-copiers-pane .public-copiers-state > i {
    color: var(--marketplace-copier-accent);
    font-size: 1.5rem;
}

#marketplace-copiers-pane .public-copiers-state > strong {
    color: var(--marketplace-copier-heading) !important;
}

#marketplace-copiers-pane .public-copiers-state.is-error > strong {
    color: #f43f5e !important;
}

#marketplace-copiers-pane .public-copiers-empty {
    align-items: center;
    background: #1d1433;
    border: 1px solid rgba(167, 139, 250, 0.08);
    border-radius: 0.75rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 180px;
    padding: 1.75rem 1.25rem;
    text-align: center;
}

#marketplace-copiers-pane .public-copiers-empty-icon {
    align-items: center;
    background: rgba(56, 189, 248, 0.14);
    border: 0;
    border-radius: 0.65rem;
    color: #67e8f9;
    display: inline-flex;
    font-size: 1.35rem;
    height: 3.25rem;
    justify-content: center;
    margin-bottom: 0.9rem;
    width: 3.25rem;
}

#marketplace-copiers-pane .public-copiers-empty h4 {
    color: #f1eef9 !important;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 0.55rem;
}

#marketplace-copiers-pane .public-copiers-empty p {
    color: #b8b2c7 !important;
    font-size: 0.9rem;
    line-height: 1.55;
    margin: 0;
    max-width: 520px;
    opacity: 1 !important;
}

html[data-theme="light"] #marketplace-copiers-pane .public-copiers-empty {
    background: #f5f3f8;
    border-color: #e4dfec;
}

html[data-theme="light"] #marketplace-copiers-pane .public-copiers-empty-icon {
    background: #e7f0fb;
    color: #2563eb;
}

html[data-theme="light"] #marketplace-copiers-pane .public-copiers-empty h4 {
    color: #475467 !important;
}

html[data-theme="light"] #marketplace-copiers-pane .public-copiers-empty p {
    color: #667085 !important;
}

#marketplace-copiers-pane [data-public-copiers-load-more] {
    border-color: var(--marketplace-copier-border) !important;
    color: var(--marketplace-copier-accent) !important;
}

#marketplace-copiers-pane [data-public-copiers-load-more]:hover,
#marketplace-copiers-pane [data-public-copiers-load-more]:focus-visible {
    background: var(--marketplace-copier-accent-strong) !important;
    border-color: var(--marketplace-copier-accent-strong) !important;
    color: #ffffff !important;
}

@media (max-width: 575.98px) {
    #marketplace-copiers-pane .public-bot-tab-heading {
        align-items: flex-start;
    }

    #marketplace-copiers-pane .public-copiers-summary {
        justify-content: flex-start;
    }

    #marketplace-copiers-pane .public-copiers-empty {
        min-height: 240px;
        padding: 1.75rem 1rem;
    }

    #marketplace-copiers-pane .public-copiers-empty-icon {
        height: 3.25rem;
        width: 3.25rem;
    }
}
/* End Marketplace public Copiers tab */

/* Marketplace Copiers runtime asset sync v1 */

/* Marketplace detail description light-theme readability */
html[data-theme="light"] .marketplace-detail-page .marketplace-detail-description,
html[data-theme="light"] .marketplace-detail-page #marketplace-overview-pane .description-section .item-single-paragraph,
html[data-theme="light"] .marketplace-detail-page #marketplace-overview-pane .description-section .item-single-paragraph p,
html[data-theme="light"] .marketplace-detail-page #marketplace-overview-pane .description-section .item-single-paragraph li,
html[data-theme="light"] .marketplace-detail-page #marketplace-overview-pane .description-section .item-single-paragraph span,
html[data-theme="light"] .marketplace-detail-page #marketplace-overview-pane .description-section .item-single-paragraph em,
html[data-theme="light"] .marketplace-detail-page #marketplace-overview-pane .description-section .item-single-paragraph blockquote {
    color: var(--ui-text-secondary, #293548) !important;
}

html[data-theme="light"] .marketplace-detail-page #marketplace-overview-pane .description-section .item-single-paragraph :is(
    strong,
    b,
    h1,
    h2,
    h3,
    h4,
    h5,
    h6
) {
    color: var(--ui-text, #111827) !important;
}

html[data-theme="light"] .marketplace-detail-page #marketplace-overview-pane .description-section .item-single-paragraph a {
    color: var(--ui-link, #6d28d9);
}

/* MARKETPLACE_LANDING_PARITY_LIGHT_V1
 *
 * Marketplace-only light mode.
 * Reuses the same role tokens as the landing/home page instead of inventing
 * another white/black palette. This block is intentionally scoped to
 * Marketplace roots and is loaded through public-bots.css only.
 */
html[data-theme="light"] :is(
    .marketplace-header,
    .marketplace-header + .section,
    .marketplace-index-section,
    .marketplace-detail-page
) {
    --marketplace-light-canvas: var(--ui-canvas, #f3f2ef);
    --marketplace-light-canvas-alt: var(--ui-canvas-alt, #ecebe7);
    --marketplace-light-surface: var(--ui-surface, #faf9f6);
    --marketplace-light-surface-subtle: var(--ui-surface-subtle, #f5f4f0);
    --marketplace-light-surface-raised: var(--ui-surface-raised, #fdfcf9);
    --marketplace-light-surface-hover: var(--ui-surface-hover, #efeee9);
    --marketplace-light-text: var(--ui-text, #111827);
    --marketplace-light-text-secondary: var(--ui-text-secondary, #293548);
    --marketplace-light-text-muted: var(--ui-text-muted, #374151);
    --marketplace-light-border: var(--ui-border, #deddd8);
    --marketplace-light-border-strong: var(--ui-border-strong, #cac8c1);
    --marketplace-light-divider: var(--ui-divider, #e7e5df);
    --marketplace-light-brand: var(--ui-link, #5b4fd9);
    --marketplace-light-brand-soft: var(--ui-brand-soft, #f0ecff);
    --marketplace-light-success: var(--ui-success, #18794e);
    --marketplace-light-danger: var(--ui-danger, #c2413b);
    --marketplace-light-shadow-xs: var(--ui-shadow-xs, 0 1px 2px rgba(16, 24, 40, 0.04));
    --marketplace-light-shadow-sm: var(--ui-shadow-sm, 0 4px 14px rgba(16, 24, 40, 0.055));

    background: var(--marketplace-light-canvas);
    color: var(--marketplace-light-text);
}

/* Page header: match the landing hero's calm canvas + strong title hierarchy. */
html[data-theme="light"] .marketplace-header {
    border-bottom: 1px solid var(--marketplace-light-divider);
    box-shadow: none;
}

html[data-theme="light"] .marketplace-header .title {
    color: var(--marketplace-light-text) !important;
}

html[data-theme="light"] .marketplace-header .text-muted {
    color: var(--marketplace-light-text-secondary) !important;
    opacity: 1 !important;
}

/* Filter card + generic Marketplace cards use the same landing surfaces. */
html[data-theme="light"] .marketplace-header + .section .card-v,
html[data-theme="light"] .marketplace-detail-page .card-v {
    background: var(--marketplace-light-surface) !important;
    border-color: var(--marketplace-light-border) !important;
    box-shadow: var(--marketplace-light-shadow-xs) !important;
    color: var(--marketplace-light-text) !important;
}

html[data-theme="light"] .marketplace-header + .section .card-v:hover,
html[data-theme="light"] .marketplace-detail-page .card-v:hover {
    background: var(--marketplace-light-surface) !important;
    border-color: var(--marketplace-light-border-strong) !important;
    box-shadow: var(--marketplace-light-shadow-sm) !important;
    transform: none !important;
}

html[data-theme="light"] .marketplace-header + .section .form-label {
    color: var(--marketplace-light-text-secondary) !important;
    font-weight: 600;
}

/* Marketplace index cards: landing-card surface, border and restrained shadow. */
html[data-theme="light"] .marketplace-index-section .public-bot-script-card {
    background: var(--marketplace-light-surface) !important;
    border: 1px solid var(--marketplace-light-border) !important;
    box-shadow: var(--marketplace-light-shadow-xs) !important;
    color: var(--marketplace-light-text) !important;
}

html[data-theme="light"] .marketplace-index-section .public-bot-script-card:hover {
    background: var(--marketplace-light-surface) !important;
    border-color: var(--marketplace-light-border-strong) !important;
    box-shadow: var(--marketplace-light-shadow-sm) !important;
    transform: none !important;
}

html[data-theme="light"] .marketplace-index-section .public-bot-script-card .strategy-info {
    background: var(--marketplace-light-surface) !important;
    color: var(--marketplace-light-text) !important;
}

html[data-theme="light"] .marketplace-index-section .public-bot-script-card :is(
    .strategy-title,
    .strategy-title-link,
    .metric-value,
    .detail-value,
    .detail-value-enhanced
) {
    color: var(--marketplace-light-text) !important;
}

html[data-theme="light"] .marketplace-index-section .public-bot-script-card :is(
    .strategy-disclaimer,
    .strategy-disclaimer span,
    .metric-label,
    .metric-unit,
    .detail-label
) {
    color: var(--marketplace-light-text-secondary) !important;
    opacity: 1 !important;
}

html[data-theme="light"] .marketplace-index-section .public-bot-script-card .strategy-disclaimer {
    background: var(--marketplace-light-surface-subtle) !important;
    border: 1px solid var(--marketplace-light-divider) !important;
}

html[data-theme="light"] .marketplace-index-section .public-bot-script-card .metric-card {
    background: var(--marketplace-light-surface-subtle) !important;
    border-color: var(--marketplace-light-border) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .marketplace-index-section .marketplace-card-tags > span {
    background: var(--marketplace-light-canvas-alt);
    border-color: var(--marketplace-light-border);
    color: var(--marketplace-light-text-secondary) !important;
    opacity: 1;
}

/* Detail header: remove legacy purple-tinted light header and use landing hierarchy. */
html[data-theme="light"] .marketplace-detail-page .section-header {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

html[data-theme="light"] .marketplace-detail-page :is(
    .item-single-title,
    .section-header h1,
    .section-header h2,
    .card-v h5,
    .public-bot-tab-heading h3
) {
    color: var(--marketplace-light-text) !important;
}

html[data-theme="light"] .marketplace-detail-page :is(
    .breadcrumb-item,
    .breadcrumb-item.active,
    .marketplace-detail-description,
    .text-muted
) {
    color: var(--marketplace-light-text-secondary) !important;
    opacity: 1 !important;
}

html[data-theme="light"] .marketplace-detail-page .breadcrumb-item a {
    color: var(--marketplace-light-brand) !important;
}

/* Rich description: use the same normal text tone as Marketplace light mode. */
html[data-theme="light"] .marketplace-detail-page :is(
    .description-section,
    .item-single-paragraph,
    .item-single-paragraph p,
    .item-single-paragraph span,
    .item-single-paragraph li,
    .item-single-paragraph em,
    .item-single-paragraph blockquote,
    .backtesting-content,
    .backtesting-content p
) {
    color: var(--marketplace-light-text) !important;
    opacity: 1 !important;
}

html[data-theme="light"] .marketplace-detail-page .item-single-paragraph :is(
    strong,
    b,
    h1,
    h2,
    h3,
    h4,
    h5,
    h6
) {
    color: var(--marketplace-light-text) !important;
}

/* Detail tabs + information cards use landing's subtle layer system. */
html[data-theme="light"] .marketplace-detail-page .nav-tabs-purple {
    border-bottom-color: var(--marketplace-light-divider) !important;
}

html[data-theme="light"] .marketplace-detail-page .nav-tabs-purple .nav-link {
    color: var(--marketplace-light-text-secondary) !important;
}

html[data-theme="light"] .marketplace-detail-page .nav-tabs-purple .nav-link:hover {
    background: var(--marketplace-light-surface-hover) !important;
    color: var(--marketplace-light-brand) !important;
}

html[data-theme="light"] .marketplace-detail-page .nav-tabs-purple .nav-link.active {
    background: var(--marketplace-light-brand-soft) !important;
    border-bottom-color: var(--marketplace-light-brand) !important;
    color: var(--marketplace-light-brand) !important;
}

html[data-theme="light"] .marketplace-detail-page :is(
    .quick-info-section,
    .performance-metrics .metric-card
) {
    background: var(--marketplace-light-surface-subtle) !important;
    border-color: var(--marketplace-light-border) !important;
    box-shadow: none !important;
}

html[data-theme="light"] .marketplace-detail-page :is(
    .quick-info-card,
    .feature-card
) {
    background: var(--marketplace-light-surface) !important;
    border-color: var(--marketplace-light-border) !important;
    box-shadow: none !important;
    color: var(--marketplace-light-text) !important;
}

html[data-theme="light"] .marketplace-detail-page :is(
    .quick-info-label,
    .feature-text,
    .script-info-label
) {
    color: var(--marketplace-light-text-secondary) !important;
}

html[data-theme="light"] .marketplace-detail-page :is(
    .quick-info-value,
    .script-info-value
) {
    color: var(--marketplace-light-text) !important;
}

html[data-theme="light"] .marketplace-detail-page .script-info-item {
    border-bottom-color: var(--marketplace-light-divider) !important;
}

/* Positions/Copiers tables: one calm surface hierarchy, semantic P&L retained. */
html[data-theme="light"] .marketplace-detail-page .public-bot-data-table {
    background: var(--marketplace-light-surface) !important;
    color: var(--marketplace-light-text-secondary) !important;
}

html[data-theme="light"] .marketplace-detail-page .public-bot-data-table thead th {
    background: var(--marketplace-light-surface-subtle) !important;
    border-bottom-color: var(--marketplace-light-border) !important;
    color: var(--marketplace-light-text-secondary) !important;
}

html[data-theme="light"] .marketplace-detail-page .public-bot-data-table tbody td {
    background: var(--marketplace-light-surface) !important;
    border-bottom-color: var(--marketplace-light-divider) !important;
    color: var(--marketplace-light-text-secondary) !important;
}

html[data-theme="light"] .marketplace-detail-page .public-bot-data-table tbody tr:hover td {
    background: var(--marketplace-light-surface-hover) !important;
}

html[data-theme="light"] .marketplace-detail-page .public-bot-data-table tbody td :is(strong, b),
html[data-theme="light"] .marketplace-detail-page .public-bot-data-table tbody td:first-child {
    color: var(--marketplace-light-text) !important;
}

html[data-theme="light"] .marketplace-detail-page .public-bot-data-table tbody td small {
    color: var(--marketplace-light-text-muted) !important;
    opacity: 1 !important;
}

html[data-theme="light"] .marketplace-detail-page :is(.is-profit, .public-bot-data-table td.is-profit) {
    color: var(--marketplace-light-success) !important;
}

html[data-theme="light"] .marketplace-detail-page :is(.is-loss, .public-bot-data-table td.is-loss) {
    color: var(--marketplace-light-danger) !important;
}

/* Copiers tab inherits the same landing palette instead of its own white theme. */
html[data-theme="light"] #marketplace-copiers-pane {
    --marketplace-copier-heading: var(--marketplace-light-text);
    --marketplace-copier-text: var(--marketplace-light-text-secondary);
    --marketplace-copier-muted: var(--marketplace-light-text-muted);
    --marketplace-copier-surface: var(--marketplace-light-surface);
    --marketplace-copier-surface-raised: var(--marketplace-light-surface-subtle);
    --marketplace-copier-surface-hover: var(--marketplace-light-surface-hover);
    --marketplace-copier-border: var(--marketplace-light-border);
    --marketplace-copier-border-soft: var(--marketplace-light-divider);
    --marketplace-copier-accent: var(--marketplace-light-brand);
    --marketplace-copier-accent-strong: var(--marketplace-light-brand);
    --marketplace-copier-accent-soft: var(--marketplace-light-brand-soft);
    --marketplace-copier-table-head: var(--marketplace-light-surface-subtle);
}

html[data-theme="light"] #marketplace-copiers-pane :is(
    .public-copiers-state,
    .public-copiers-empty
) {
    background: var(--marketplace-light-surface-subtle) !important;
    border-color: var(--marketplace-light-border) !important;
}

html[data-theme="light"] #marketplace-copiers-pane .public-copiers-empty-icon {
    background: var(--marketplace-light-brand-soft) !important;
    color: var(--marketplace-light-brand) !important;
}

html[data-theme="light"] #marketplace-copiers-pane .public-copiers-empty h4 {
    color: var(--marketplace-light-text) !important;
}

html[data-theme="light"] #marketplace-copiers-pane .public-copiers-empty p {
    color: var(--marketplace-light-text-secondary) !important;
}

/* Preview/placeholder neutral layers. */
html[data-theme="light"] .marketplace-detail-page :is(
    .item-single-preview,
    .marketplace-preview-placeholder
) {
    background: var(--marketplace-light-surface-subtle) !important;
    color: var(--marketplace-light-text-secondary) !important;
}

html[data-theme="light"] .marketplace-detail-page .marketplace-preview-placeholder .placeholder-text {
    color: var(--marketplace-light-text-secondary) !important;
    opacity: 1 !important;
}
