/* ea-compare.css – styles for EA Live + Backtest comparison page */

/* Threshold inputs in toolbar */
.threshold-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--tb-muted);
    font-size: 0.9rem;
    white-space: nowrap;
}

.threshold-input {
    width: 62px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.72);
    color: var(--tb-text);
    font-size: 0.9rem;
    text-align: center;
}

.threshold-select {
    width: 84px;
}

#compare-shell.compare-loading .section-links,
#compare-shell.compare-loading .section-toggle {
    display: none;
}

#compare-shell:not(.compare-loading) #compare-loading-panel {
    display: none;
}

.compare-loading-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    text-align: center;
}

.compare-loading-copy {
    display: grid;
    gap: 10px;
}

.compare-loading-copy h2 {
    margin: 0;
    font-size: 1.25rem;
}

.compare-loading-copy p {
    margin: 0;
    color: var(--tb-muted);
}

/* Compare card grid inside range-card */
.compare-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    padding: 16px;
}

/* Individual magic comparison card */
.magic-compare-card {
    border-radius: 14px;
    background: rgba(7, 17, 31, 0.44);
    border: 1px solid rgba(255, 255, 255, 0.07);
    overflow: hidden;
}

.magic-compare-card.verdict-match {
    border-color: rgba(94, 234, 212, 0.28);
}

.magic-compare-card.verdict-partial {
    border-color: rgba(251, 191, 36, 0.24);
}

.magic-compare-card.verdict-mismatch {
    border-color: rgba(252, 165, 165, 0.22);
}

/* Card header */
.mcc-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px 10px;
    background: rgba(15, 23, 42, 0.48);
    flex-wrap: wrap;
}

.mcc-magic {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--tb-text);
}

.mcc-verdict {
    font-size: 0.82rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
}

.verdict-match    { color: #5eead4; }
.verdict-partial  { color: #fbbf24; }
.verdict-mismatch { color: #fca5a5; }

.mcc-score {
    margin-left: auto;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(30, 41, 59, 0.72);
}

.mcc-only {
    font-size: 0.8rem;
    color: var(--tb-muted);
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(30, 41, 59, 0.6);
}

/* Score diff rows */
.mcc-scores {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 14px;
    background: rgba(10, 20, 40, 0.34);
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.mcc-score-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(30, 41, 59, 0.5);
}

.mcc-score-row span {
    color: var(--tb-muted);
}

/* Side-by-side columns */
.mcc-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.mcc-col {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
}

.mcc-col + .mcc-col {
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

.mcc-col-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--tb-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.mcc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.mcc-row span {
    color: var(--tb-muted);
    font-size: 0.82rem;
}

.mcc-row strong {
    font-size: 0.84rem;
    text-align: right;
}

.mcc-row strong small {
    color: var(--tb-muted);
    font-weight: 400;
    font-size: 0.75rem;
    margin-left: 3px;
}

.mcc-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tb-muted);
    font-size: 0.82rem;
    min-height: 80px;
    opacity: 0.7;
}

/* Per-trade comparison list */
.mcc-trade-compare {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px 14px 14px;
    background: rgba(7, 17, 31, 0.24);
}

.mcc-trade-compare-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--tb-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.mcc-trade-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow: auto;
}

.mcc-trade-item {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    align-items: center;
    border-radius: 10px;
    padding: 10px;
    background: rgba(15, 23, 42, 0.48);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.mcc-trade-item.matched {
    border-color: rgba(94, 234, 212, 0.18);
}

.mcc-trade-item.ok {
    border-color: rgba(251, 191, 36, 0.24);
}

.mcc-trade-item.unmatched {
    border-color: rgba(252, 165, 165, 0.18);
}

.mcc-trade-side {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mcc-trade-side strong {
    font-size: 0.82rem;
}

.mcc-trade-side span:last-child {
    font-size: 0.82rem;
    font-weight: 700;
}

.mcc-trade-side .mcc-trade-value {
    font-size: 0.82rem;
    font-weight: 700;
}

.mcc-trade-costs {
    font-size: 0.72rem;
    color: var(--tb-muted);
}

.mcc-trade-middle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 0.78rem;
    color: var(--tb-muted);
    text-align: center;
}

.mcc-trade-reason {
    color: #fbbf24;
    font-weight: 600;
}

.mcc-trade-badge {
    display: inline-flex;
    width: fit-content;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}

.mcc-trade-badge.live {
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.14);
}

.mcc-trade-badge.bt {
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.14);
}

/* Colour aliases */
.positive { color: #5eead4; }
.negative { color: #fca5a5; }
.neutral  { color: var(--tb-muted); }

/* Summary chip health variants */
.stat-chip--healthy  { border: 1px solid rgba(94, 234, 212, 0.28); }
.stat-chip--warning  { border: 1px solid rgba(251, 191, 36,  0.28); }
.stat-chip--red-flag { border: 1px solid rgba(252, 165, 165, 0.28); }

.stat-chip--healthy  span, .stat-chip--healthy  strong { color: #5eead4; }
.stat-chip--warning  span, .stat-chip--warning  strong { color: #fbbf24; }
.stat-chip--red-flag span, .stat-chip--red-flag strong { color: #fca5a5; }

/* ── Phase health badge ────────────────────────────────────────────────────── */
.phase-health-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.phase-health-badge--healthy  { color: #5eead4; background: rgba(45, 212, 191, 0.13); }
.phase-health-badge--warning  { color: #fbbf24; background: rgba(251, 191, 36,  0.13); }
.phase-health-badge--red-flag { color: #fca5a5; background: rgba(248, 113, 113, 0.13); }

/* Card header right side */
.phase-card-head-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Red-flag card gets stronger border glow */
.phase-card--flagged {
    border-color: rgba(248, 113, 113, 0.50);
    box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.14);
}

/* ── Health checks list ────────────────────────────────────────────────────── */
.phase-checks {
    list-style: none;
    margin: 0;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(7, 15, 30, 0.28);
}

.phase-check-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.79rem;
}

.phase-check-item.phase-check--red {
    background: rgba(248, 113, 113, 0.10);
    border-left: 2px solid rgba(248, 113, 113, 0.55);
    color: #fca5a5;
}

.phase-check-item.phase-check--warning {
    background: rgba(251, 191, 36, 0.10);
    border-left: 2px solid rgba(251, 191, 36, 0.55);
    color: #fbbf24;
}

.phase-check-label {
    font-weight: 700;
}

.phase-check-detail {
    opacity: 0.78;
    font-size: 0.72rem;
    font-weight: 400;
}

/* ── Deltas row ────────────────────────────────────────────────────────────── */
.phase-deltas {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(10, 20, 40, 0.20);
}

.phase-delta-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    padding: 3px 9px;
    border-radius: 8px;
    background: rgba(30, 41, 59, 0.55);
}

.phase-delta-chip span {
    color: var(--tb-muted);
}

.phase-delta-chip strong {
    font-size: 0.8rem;
}

.phase-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.phase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 14px;
}

.phase-card {
    border-radius: 14px;
    background: rgba(7, 17, 31, 0.44);
    border: 1px solid rgba(255, 255, 255, 0.07);
    overflow: hidden;
}

.phase-card--green {
    border-color: rgba(94, 234, 212, 0.34);
}

.phase-card--orange {
    border-color: rgba(251, 191, 36, 0.34);
}

.phase-card--red {
    border-color: rgba(252, 165, 165, 0.34);
}

.phase-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.48);
}

.phase-card-head strong {
    font-size: 0.92rem;
}

.phase-card-head span {
    color: var(--tb-muted);
    font-size: 0.8rem;
}

.phase-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--tb-muted);
    font-size: 0.78rem;
}

.phase-similarity {
    padding: 7px 12px;
    font-size: 0.78rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.phase-similarity--green {
    color: #5eead4;
    background: rgba(45, 212, 191, 0.12);
}

.phase-similarity--orange {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.12);
}

.phase-similarity--red {
    color: #fca5a5;
    background: rgba(248, 113, 113, 0.12);
}

.phase-similarity--neutral {
    color: var(--tb-muted);
    background: rgba(30, 41, 59, 0.5);
}

.phase-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.phase-col {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.phase-col + .phase-col {
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

.phase-col-title {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.75rem;
    color: var(--tb-muted);
    font-weight: 700;
}

.phase-metric-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.82rem;
}

.phase-metric-row span {
    color: var(--tb-muted);
}

.phase-metric-row strong {
    text-align: right;
}

.phase-empty {
    color: var(--tb-muted);
    font-size: 0.82rem;
}

@media (max-width: 780px) {
    .compare-grid {
        grid-template-columns: 1fr;
    }

    .mcc-columns {
        grid-template-columns: 1fr;
    }

    .mcc-col + .mcc-col {
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    .mcc-trade-item {
        grid-template-columns: 1fr;
    }

    .mcc-trade-middle {
        align-items: flex-start;
        text-align: left;
    }

    .phase-columns {
        grid-template-columns: 1fr;
    }

    .phase-col + .phase-col {
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    .monthly-grid {
        grid-template-columns: 1fr;
    }

    .monthly-table th,
    .monthly-table td {
        padding: 6px 8px;
        font-size: 0.78rem;
    }
}

/* ── Monthly Profits Table ─────────────────────────────────────────────────── */
.monthly-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 16px;
    padding: 4px;
}

.monthly-card {
    border-radius: 14px;
    background: rgba(7, 17, 31, 0.44);
    border: 1px solid rgba(255, 255, 255, 0.07);
    overflow: hidden;
}

.monthly-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(15, 23, 42, 0.48);
    flex-wrap: wrap;
}

.monthly-magic {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--tb-text);
}

.monthly-summary-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.stat-chip--small {
    font-size: 0.75rem;
    padding: 3px 8px;
}

.stat-chip--small span {
    font-size: 0.7rem;
}

.stat-chip--small strong {
    font-size: 0.78rem;
}

.monthly-table-wrap {
    overflow-x: auto;
    max-height: 420px;
    overflow-y: auto;
}

.monthly-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

.monthly-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.monthly-table th {
    padding: 9px 14px;
    text-align: right;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--tb-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(15, 23, 42, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.monthly-table th:first-child {
    text-align: left;
}

.monthly-table td {
    padding: 7px 14px;
    text-align: right;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-variant-numeric: tabular-nums;
}

.monthly-table td:first-child {
    text-align: left;
}

.monthly-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.06);
}

.mp-month {
    color: var(--tb-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.mp-bt {
    color: #c4b5fd;
    font-weight: 600;
}

.mp-live {
    color: #93c5fd;
    font-weight: 600;
}

.mp-diff {
    font-weight: 600;
}

.mp-avg-row {
    background: rgba(15, 23, 42, 0.58);
    border-top: 2px solid rgba(255, 255, 255, 0.12);
}

.mp-avg-row td {
    padding-top: 10px;
    padding-bottom: 10px;
}
