﻿/* options.css — Options tab (EW2027). First slice: the option-activity chart.
   Colours use ew-theme tokens; the green/red call-put palette echoes EW2023. */

.opt-section {
    margin: 22px 0;
}

.opt-section-title {
    font-size: 18px;
    font-weight: 800;
    margin: 0 0 4px;
    color: var(--text);
}

.opt-section-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 12px;
}

.opt-empty {
    font-size: 14px;
    color: var(--text-muted);
    padding: 24px;
    text-align: center;
}

/* ---- option-activity chart ---- */
/* transparent background: the page shows through the chart */
.opt-wm {
    opacity: 0.9;
}

.opt-grid {
    stroke: var(--border);
    stroke-width: 1;
    opacity: 0.5;
}

.opt-ylabel, .opt-xlabel {
    font-size: 11px;
    fill: var(--text-muted);
}

.opt-xtick {
    stroke: var(--text-muted);
    stroke-width: 1;
    opacity: 0.6;
}

.opt-priceline {
    stroke: var(--text);
    stroke-width: 2.5;
    opacity: 0.8;
}

.opt-epsline {
    stroke: var(--ew-gold, #DDB785);
    stroke-width: 1.5;
    stroke-dasharray: 5 4;
}

.opt-epslabel {
    font-size: 11px;
    fill: var(--ew-gold, #DDB785);
    font-weight: 700;
}

/* call = green, put = red — the EW2023 palette */
.opt-bub-call {
    fill: #79cc79;
    opacity: 0.7;
    stroke: var(--surface);
    stroke-width: 2;
}

.opt-bub-put {
    fill: #cd5959;
    opacity: 0.7;
    stroke: var(--surface);
    stroke-width: 2;
}

.opt-upbar {
    fill: #79cc79;
    opacity: 0.35;
}

.opt-downbar {
    fill: #cd5959;
    opacity: 0.35;
}

.opt-coname {
    font-size: 14px;
    font-weight: 700;
    fill: var(--text);
}

/* loading spinner (replaces the Bootstrap spinner-grow) */
.opt-loader {
    display: flex;
    justify-content: center;
    padding: 48px;
}

.opt-spinner {
    width: 56px;
    height: 56px;
    border: 5px solid var(--border);
    border-top-color: var(--ew-gold, #DDB785);
    border-radius: 50%;
    animation: opt-spin 0.9s linear infinite;
}

@keyframes opt-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---- candlestick + expected-move chart ---- */
.opt-candle-up.opt-body {
    fill: #7cc47c;
    stroke: none;
}

.opt-candle-down.opt-body {
    fill: #e06b63;
    stroke: none;
}

.opt-candle-up.opt-wick {
    stroke: #4e9e4e;
    stroke-width: 1;
}

.opt-candle-down.opt-wick {
    stroke: #b84a43;
    stroke-width: 1;
}

.opt-candle-up.opt-vol {
    fill: #bfddb1;
    opacity: 0.45;
}

.opt-candle-down.opt-vol {
    fill: #e57e76;
    opacity: 0.45;
}

.opt-avwap {
    stroke: #7792b0;
    stroke-width: 2.5;
    opacity: 0.9;
}

.opt-cone {
    stroke: none;
}
/* fill comes from the gradient in JS */
.opt-cone-edge {
    fill: none;
    stroke: var(--ew-gold, #DDB785);
    stroke-width: 1.25;
    stroke-dasharray: 4 3;
    opacity: 0.7;
}

.opt-expline {
    stroke: #7792b0;
    stroke-width: 1.5;
    stroke-dasharray: 5 4;
}

.opt-expline-label {
    font-size: 11px;
    fill: #7792b0;
    font-weight: 700;
}

/* projection endpoint dots + summary text */
.opt-dot-up {
    fill: #4caf50;
    stroke: var(--surface);
    stroke-width: 1.5;
}

.opt-dot-down {
    fill: #cd5959;
    stroke: var(--surface);
    stroke-width: 1.5;
}

.opt-summary {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    margin: 14px auto 0;
    max-width: 1000px;
}

/* Chart containers blend with the page in BOTH themes — no inherited background,
   no dark default. The section wrappers and the SVG hosts are explicitly transparent. */
#showOptTrade, #showOptActivity,
.opt-trade-chart, .opt-act-chart {
    background: transparent;
}

/* ---- strategy cards ---- */
.opt-strat-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    padding: 16px 18px;
    margin: 14px 0;
}

.opt-strat-head {
    margin-bottom: 12px;
}

.opt-strat-name {
    font-size: 16px;
    font-weight: 800;
    margin: 0 0 2px;
    color: var(--text);
}

.opt-strat-thesis {
    font-size: 12.5px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

.opt-strat-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

@media (max-width: 760px) {
    .opt-strat-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
}

.opt-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--surface-alt, #f6f7f9);
    text-align: center;
}

.opt-metric-val {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.opt-metric-lbl {
    font-size: 10.5px;
    color: var(--text-muted);
}

.opt-metric.is-pos .opt-metric-val {
    color: var(--positive, #0F8A3B);
}

.opt-metric.is-neg .opt-metric-val {
    color: var(--negative, #c62828);
}

.opt-strat-chart {
    margin: 4px 0 10px;
}

.opt-strat-setup {
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--text-muted);
    margin: 0;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

/* payoff diagram */
.opt-em-band {
    fill: var(--ew-gold, #DDB785);
    opacity: 0.12;
}

.opt-zero {
    stroke: var(--text-muted);
    stroke-width: 1;
    opacity: 0.5;
}

.opt-lastprice {
    stroke: var(--text);
    stroke-width: 1;
    stroke-dasharray: 3 3;
    opacity: 0.6;
}

.opt-strike {
    stroke: var(--text-muted);
    stroke-width: 1;
    stroke-dasharray: 2 3;
    opacity: 0.5;
}

.opt-pl-pos {
    stroke: #4caf50;
    stroke-width: 2.5;
}

.opt-pl-neg {
    stroke: #cd5959;
    stroke-width: 2.5;
}

.opt-payoff-xlbl {
    font-size: 10px;
    fill: var(--text-muted);
}

/* target dots on the payoff line */
.opt-dot {
    stroke: var(--surface);
    stroke-width: 1.5;
}

    .opt-dot.is-up {
        fill: #4caf50;
    }

    .opt-dot.is-down {
        fill: #cd5959;
    }

    .opt-dot.is-strike {
        fill: var(--ew-gold, #DDB785);
    }

    .opt-dot.is-be {
        fill: var(--text-muted);
    }

/* directional stance badge above each strategy */
.opt-strat-stance {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 8px;
    border: 1px solid transparent;
}

    .opt-strat-stance.is-bullish {
        color: var(--positive, #0F8A3B);
        background: rgba(76, 175, 80, 0.12);
        border-color: rgba(76, 175, 80, 0.35);
    }

    .opt-strat-stance.is-bullish-neutral {
        color: var(--positive, #0F8A3B);
        background: rgba(76, 175, 80, 0.10);
        border-color: rgba(76, 175, 80, 0.30);
    }

    .opt-strat-stance.is-bearish {
        color: var(--negative, #c62828);
        background: rgba(205, 89, 89, 0.12);
        border-color: rgba(205, 89, 89, 0.35);
    }

    .opt-strat-stance.is-neutral {
        color: #9a7a3e;
        background: rgba(221, 183, 133, 0.18);
        border-color: rgba(221, 183, 133, 0.5);
    }

@media (prefers-color-scheme: dark) {
    .opt-strat-stance.is-neutral {
        color: var(--ew-gold, #DDB785);
    }
}

/* ---- header signals: four equal boxes across one row ---- */
.opt-signals {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 8px 0 20px;
}

@media (max-width: 640px) {
    .opt-signals {
        grid-template-columns: repeat(2, 1fr);
    }
}

.opt-signal {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* labels align along the top row */
    gap: 8px;
    padding: 14px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    text-align: center;
    min-height: 92px;
}

.opt-signal-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}
/* volatility read: implied / average, coloured by sp-pos / sp-neg */
.opt-signal-vol {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.opt-vol-implied {
    font-size: 20px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.opt-signal-vol.sp-neg .opt-vol-implied {
    color: var(--negative, #c62828);
}

.opt-signal-vol.sp-pos .opt-vol-implied {
    color: var(--positive, #0F8A3B);
}

.opt-vol-avg {
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* call momentum: numeric score alongside the directional arrows */
.opt-signal-momentum {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.opt-mom-score {
    font-size: 20px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.sp-signal-arrows {
    display: inline-flex;
    align-items: center;
}

.ca-arrow.ca-up {
    color: var(--positive, #0F8A3B);
}

.ca-arrow.ca-down {
    color: var(--negative, #c62828);
}

.ca-none {
    color: var(--text-muted);
    font-weight: 700;
}

/* ---- nearest strikes pair (top, below the four signal boxes) ---- */
.opt-near-title {
    font-size: 12.5px;
    color: var(--text-muted);
    margin: 0 0 8px;
}

.opt-near-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

@media (max-width: 520px) {
    .opt-near-pair {
        grid-template-columns: 1fr;
    }
}

.opt-near-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    background: var(--surface);
    border-left-width: 4px;
}

    .opt-near-card.is-call {
        border-left-color: #4caf50;
    }

    .opt-near-card.is-put {
        border-left-color: #cd5959;
    }

.opt-near-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.opt-near-kind {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.opt-near-strike {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.opt-near-price {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    margin: 4px 0 2px;
    font-variant-numeric: tabular-nums;
}

.opt-near-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.opt-near-empty {
    font-size: 13px;
    color: var(--text-muted);
    padding: 8px 0;
}

/* ---- full option chain table (bottom) ---- */
.opt-chain-note {
    font-size: 12.5px;
    color: var(--text-muted);
    margin: 0 0 12px;
}

.opt-chain-scroll {
    overflow-x: auto;
}

.opt-chain {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
    min-width: 780px;
}

    .opt-chain thead th {
        color: var(--text-muted);
        font-weight: 700;
        padding: 6px 8px;
        text-align: right;
    }

.opt-chain-side th {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: center;
    padding-bottom: 2px;
    border-bottom: 1px solid var(--border);
}

.opt-chain-cols th {
    font-size: 10.5px;
    border-bottom: 1px solid var(--border);
}

.opt-chain-strikecol {
    text-align: center !important;
    font-weight: 800;
    color: var(--text) !important;
    background: var(--surface-alt, #f6f7f9);
}

.opt-chain tbody td {
    padding: 6px 8px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.opt-chain-ba {
    display: block;
    font-size: 10.5px;
    color: var(--text-muted);
}
/* bracketing strikes: the call just below and put just above the price */
.opt-chain td.is-itm-call {
    background: rgba(76, 175, 80, 0.12);
}

.opt-chain td.is-itm-put {
    background: rgba(205, 89, 89, 0.12);
}
