/* Market page (/market) look: facelift Milestone 3. Every rule is scoped to .fp-market, the page's container
   (stock_page.layout), so no other page changes. Colors follow the newslive digest cards: page #101419,
   card #161a21, hairline #29303a, text #eef1f5 / #b6bec9 / #8f99a7, blue #3d93e4, teal up #1aa7b0,
   pink down #f2557a. Font: IBM Plex Sans (assets/vendor/plex). */

.fp-market {
    background: #101419;
    color: #eef1f5;
    font-family: 'IBM Plex Sans', 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    min-height: 100vh;
}

/* the three grids: card surface, hairlines, selection in the raised blue-gray, rounded corners */
.fp-market .ag-theme-alpine-dark {
    --ag-font-family: 'IBM Plex Sans', 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --ag-background-color: #161a21;
    --ag-odd-row-background-color: #161a21;
    --ag-header-background-color: #161a21;
    --ag-header-foreground-color: #b6bec9;
    --ag-foreground-color: #eef1f5;
    --ag-secondary-foreground-color: #8f99a7;
    --ag-border-color: #29303a;
    --ag-row-border-color: #222831;
    --ag-header-column-separator-color: #29303a;
    --ag-header-column-resize-handle-color: #3a434f;
    --ag-selected-row-background-color: #233954;   /* a clear blue, well apart from the hover gray */
    --ag-row-hover-color: #1b222c;
    --ag-input-focus-border-color: #3d93e4;
    --ag-range-selection-border-color: #3d93e4;
    --ag-checkbox-checked-color: #3d93e4;
    --ag-control-panel-background-color: #1b222c;
    --ag-wrapper-border-radius: 10px;
}
/* selected rows: besides the blue row tint, a blue bar on the left edge (over the pinned first column) and the
   row's name in bright semibold, so selection still reads where a cell is tinted (the factor table's ret).
   ag-grid paints the row tint on ::before; ::after on rows is only its row-drag marker, unused here. */
.fp-market .ag-pinned-left-cols-container .ag-row-selected::after {
    content: "";
    position: absolute;
    left: 0; top: 1px; bottom: 1px;
    width: 3px;
    border-radius: 0 2px 2px 0;
    background: #3d93e4;
    pointer-events: none;
}
.fp-market .ag-row-selected .ag-cell[col-id="fct"],
.fp-market .ag-row-selected .ag-cell[col-id="sym"] { color: #ffffff; font-weight: 600; }

/* cells drawn on the card: rings and dots sit on the card color */
.fp-market #live-fct1 .fp-zg-dot { box-shadow: 0 0 0 1.5px #161a21; }
.fp-market #live-fct1 .fp-zg-dot.big { box-shadow: 0 0 0 1.5px #161a21, 0 0 7px 2px currentColor; }

/* tabs (Mantine): quiet labels, the active one in full text color with a blue underline. The tabs carry an
   inline color and the site-wide rules use !important, so these do too. */
.fp-market .mantine-Tabs-list::before { border-color: #29303a; }
.fp-market .mantine-Tabs-tab { color: #b6bec9 !important; background: transparent !important; font-weight: 500; }
.fp-market .mantine-Tabs-tab:hover { background: #1b222c !important; color: #eef1f5 !important; }
.fp-market .mantine-Tabs-tab[data-active="true"] {
    background: transparent !important;
    color: #eef1f5 !important;
    border-bottom-color: #3d93e4 !important;
}

/* the chart tabs sit on a near-black card (darker than the table cards: lines read sharper on it); its height
   follows its content (the tab strip + the 50vh panel), which the row's min-height already leaves room for */
.fp-market #right-tabs {
    background: #0e1115;
    border: 1px solid #29303a;
    border-radius: 10px;
    height: auto !important;
    padding-bottom: 10px;
}

/* Plotly draws its own dark backgrounds (plotly_dark); let the chart card show through instead */
.fp-market .js-plotly-plot .main-svg { background: transparent !important; }
.fp-market .js-plotly-plot .bglayer .bg { fill: transparent !important; }

/* screen buttons as pills. Top-quartile picks turn blue, bottom-quartile picks amber; the label already says
   which ("High Beta" / "Low Beta"). The live screens (Volume, Return, Earnings) keep a blue-gray edge. */
.fp-market .fp-screens .btn {
    border-radius: 999px !important;
    border: 1px solid #29303a !important;
    background: transparent !important;
    color: #b6bec9 !important;
    font-size: 13px;
    padding: 3px 12px;
    box-shadow: none !important;
}
.fp-market .fp-screens .btn.btn-outline-info { border-color: #34506b !important; }
.fp-market .fp-screens .btn:hover { border-color: #4a5563 !important; color: #eef1f5 !important; }
.fp-market .fp-screens .btn.active { background: #1f2a38 !important; color: #eef1f5 !important; border-color: #3d93e4 !important; }
.fp-market .fp-screens .btn.btn-outline-warning.active { border-color: #c98300 !important; }
.fp-market .fp-screens .btn:focus-visible { outline: 2px solid #3d93e4; outline-offset: 1px; }

/* stock table: return in parts (RetParts in dashAgGridComponentFunctions.js) */
.fp-market .fp-rp { position: relative; height: 12px; margin-top: 4px; }
.fp-market .fp-rp i { position: absolute; top: 2px; height: 8px; display: block; }
.fp-market .fp-rp .fp-rp-c0 { top: 0; bottom: 0; height: auto; left: 50%; width: 1px; background: #586271; }
.fp-market .fp-rp .fp-rp-ring { top: 1px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%;
    border: 1.5px solid #eef1f5; background: transparent; box-sizing: border-box; }

/* phones: the ETF table's tighter cell padding (as the 13F funds table) so values and headers fit 80px columns */
@media (max-width: 767.98px) {
    .fp-market #etfinfo-grid { --ag-cell-horizontal-padding: 8px; }
}

/* desktop: the factor table gets 40% of the width (Bootstrap's md=4 gave it a third), the charts 60%; and the
   table runs the full height of the chart card beside it (it was a fixed 50vh starting 20px lower, so it ended
   ~50px short): both columns size to the row, which the chart card sets */
@media (min-width: 768px) {
    .fp-market .fct-col { flex: 0 0 40%; max-width: 40%; height: auto !important; margin-top: 0 !important; margin-bottom: 0 !important; }
    .fp-market .charts-col { flex: 0 0 60%; max-width: 60%; height: auto !important; margin-bottom: 0 !important; }
    .fp-market #right-tabs { margin-bottom: 0 !important; }
}
