/* MIP-006R-09D — Gainers/Losers table visibility enhancement */

/* Apply only to the four local-market performance tables. */
.mip-table-section[data-table-group="premier_market_top_gainers"],
.mip-table-section[data-table-group="main_market_top_gainers"],
.mip-table-section[data-table-group="premier_market_top_losers"],
.mip-table-section[data-table-group="main_market_top_losers"] {
    overflow: hidden;
    border: 1px solid #cfded6;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(19, 50, 38, 0.10);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.mip-table-section[data-table-group="premier_market_top_gainers"]:hover,
.mip-table-section[data-table-group="main_market_top_gainers"]:hover,
.mip-table-section[data-table-group="premier_market_top_losers"]:hover,
.mip-table-section[data-table-group="main_market_top_losers"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(19, 50, 38, 0.14);
}

/* Strong section title bands. */
.mip-table-section[data-table-group$="top_gainers"] .mip-table-section-header,
.mip-table-section[data-table-group$="top_losers"] .mip-table-section-header {
    min-height: 48px;
    margin: 0;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid transparent;
}

.mip-table-section[data-table-group$="top_gainers"] .mip-table-section-header {
    color: #005f37;
    background: linear-gradient(135deg, #e5f6ed 0%, #f4fbf7 100%);
    border-bottom-color: #b8dfca;
    box-shadow: inset 5px 0 0 #00864a;
}

.mip-table-section[data-table-group$="top_losers"] .mip-table-section-header {
    color: #9f1d16;
    background: linear-gradient(135deg, #fde9e7 0%, #fff7f6 100%);
    border-bottom-color: #efc7c3;
    box-shadow: inset 5px 0 0 #c82118;
}

html[dir="rtl"] .mip-table-section[data-table-group$="top_gainers"] .mip-table-section-header,
html[dir="rtl"] .mip-table-section[data-table-group$="top_losers"] .mip-table-section-header {
    box-shadow: inset -5px 0 0 currentColor;
}

.mip-table-section[data-table-group$="top_gainers"] .mip-table-section-header h4,
.mip-table-section[data-table-group$="top_losers"] .mip-table-section-header h4 {
    margin: 0;
    font-size: 15px;
    line-height: 1.35;
    font-weight: 800;
    letter-spacing: .01em;
}

.mip-table-section[data-table-group$="top_gainers"] .mip-table-section-header h4::before {
    content: "▲";
    margin-inline-end: 7px;
    font-size: 11px;
}

.mip-table-section[data-table-group$="top_losers"] .mip-table-section-header h4::before {
    content: "▼";
    margin-inline-end: 7px;
    font-size: 11px;
}

.mip-table-section[data-table-group$="top_gainers"] .mip-table-section-header > span,
.mip-table-section[data-table-group$="top_losers"] .mip-table-section-header > span {
    flex: 0 0 auto;
    padding: 5px 9px;
    border: 1px solid currentColor;
    border-radius: 999px;
    background: rgba(255,255,255,.72);
    color: inherit;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

/* Keep the table neatly inside the card. */
.mip-table-section[data-table-group$="top_gainers"] .mip-table-scroll,
.mip-table-section[data-table-group$="top_losers"] .mip-table-scroll {
    border: 0;
    border-radius: 0;
    background: #fff;
}

/* Corporate column-header band. */
.mip-table-section[data-table-group$="top_gainers"] .mip-market-table thead th,
.mip-table-section[data-table-group$="top_losers"] .mip-market-table thead th {
    padding-top: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #174c3b;
    background: #0b4635;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .045em;
    text-transform: uppercase;
}

.mip-table-section[data-table-group$="top_gainers"] .mip-sort-button,
.mip-table-section[data-table-group$="top_losers"] .mip-sort-button {
    color: inherit;
    font-weight: inherit;
}

.mip-table-section[data-table-group$="top_gainers"] .mip-sort-indicator,
.mip-table-section[data-table-group$="top_losers"] .mip-sort-indicator {
    color: #a8d9c3;
}

/* Readable zebra rows and hover state. */
.mip-table-section[data-table-group$="top_gainers"] .mip-market-table tbody tr:nth-child(even) td,
.mip-table-section[data-table-group$="top_losers"] .mip-market-table tbody tr:nth-child(even) td {
    background: #f7faf8;
}

.mip-table-section[data-table-group$="top_gainers"] .mip-market-table tbody tr:hover td,
.mip-table-section[data-table-group$="top_losers"] .mip-market-table tbody tr:hover td {
    background: #eef7f2;
}

.mip-table-section[data-table-group$="top_gainers"] .mip-market-table td,
.mip-table-section[data-table-group$="top_losers"] .mip-market-table td {
    padding-top: 12px;
    padding-bottom: 12px;
    border-bottom-color: #e3ebe7;
}

.mip-table-section[data-table-group$="top_gainers"] .mip-market-table td:first-child,
.mip-table-section[data-table-group$="top_losers"] .mip-market-table td:first-child {
    color: #102a22;
    font-weight: 750;
}

/* Performance badges. */
.mip-table-section[data-table-group$="top_gainers"] .mip-market-table td.mip-positive,
.mip-table-section[data-table-group$="top_losers"] .mip-market-table td.mip-negative {
    width: 1%;
    white-space: nowrap;
    font-weight: 850;
}

.mip-table-section[data-table-group$="top_gainers"] .mip-market-table td.mip-positive {
    color: #007a43;
}

.mip-table-section[data-table-group$="top_losers"] .mip-market-table td.mip-negative {
    color: #c21d14;
}

.mip-table-section[data-table-group$="top_gainers"] .mip-market-table td.mip-positive::before,
.mip-table-section[data-table-group$="top_losers"] .mip-market-table td.mip-negative::before {
    display: inline-block;
    margin-inline-end: 5px;
    font-size: 9px;
}

.mip-table-section[data-table-group$="top_gainers"] .mip-market-table td.mip-positive::before { content: "▲"; }
.mip-table-section[data-table-group$="top_losers"] .mip-market-table td.mip-negative::before { content: "▼"; }

/* Better separation between Premier and Main rows. */
.mip-table-pair-row {
    gap: 24px;
    margin-top: 24px;
}

@media (max-width: 1180px) {
    .mip-table-pair-row { gap: 18px; }
}

@media (max-width: 680px) {
    .mip-table-section[data-table-group$="top_gainers"] .mip-table-section-header,
    .mip-table-section[data-table-group$="top_losers"] .mip-table-section-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media print {
    .mip-table-section[data-table-group$="top_gainers"],
    .mip-table-section[data-table-group$="top_losers"] {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none;
        transform: none;
        border: 1px solid #9eb3aa;
    }

    .mip-table-section[data-table-group$="top_gainers"] .mip-table-section-header,
    .mip-table-section[data-table-group$="top_losers"] .mip-table-section-header {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .mip-table-section[data-table-group$="top_gainers"] .mip-market-table thead th,
    .mip-table-section[data-table-group$="top_losers"] .mip-market-table thead th {
        background: #0b4635 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
