/* =========================================================
   WOI V2 — MARKET OVERVIEW
   Canonical stylesheet
   No patch/override sections.
   Responsive variants are intentional, not debt.
   ========================================================= */


/* =========================================================
   1. PAGE
   ========================================================= */

.v2-market-overview-page {
    width: 100%;
    box-sizing: border-box;
}

.v2-page-header {
    padding: 22px 18px 10px;
}

.v2-page-header h1 {
    margin: 0;
    color: #f2f5f8;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.v2-page-header p {
    margin: 4px 0 0;
    color: #8b97a7;
    font-size: 12px;
}


/* =========================================================
   2. SHARED PANELS
   ========================================================= */

.v2-market-panel {
    margin: 0 18px 10px;
    min-width: 0;
    border: 1px solid #252e39;
    border-radius: 7px;
    background: #0d131b;
}

.v2-market-panel-head {
    min-height: 52px;
    padding: 11px 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid #222b35;
}

.v2-market-panel-head h2 {
    margin: 0;
    color: #e9edf2;
    font-size: 13px;
    font-weight: 650;
}

.v2-market-panel-head p {
    margin: 3px 0 0;
    color: #748091;
    font-size: 10px;
}

.v2-market-loading,
.v2-market-empty {
    width: 100%;
    min-height: 150px;
    display: grid;
    place-items: center;
    color: #778393;
    font-size: 11px;
}

.v2-empty-state {
    padding: 24px 12px;
    color: #718196;
    font-size: 11px;
}

.positive {
    color: #35bd72;
}

.negative {
    color: #e35b63;
}

.v2-positive {
    color: #2bd98b;
}

.v2-negative {
    color: #ff5f68;
}

.v2-neutral {
    color: #94a3b5;
}


/* =========================================================
   3. HEATMAP
   ========================================================= */

.v2-heatmap-summary {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    color: #778393;
    font-size: 9px;
}

.v2-market-heatmap {
    padding: 6px;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 3px;
}

.v2-market-heatmap.v2-market-heatmap--treemap {
    position: relative;
    display: block;
    height: 548px;
    padding: 2px;
    overflow: hidden;
}

.v2-heatmap-sector {
    min-width: 180px;
    flex: 1 1 220px;
    border: 1px solid #202833;
    background: #0b1118;
    overflow: hidden;
}

.v2-market-heatmap--treemap .v2-heatmap-sector {
    position: absolute;
    min-width: 0;
    flex: none;
    padding: 2px;
    display: flex;
    flex-direction: column;
    border: 0;
    background: transparent;
}

.v2-market-heatmap--treemap .v2-heatmap-sector::before {
    content: "";
    position: absolute;
    inset: 2px;
    border: 1px solid #202833;
    background: #0b1118;
    pointer-events: none;
}

.v2-market-heatmap--treemap .v2-heatmap-sector-head,
.v2-market-heatmap--treemap .v2-heatmap-sector-grid {
    position: relative;
    z-index: 1;
    margin-left: 2px;
    margin-right: 2px;
}

.v2-market-heatmap--treemap .v2-heatmap-sector-head {
    flex: 0 0 auto;
}

.v2-market-heatmap--treemap .v2-heatmap-sector-grid {
    flex: 1 1 auto;
    min-height: 0;
    align-content: stretch;
}

.v2-heatmap-sector-head {
    min-height: 38px;
    padding: 6px 8px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid #1d2530;
}

.v2-heatmap-sector-name {
    color: #c9d1da;
    font-size: 11px;
    font-weight: 650;
    text-transform: uppercase;
}

.v2-heatmap-breadth {
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
    color: #8794a5;
    font-size: 9px;
}

.v2-heatmap-breadth-track {
    width: 48px;
    height: 3px;
    margin-left: 4px;
    overflow: hidden;
    background: #341d24;
}

.v2-heatmap-breadth-fill {
    display: block;
    height: 100%;
    background: #23794c;
}

.v2-heatmap-sector-change {
    white-space: nowrap;
    font-size: 11px;
    font-weight: 650;
}

.v2-heatmap-sector-grid {
    min-height: 0;
    padding: 2px;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

.v2-heatmap-tile {
    min-width: 52px;
    min-height: 38px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 2px;
    color: #eef2f4;
    cursor: pointer;
    font: inherit;
}

.v2-heatmap-tile strong {
    font-size: 11px;
    font-weight: 650;
}

.v2-heatmap-tile span {
    margin-top: 2px;
    font-size: 10px;
}

.v2-heatmap-tile.g5 {
    background: #145b38;
}

.v2-heatmap-tile.g2 {
    background: #174a31;
}

.v2-heatmap-tile.g1 {
    background: #193a2a;
}

.v2-heatmap-tile.r5 {
    background: #6a2329;
}

.v2-heatmap-tile.r2 {
    background: #55242a;
}

.v2-heatmap-tile.r1 {
    background: #3f2428;
}

.v2-heatmap-tile.neutral {
    background: #202832;
}

.v2-heatmap-tile:hover {
    outline: 1px solid #5f6b78;
    outline-offset: -1px;
}


/* =========================================================
   4. MAJOR INDICES + MOVERS
   ========================================================= */

.v2-market-secondary-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    gap: 10px;
    margin: 0 18px 10px;
    min-width: 0;
}

.v2-indices-panel,
.v2-movers-panel {
    min-width: 0;
    margin: 0;
}

.v2-major-indices {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.v2-index-row {
    min-width: 0;
    padding: 12px;
    border-right: 1px solid #26313d;
    cursor: pointer;
}

.v2-index-row:hover {
    background: #111c2b;
}

.v2-index-row:hover .v2-index-label {
    color: #c4b5fd;
}

.v2-index-row:last-child {
    border-right: 0;
}

.v2-index-label {
    margin-bottom: 6px;
    color: #dce5ef;
    font-size: 14px;
    font-weight: 600;
}

.v2-index-values {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.v2-index-price {
    color: #f2f5f8;
    font-size: 19px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.v2-index-change,
.v2-mover-change {
    font-variant-numeric: tabular-nums;
}

.v2-index-spark {
    width: 100%;
    height: 34px;
    margin-top: 9px;
}

.v2-index-spark svg {
    width: 100%;
    height: 100%;
    display: block;
}

.v2-movers-tabs {
    display: flex;
    gap: 18px;
    padding: 0 12px;
    overflow-x: auto;
    border-bottom: 1px solid #26313d;
}

.v2-movers-tab {
    appearance: none;
    padding: 9px 0 8px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: #8fa0b3;
    font: inherit;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
}

.v2-movers-tab:hover {
    color: #dce5ef;
}

.v2-movers-tab.is-active {
    border-bottom-color: #8b5cf6;
    color: #d9caff;
}

.v2-market-movers {
    min-height: 190px;
}

.v2-mover-row {
    min-height: 42px;
    padding: 0 12px;
    display: grid;
    grid-template-columns: minmax(115px, 1fr) 82px 58px 72px;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.055);
    cursor: pointer;
}

.v2-mover-row:hover {
    background: #111c2b;
}

.v2-mover-row:hover .v2-mover-symbol {
    color: #c4b5fd;
    text-decoration-color: currentColor;
}

.v2-mover-row:last-child {
    border-bottom: 0;
}

.v2-mover-identity {
    min-width: 0;
}

.v2-mover-symbol {
    color: #edf3f8;
    font-size: 13px;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: rgba(139, 92, 246, .55);
    text-underline-offset: 2px;
}

.v2-mover-name {
    margin-top: 2px;
    overflow: hidden;
    color: #9aa8b8;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.v2-mover-price,
.v2-mover-change {
    text-align: right;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.v2-mover-spark {
    width: 64px;
    height: 22px;
    justify-self: end;
}


/* =========================================================
   5. SECTOR PERFORMANCE
   ========================================================= */

.v2-sector-performance-panel {
    margin-top: 0;
}

.v2-sector-performance {
    padding: 4px 12px 8px;
}

.v2-sector-row {
    min-height: 32px;
    display: grid;
    grid-template-columns: 150px minmax(120px, 1fr) 72px 74px;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.v2-sector-row:last-child {
    border-bottom: 0;
}

.v2-sector-name {
    color: #dce5ef;
    font-size: 12px;
    font-weight: 600;
}

.v2-sector-bar-wrap {
    height: 5px;
    overflow: hidden;
    background: #1d2530;
}

.v2-sector-bar {
    height: 100%;
}

.v2-sector-positive {
    color: #2bd98b;
}

.v2-sector-negative {
    color: #ff5f68;
}

.v2-sector-neutral {
    color: #94a3b5;
}

.v2-sector-bar.v2-sector-positive {
    background: #2a8f63;
}

.v2-sector-bar.v2-sector-negative {
    background: #a34149;
}

.v2-sector-bar.v2-sector-neutral {
    background: #596677;
}

.v2-sector-value {
    text-align: right;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.v2-sector-meta {
    text-align: right;
    color: #6f7d8f;
    font-size: 9px;
    font-variant-numeric: tabular-nums;
}


/* =========================================================
   6. TABLET
   ========================================================= */

@media (min-width: 769px) and (max-width: 1179px) {
    .v2-market-secondary-grid {
        grid-template-columns: 1fr 1fr;
    }

    .v2-market-heatmap {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .v2-heatmap-sector {
        min-width: 0;
    }
}


/* =========================================================
   7. DESKTOP — APPROVED MARKET OVERVIEW COMPOSITION
   ========================================================= */

@media (min-width: 1180px) {
    .v2-market-overview-page {
        display: grid;
        grid-template-columns:
            minmax(0, 1.38fr)
            minmax(420px, 0.92fr);
        grid-template-rows: auto auto auto;
        gap: 10px;
        padding: 0 18px 24px;
    }

    .v2-market-overview-page > .v2-page-header {
        grid-column: 1 / -1;
        grid-row: 1;
        padding: 20px 0 0;
    }

    .v2-market-overview-page > .v2-market-panel:first-of-type {
        grid-column: 1;
        grid-row: 2;
        margin: 0;
        height: 100%;
    }

    .v2-market-secondary-grid {
        grid-column: 2;
        grid-row: 2;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .v2-indices-panel,
    .v2-movers-panel {
        width: 100%;
    }

    .v2-movers-panel {
        flex: 1 1 auto;
    }

    .v2-major-indices {
        display: block;
    }

    .v2-index-row {
        min-height: 39px;
        padding: 7px 11px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        border-right: 0;
        border-bottom: 1px solid rgba(255,255,255,0.055);
    }

    .v2-index-row:last-child {
        border-bottom: 0;
    }

    .v2-index-label {
        margin: 0;
        font-size: 12px;
    }

    .v2-index-values {
        display: grid;
        grid-template-columns: 92px 60px;
        align-items: center;
        gap: 10px;
    }

    .v2-index-price {
        text-align: right;
        font-size: 13px;
    }

    .v2-index-change {
        text-align: right;
        font-size: 12px;
    }

    .v2-index-spark {
        display: none;
    }

    .v2-market-movers {
        min-height: 0;
    }

    .v2-mover-row {
        min-height: 35px;
        grid-template-columns:
            minmax(130px, 1fr)
            76px
            55px
            64px;
        padding-left: 11px;
        padding-right: 11px;
    }

    .v2-mover-symbol {
        font-size: 10px;
    }

    .v2-mover-name {
        font-size: 10px;
    }

    .v2-mover-price,
    .v2-mover-change {
        font-size: 11px;
    }

    .v2-market-heatmap {
        display: flex;
        flex-wrap: wrap;
        align-items: stretch;
        gap: 3px;
        padding: 6px;
    }

    .v2-heatmap-sector {
        min-width: 180px;
        width: auto;
    }

    .v2-sector-performance-panel {
        grid-column: 1;
        grid-row: 3;
        margin: 0;
    }

    .v2-sector-performance {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 24px;
        padding: 4px 11px 8px;
    }

    .v2-sector-row {
        grid-template-columns: 120px minmax(70px, 1fr) 58px;
        gap: 8px;
        min-height: 28px;
    }

    .v2-sector-name {
        font-size: 11px;
    }

    .v2-sector-bar-wrap {
        height: 4px;
    }

    .v2-sector-value {
        font-size: 11px;
    }

    .v2-sector-meta {
        display: none;
    }
}


/* =========================================================
   8. MOBILE
   ========================================================= */

@media (max-width: 768px) {
    .v2-page-header {
        padding: 16px 12px 8px;
    }

    .v2-market-panel {
        margin-left: 12px;
        margin-right: 12px;
    }

    .v2-market-panel-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .v2-heatmap-summary {
        justify-content: flex-start;
    }

    .v2-market-heatmap {
        display: block;
        padding: 7px;
    }

    .v2-heatmap-sector {
        min-width: 100%;
        margin-bottom: 6px;
    }

    .v2-market-secondary-grid {
        display: block;
        margin-left: 12px;
        margin-right: 12px;
    }

    .v2-indices-panel,
    .v2-movers-panel {
        margin-bottom: 10px;
    }

    .v2-major-indices {
        grid-template-columns: 1fr;
    }

    .v2-index-row {
        border-right: 0;
        border-bottom: 1px solid #26313d;
    }

    .v2-index-row:last-child {
        border-bottom: 0;
    }

    .v2-index-label {
        font-size: 14px;
    }

    .v2-index-price {
        font-size: 15px;
    }

    .v2-index-change {
        font-size: 14px;
    }

    .v2-mover-symbol {
        font-size: 13px;
    }

    .v2-mover-name {
        font-size: 12px;
    }

    .v2-mover-price,
    .v2-mover-change {
        font-size: 13px;
    }

    .v2-sector-name {
        font-size: 12px;
    }

    .v2-sector-value {
        font-size: 12px;
    }

    .v2-mover-row {
        grid-template-columns:
            minmax(90px, 1fr)
            70px
            54px
            58px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .v2-sector-performance {
        display: block;
    }

    .v2-sector-row {
        grid-template-columns: 110px minmax(80px, 1fr) 60px;
    }

    .v2-sector-meta {
        display: none;
    }
}

/* Market Overview Top Movers watchlist action */
.v2-mover-symbol-line {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.v2-overview-watchlist-star {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #6f7a8d;
    font: inherit;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition:
        color 120ms ease,
        opacity 120ms ease,
        transform 120ms ease;
}

.v2-overview-watchlist-star:hover {
    color: #c4b5fd;
}

.v2-overview-watchlist-star.is-active {
    color: #a78bfa;
}

.v2-overview-watchlist-star:disabled {
    opacity: 0.45;
    cursor: default;
}

.v2-overview-watchlist-star:not(:disabled):active {
    transform: scale(0.9);
}
