﻿/* Nested inside .stock-page (which supplies the outer width + centering), so this
   just handles vertical rhythm. Don't re-cap the width here or the study content
   would be narrower than the header/nav above it. */
.es-page {
    width: 100%;
    padding: 1.25rem 0 3rem;
    color: var(--text);
}

.es-head h1 {
    font-size: 24px;
    font-weight: 800;
    margin: 0 0 6px;
    color: var(--text);
}

.es-sub {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0 0 18px;
    line-height: 1.5;
}

.es-empty {
    color: var(--text-muted);
    padding: 24px 0;
}

    .es-empty code {
        background: var(--surface-alt);
        padding: 2px 6px;
        border-radius: 5px;
    }

.es-meta {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 8px;
}

.es-ticker {
    font-size: 20px;
    font-weight: 800;
    color: var(--text);
}

.es-events {
    font-size: 13px;
    color: var(--text-muted);
}

.es-chart-wrap {
    position: relative; /* positioning context for the overlay .chart-toolbar */
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    padding: 8px;
}

.es-chart {
    width: 100%;
    min-height: 380px;
}

.es-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
}

.es-note {
    margin: 10px 2px 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
}

/* ---- Controls ---- */
.es-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
    padding: 14px 16px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.es-ctrl {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

    .es-ctrl > label {
        font-size: 12px;
        font-weight: 600;
        color: var(--text-muted);
    }

.es-ctrl-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

    .es-ctrl-row input[type="range"] {
        width: 150px;
    }

    .es-ctrl-row input[type="number"] {
        width: 80px;
        padding: 6px 8px;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: var(--surface);
        color: var(--text);
        font: inherit;
    }

    .es-ctrl-row output {
        font-weight: 700;
        color: var(--text);
        min-width: 22px;
    }

.es-hint {
    font-size: 11px;
    color: var(--text-muted);
}

.es-ctrl-toggle {
    justify-content: center;
}

.es-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
}

    .es-switch input {
        width: 16px;
        height: 16px;
        accent-color: var(--ew-gold, #DDB785);
    }

.es-readout {
    margin-left: auto;
    font-size: 13px;
    font-weight: 700;
    color: var(--ew-gold, #DDB785);
    font-variant-numeric: tabular-nums;
    min-height: 1em;
}

/* ---- Filters (collapsible) ---- */
.es-filters {
    margin: 0 0 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    padding: 0 16px;
}

    .es-filters > summary {
        cursor: pointer;
        padding: 12px 0;
        font-weight: 600;
        color: var(--text);
        list-style: none;
        display: flex;
        align-items: center;
        gap: 10px;
    }

        .es-filters > summary::-webkit-details-marker {
            display: none;
        }

        .es-filters > summary::before {
            content: "\25B8";
            color: var(--text-muted);
        }

    .es-filters[open] > summary::before {
        content: "\25BE";
    }

.es-filters-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--ew-gold, #DDB785);
}

.es-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px 18px;
    padding-bottom: 14px;
}

    .es-filter-grid select,
    .es-splitrow select {
        padding: 7px 9px;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: var(--surface);
        color: var(--text);
        font: inherit;
        width: 100%;
    }

.es-splitrow {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
    padding: 14px 0;
}

    .es-splitrow .es-ctrl {
        flex: 1 1 260px;
    }

.es-reset {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

    .es-reset:hover {
        border-color: var(--ew-gold, #DDB785);
        color: var(--ew-gold, #DDB785);
    }

/* (Chart legend moved into the chart itself — EWLegend primitive.) */

.es-hidden {
    display: none !important;
}

/* ---- Subscriber gating for Filters & comparison ---- */
.es-lock {
    color: var(--ew-gold, #DDB785);
    flex: 0 0 auto;
    vertical-align: -2px;
}

.es-lock-tag {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ew-gold, #DDB785);
}

/* Locked: the section still opens (so free users can see what they'd get),
   but every control inside is greyed out and non-interactive. */
.es-filters.es-locked .es-filter-grid,
.es-filters.es-locked .es-splitrow {
    opacity: 0.5;
    filter: grayscale(1);
    pointer-events: none;
    user-select: none;
}

.es-filters.es-locked select:disabled,
.es-filters.es-locked button:disabled {
    cursor: not-allowed;
    background: var(--surface-alt, #f2f4f8);
    color: var(--text-muted);
}

.es-upsell {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--ew-gold, #DDB785);
    border-radius: 9px;
    background: color-mix(in srgb, var(--ew-gold, #DDB785) 10%, transparent);
    font-size: 13px;
    color: var(--text);
    line-height: 1.45;
}

    .es-upsell a {
        font-weight: 700;
        color: var(--ew-gold, #DDB785);
    }

.es-seednote {
    margin: 0 0 12px;
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.5;
}

.es-linkbtn {
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    font-weight: 700;
    color: var(--ew-gold, #DDB785);
    cursor: pointer;
    text-decoration: underline;
}

/* Toolbar row sits above the chart, right-aligned. Being outside .es-chart-wrap
   means it can't overlap the in-chart logo/company name, and it stays out of
   takeScreenshot() exports. */
.es-toolbar-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    margin: 0 0 8px;
    position: relative; /* so .share-bar can anchor to it */
}

    .es-toolbar-row .chart-toolbar {
        position: static;
        display: flex;
        align-items: center;
        gap: 6px;
    }
