/* ══════════════════════════════════════════════════════════════════════
   FRONTIER EXPIRATION CHART
   Editorial wrapper for the Expiration Curve vs Ideal Threshold chart
   on Leasing Hub, New Leases, and Renewals. Replaces the legacy blue
   dbc.Card chrome with the same eyebrow + serif title pattern used by
   the property cards and Executive Dashboard.
   ══════════════════════════════════════════════════════════════════════ */

.fr-exp-chart {
    background: var(--fr-surface);
    border: 1px solid var(--fr-hairline);
    border-radius: var(--fr-r-lg);
    padding: 24px 28px 18px;
    margin-bottom: 24px;
}

.fr-exp-chart__topbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    padding-bottom: 18px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--fr-hairline);
}

.fr-exp-chart__head {
    flex: 1 1 auto;
    min-width: 0;
}

.fr-exp-chart__eyebrow {
    display: block;
    font-family: var(--fr-font-sans);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--fr-accent);
    margin-bottom: 8px;
}

.fr-exp-chart__title {
    font-family: var(--fr-font-serif);
    font-size: 32px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.01em;
    color: var(--fr-ink);
    margin: 0;
}

.fr-exp-chart__sub {
    font-family: var(--fr-font-sans);
    font-style: normal;
    font-size: 13px;
    line-height: 1.45;
    color: var(--fr-ink-3);
    margin: 8px 0 0;
}

/* ── GPR forecast: starting-GPR basis pills (Source vs Calculated) ─────
   Compact segmented control above the GPR bars. Shows both candidate
   anchors at once with the active one filled in copper, plus the delta
   between them so a drifted (manually-edited) Source figure is obvious. */
.fr-gpr-basis {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 4px 0 14px;
}

.fr-gpr-basis__label {
    font-family: var(--fr-font-sans);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fr-ink-3);
}

.fr-gpr-basis__pills {
    display: inline-flex;
    gap: 6px;
}

.fr-gpr-basis__pill {
    display: inline-flex;
    align-items: baseline;
    gap: 7px;
    padding: 5px 12px;
    background: var(--fr-surface);
    border: 1px solid var(--fr-hairline);
    border-radius: var(--fr-r-sm);
    font-family: var(--fr-font-sans);
    color: var(--fr-ink-2);
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.fr-gpr-basis__pill:hover:not(:disabled):not(.is-active) {
    border-color: var(--fr-ink-3);
}

.fr-gpr-basis__pill.is-active {
    background: var(--fr-accent-soft);
    border-color: var(--fr-accent);
    color: var(--fr-accent-strong);
}

.fr-gpr-basis__pill:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.fr-gpr-basis__name {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.fr-gpr-basis__val {
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.fr-gpr-basis__delta {
    font-family: var(--fr-font-sans);
    font-size: 11.5px;
    color: var(--fr-ink-3);
    font-variant-numeric: tabular-nums;
}

/* Amenity-premium total — quiet, pushed to the far right of the basis row. */
.fr-gpr-basis__amenity {
    margin-left: auto;
    font-family: var(--fr-font-sans);
    font-size: 11.5px;
    color: var(--fr-ink-3);
    white-space: nowrap;
}

.fr-gpr-basis__amenity-label {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 10px;
    font-weight: 600;
}

.fr-gpr-basis__amenity-val {
    color: var(--fr-ink-2);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.fr-exp-chart__legend {
    display: flex;
    align-items: center;
    gap: 22px;
    flex: 0 0 auto;
    padding-bottom: 4px;
}

.fr-exp-chart__legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--fr-font-sans);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fr-ink-2);
    white-space: nowrap;
}

.fr-exp-chart__swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex: 0 0 auto;
}

.fr-exp-chart__swatch--ideal {
    background: var(--fr-hairline-strong);
}

.fr-exp-chart__swatch--actual {
    background: var(--fr-accent);
}

/* Tighten the dcc.Graph reset so it sits flush inside the card. */
.fr-exp-chart .js-plotly-plot,
.fr-exp-chart .plot-container {
    background: transparent !important;
}

/* ── GPR forecast section: footnote, field labels, captions, controls ── */
.fr-exp-chart__footnote {
    font-family: var(--fr-font-sans);
    font-size: 11px;
    color: var(--fr-ink-3);
    text-align: center;
    margin: 12px 0 0;
}

.fr-field-label {
    display: block;
    font-family: var(--fr-font-sans);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--fr-ink-2);
    margin-bottom: 8px;
}

.fr-field-help {
    display: block;
    font-family: var(--fr-font-sans);
    font-size: 12px;
    line-height: 1.4;
    color: var(--fr-ink-3);
    margin-top: 8px;
}

.fr-table-caption {
    display: block;
    font-family: var(--fr-font-sans);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--fr-ink-3);
    text-align: center;
    margin-bottom: 6px;
}

/* Renewal Behavior controls — Bootstrap inputs re-skinned to brand tokens. */
.fr-gpr-controls .form-control,
.fr-gpr-controls .input-group-text {
    font-family: var(--fr-font-sans);
    border-color: var(--fr-hairline-strong);
    color: var(--fr-ink);
    border-radius: var(--fr-r-sm);
}
.fr-gpr-controls .input-group-text {
    background: var(--fr-bg);
    color: var(--fr-ink-2);
}
.fr-gpr-controls .form-control:focus {
    border-color: var(--fr-accent);
    box-shadow: 0 0 0 2px var(--fr-accent-soft);
}
.fr-gpr-radios .form-check-input:checked {
    background-color: var(--fr-accent);
    border-color: var(--fr-accent);
}
.fr-gpr-radios .form-check-input:focus {
    border-color: var(--fr-accent);
    box-shadow: 0 0 0 2px var(--fr-accent-soft);
}
.fr-gpr-radios .form-check-label {
    font-family: var(--fr-font-sans);
    color: var(--fr-ink);
    font-size: 13px;
}

/* Expected-renewal slider (rc-slider) accents. */
.fr-gpr-slider .rc-slider-track {
    background: var(--fr-accent);
}
.fr-gpr-slider .rc-slider-handle,
.fr-gpr-slider .rc-slider-handle:hover,
.fr-gpr-slider .rc-slider-handle-click-focused:focus {
    border-color: var(--fr-accent);
    background: var(--fr-accent);
    opacity: 1;
    box-shadow: none;
}
.fr-gpr-slider .rc-slider-handle:active {
    border-color: var(--fr-accent-strong);
    box-shadow: 0 0 0 4px var(--fr-accent-soft);
}
.fr-gpr-slider .rc-slider-dot-active {
    border-color: var(--fr-accent);
}
.fr-gpr-slider .rc-slider-tooltip-inner {
    background: var(--fr-accent);
    color: #fff;
    font-family: var(--fr-font-sans);
    font-size: 11px;
    font-weight: 600;
    min-width: 0;
    height: auto;
    padding: 3px 8px;
    border-radius: var(--fr-r-sm);
    box-shadow: none;
}
.fr-gpr-slider .rc-slider-tooltip-placement-bottom .rc-slider-tooltip-arrow {
    border-bottom-color: var(--fr-accent);
}



/* ── GPR forecaster: staged-changes bar ─────────────────────────────────
   Every forecast input is staged, so this bar is the one commit point (see
   create_gpr_apply_bar). It is hidden while draft == applied and revealed by
   the clientside callback in app/callbacks/charts.py, which clears the inline
   display:none — hence `display: flex` here rather than on an inline style.

   Sticky to the bottom of the viewport because the user works downward
   through the override table: the commit has to stay in reach without
   scrolling back up to find it. */
.fr-gpr-apply {
    position: sticky;
    bottom: 16px;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 28px;
    /* Hugs its content and stays left-aligned instead of spanning the card.
       The global support FAB (app/components/support_fab.py) is fixed at
       bottom/right 24px with z-index 1030 — far above this bar — so anything
       right-aligned down here gets covered by it, which is exactly what
       happened to the Update Forecast button. The max-width keeps the bar's
       right edge clear of that corner at every viewport width rather than
       relying on there being enough room. */
    width: fit-content;
    max-width: calc(100% - 88px);
    margin: 16px 0 4px;
    padding: 12px 16px 12px 20px;
    background: var(--fr-surface);
    border: 1px solid var(--fr-accent);
    border-left: 3px solid var(--fr-accent);
    border-radius: var(--fr-r-md);
    box-shadow: 0 6px 20px rgba(20, 24, 29, 0.13);
}

/* No flex-grow: the text sets the bar's width, and the actions sit directly
   after it rather than being pushed to the far edge. */
.fr-gpr-apply__text {
    min-width: 0;
}

.fr-gpr-apply__count {
    display: block;
    font-family: var(--fr-font-sans);
    font-size: 13px;
    font-weight: 600;
    color: var(--fr-accent-strong);
    letter-spacing: 0.01em;
}

.fr-gpr-apply__hint {
    display: block;
    font-family: var(--fr-font-sans);
    font-size: 12px;
    color: var(--fr-ink-3);
    margin-top: 2px;
}

.fr-gpr-apply__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.fr-gpr-apply__discard,
.fr-gpr-apply__discard:hover,
.fr-gpr-apply__discard:focus {
    font-family: var(--fr-font-sans);
    font-size: 12.5px;
    color: var(--fr-ink-3);
    text-decoration: none;
    box-shadow: none;
    padding: 6px 10px;
}

.fr-gpr-apply__discard:hover {
    color: var(--fr-ink);
}

.fr-gpr-apply__go,
.fr-gpr-apply__go:focus {
    font-family: var(--fr-font-sans);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #fff;
    background: var(--fr-accent);
    border: 1px solid var(--fr-accent);
    border-radius: var(--fr-r-sm);
    padding: 8px 18px;
    white-space: nowrap;
    box-shadow: none;
}

.fr-gpr-apply__go:hover,
.fr-gpr-apply__go:active {
    background: var(--fr-accent-strong);
    border-color: var(--fr-accent-strong);
    color: #fff;
}

.fr-gpr-apply__go:focus-visible {
    box-shadow: 0 0 0 3px var(--fr-accent-soft);
}

/* The bar carries the whole "your changes aren't live yet" message. An earlier
   pass also dimmed the forecast itself; people read reduced opacity as DISABLED
   ("I can't change anything any more"), not as out-of-date, so the chart stays
   at full contrast. The entrance animation is what draws the eye instead — it
   replays each time the bar goes from hidden to shown, i.e. on the first edit
   after a commit, because toggling `display` restarts a CSS animation. */
@keyframes fr-gpr-apply-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fr-gpr-apply {
    animation: fr-gpr-apply-in 0.22s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .fr-gpr-apply {
        animation: none;
    }
}

@media (max-width: 720px) {
    .fr-gpr-apply {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .fr-gpr-apply__actions {
        justify-content: flex-start;
    }
}
