/* ==========================================================================
   css/v2/graphics.css - the "big chart" page (/control/graphics/<ticker> and
   /control/trading/{index,sector,segment}/graphics/<ticker>).

   Everything structural comes from base.css (.market_card, .v2chart,
   .scroll_hint) and issue.css (.issue_head, .issue_periods). This file only
   adds what the full width chart needs on top of the sidebar sized one.
   ========================================================================== */

body.v2 .issue_graph > .heading { margin-bottom: 14px; }

/* uPlot sizes itself from the box width, so the box just needs room to breathe
   and a floor: an empty series must not collapse the card. */
body.v2 .v2chart_big { min-height: 200px; }
body.v2 .v2chart_big.v2chart_empty { min-height: 120px; }

body.v2 .v2chart_big .u-legend { font-size: 15px; }

/* The period bar is the only control the page still has, so it is bigger than
   the sidebar variant. On narrow screens it scrolls sideways inside
   .scroll_hint instead of wrapping into three ragged rows. */
body.v2 .graph_periods_wrap { margin-top: 16px; }

body.v2 .graph_periods {
    margin-top: 0;
    gap: 6px;
}

body.v2 .graph_periods a {
    padding: 8px 16px;
    font-size: 15px;
}

/* The big chart's periods are submit buttons of the "graphics" form (they post
   timePeriod without javascript), dressed as the period links of issue.css. */
body.v2 .graph_periods button {
    margin: 0;
    padding: 8px 16px;
    border: 1px solid #dfe7f0;
    border-radius: 999px;
    background: #fff;
    color: #1e4280;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
}

body.v2 .graph_periods button:hover { background: #f0f3f6; border-color: #b9c9de; }

body.v2 .graph_periods a.is_on,
body.v2 .graph_periods button.is_on {
    background: #1e4280;
    border-color: #1e4280;
    color: #fff;
}

body.v2 .graph_periods a.is_on:hover,
body.v2 .graph_periods button.is_on:hover { background: #1e4280; border-color: #1e4280; }

/* The form's first submit button, the one Enter in a text field presses (see
   graphics_v2.jsp). Out of sight, but not display:none. */
body.v2 .graph_form .graph_enter {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

/* The from / to / draw row under the period bar (the dp_* fields come from
   datepicker.css, the button from markets.css). */
body.v2 .graph_dates {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-top: 14px;
}

body.v2 .graph_date {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

body.v2 .graph_date_lbl {
    font-size: 15px;
    font-weight: 600;
    color: #5b6675;
    white-space: nowrap;
}

body.v2 .graph_dates .btn_action { min-height: 40px; }

/* The chart options under the date row: type, values, scale, volume, compare,
   moving averages (and the other funds on a pension fund). Each group is a
   fieldset; the groups wrap into as many columns as the card has room for. */
body.v2 .graph_opts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 18px;
}

body.v2 .graph_opt {
    min-width: 0;
    margin: 0;
    padding: 10px 12px 12px;
    border: 1px solid #dfe7f0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

body.v2 .graph_opt legend {
    padding: 0 4px;
    font-size: 13px;
    font-weight: 700;
    color: #5b6675;
    text-transform: uppercase;
    letter-spacing: .02em;
}

body.v2 .graph_opt legend .graph_chk { text-transform: none; letter-spacing: 0; }

body.v2 .graph_opt_compare,
body.v2 .graph_opt_ma { grid-column: span 2; }

body.v2 .graph_opt_pf {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 6px 14px;
}

body.v2 .graph_chk {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #1f2733;
    cursor: pointer;
}

body.v2 .graph_chk input { margin: 0; flex: none; }

body.v2 .graph_chk_all { font-weight: 600; }

body.v2 .graph_opt_lbl {
    font-size: 13px;
    font-weight: 600;
    color: #5b6675;
}

body.v2 .graph_input {
    height: 34px;
    padding: 0 10px;
    border: 1px solid #cdd6e2;
    border-radius: 6px;
    background: #fff;
    color: #1f2733;
    font: inherit;
    font-size: 14px;
    min-width: 0;
}

body.v2 .graph_input_num { width: 64px; text-align: right; }

/* the compared issue: the suggestion box (base.css) hangs under the field */
body.v2 .graph_issue {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
}

body.v2 .graph_ma {
    display: flex;
    align-items: center;
    gap: 8px;
}

body.v2 .graph_ma .graph_opt_lbl { width: 12px; }

body.v2 .graph_ma select.graph_input { flex: 1 1 auto; }

body.v2 .graph_submit { margin-top: 14px; text-align: right; }

body.v2 .graph_submit .btn_action { min-height: 40px; }

/* The volume panel under the price (drawVolumeBars in charts.js): a readout
   line with the lots / euro switch, then the bars. */
body.v2 .v2chart_vol { margin-top: 10px; }

body.v2 .v2chart_voltools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 0 4px;
    font-size: 13px;
    color: #5b6675;
    font-variant-numeric: tabular-nums;
}

body.v2 .v2chart_volread { min-height: 18px; }

body.v2 .v2chart_volunit {
    display: inline-flex;
    flex: none;
    border: 1px solid #cfd9e6;
    border-radius: 4px;
    overflow: hidden;
}

body.v2 .v2chart_volunit button {
    margin: 0;
    padding: 3px 10px;
    border: 0;
    background: #fff;
    color: #1e4280;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

body.v2 .v2chart_volunit button + button { border-left: 1px solid #cfd9e6; }

body.v2 .v2chart_volunit button.is_on { background: #1e4280; color: #fff; cursor: default; }

@media (max-width: 700px) {
    body.v2 .graph_periods_wrap > .graph_periods {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        padding-bottom: 2px;
    }

    body.v2 .graph_periods_wrap > .graph_periods::-webkit-scrollbar { display: none; }

    body.v2 .graph_periods a,
    body.v2 .graph_periods button { padding: 8px 14px; }

    body.v2 .graph_opt_compare,
    body.v2 .graph_opt_ma { grid-column: 1 / -1; }
}

/* .issue_tabs (issue.css) is a nowrap flex row that only becomes a scroller at
   640px, so between 641px and ~950px the tab strip pushes the page wider than
   the viewport. Scoped to this page here rather than patched in issue.css,
   which other pages share. */
@media (max-width: 1000px) {
    body.v2.page-graphics .issue_tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    body.v2.page-graphics .issue_tabs::-webkit-scrollbar { display: none; }
}

/* .issue_live (issue.css) is a nowrap flex badge sized "flex: 0 0 auto". An
   index carries a four digit value and a long timestamp, which is wider than a
   phone viewport, so on this page it is allowed to take its own row and wrap. */
@media (max-width: 640px) {
    body.v2.page-graphics .issue_live {
        flex: 1 1 100%;
        min-width: 0;
        flex-wrap: wrap;
        gap: 6px 10px;
    }
}
