/* Dashboard styles.
 *
 * Everything is scoped under .fver-root. The dashboard lives inside a
 * Squarespace page, so unscoped rules would leak into the surrounding site and
 * Squarespace's own styles would leak in here. Sizes are px/em rather than rem
 * for the same reason: rem resolves against Squarespace's root font size, which
 * varies by template.
 *
 * Palette carried over from the Shiny app's www/*.css.
 */

.fver-root {
    --fver-gold: #e8c020;
    --fver-gold-light: #fff2c0;
    --fver-dark: #342700;
    --fver-bg: #000000;
    --fver-panel: #ffffff;
    --fver-header: #f0c300;
    --fver-row-odd: #fef1d9;
    --fver-row-even: #f4da89;

    background-color: var(--fver-bg);
    color: #ffffff;
    font-family: Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    padding: 16px;
    box-sizing: border-box;
}

.fver-root *,
.fver-root *::before,
.fver-root *::after {
    box-sizing: inherit;
}

.fver-loading,
.fver-error {
    color: #ffffff;
    padding: 32px 0;
    text-align: center;
}

/* ===== Tabs ===== */

.fver-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 16px;
}

.fver-tab {
    background-color: var(--fver-gold);
    border: none;
    border-radius: 8px 8px 0 0;
    color: #000000;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    padding: 10px 18px;
}

.fver-tab:hover,
.fver-tab.active {
    background-color: var(--fver-gold-light);
}

.fver-panel {
    display: none;
}

.fver-panel.active {
    display: block;
}

/* The models tab spaces its own contents with flex gaps; the spreads tab is a
 * plain stack of blocks, so without this its selector, metrics, both plots and
 * the description sit flush against each other. */
.fver-panel[data-panel="spreads"] > * + * {
    margin-top: 16px;
}

.fver-panel[data-panel="spreads"] .fver-field {
    max-width: 420px;
}

/* ===== Models tab ===== */

.fver-models-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
}

@media (min-width: 992px) {
    .fver-models-grid {
        grid-template-columns: minmax(280px, 1fr) 2fr;
    }
}

.fver-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.fver-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-weight: bold;
}

.fver-field select {
    background-color: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 4px;
    color: #000000;
    font-size: 1em;
    padding: 8px;
    width: 100%;
}

.fver-metrics {
    background-color: var(--fver-gold);
    border-radius: 12px;
    color: #000000;
    padding: 16px;
}

.fver-metrics hr {
    background-color: #000000;
    border: none;
    height: 3px;
    margin: 4px 0 10px 0;
}

/* ===== Plots ===== */

.fver-plots {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.fver-plot {
    background-color: var(--fver-panel);
    border-radius: 16px;
    height: 480px;
    overflow: hidden;
    padding: 8px;
    width: 100%;
}

.fver-plot-short {
    height: 320px;
}

/* On a phone the valuation chart's legend wraps to several rows, and every row
 * is taken out of the plot area -- so the container has to grow rather than
 * shrink or the chart itself ends up a sliver. The histogram has no legend and
 * can stay compact. */
@media (max-width: 640px) {
    .fver-plot { height: 560px; }
    .fver-plot-short { height: 300px; }
}

/* ===== Info tabs ===== */

.fver-info {
    margin-top: 16px;
}

.fver-info-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.fver-info-tab {
    background-color: var(--fver-gold);
    border: none;
    border-radius: 8px 8px 0 0;
    color: #000000;
    cursor: pointer;
    font-weight: bold;
    padding: 8px 14px;
}

.fver-info-tab:hover,
.fver-info-tab.active {
    background-color: var(--fver-gold-light);
}

.fver-info-body {
    background-color: var(--fver-panel);
    border-radius: 12px;
    color: #000000;
    padding: 16px;
}

.fver-info-body details {
    margin-bottom: 8px;
}

.fver-info-body .dropdown-title {
    cursor: pointer;
    padding-left: 8px;
}

.fver-info-body .dropdown-title:hover {
    background-color: var(--fver-gold);
}

/* ===== Summary tables ===== */

.fver-summary-title {
    color: #ffffff;
    font-size: 1.5em;
    font-weight: bold;
    margin: 24px 0 8px 0;
    text-align: center;
}

/* Wide tables scroll inside their own container so the page never does. */
.fver-table-scroll {
    border-radius: 12px;
    max-height: 60vh;
    overflow: auto;
    width: 100%;
}

.fver-table {
    background-color: var(--fver-row-odd);
    border-collapse: collapse;
    color: #000000;
    font-size: 0.85em;
    width: 100%;
}

.fver-table th {
    background-color: var(--fver-header);
    color: #000000;
    font-weight: bold;
    padding: 10px 8px;
    position: sticky;
    text-align: center;
    top: 0;
    white-space: nowrap;
    z-index: 1;
}

.fver-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.fver-table th.sortable:hover {
    background-color: var(--fver-gold-light);
}

.fver-table th.sorted-asc::after { content: ' ▲'; }
.fver-table th.sorted-desc::after { content: ' ▼'; }

.fver-table td {
    padding: 6px 8px;
    text-align: center;
    white-space: nowrap;
}

.fver-table tbody tr:nth-child(odd) td { background-color: var(--fver-row-odd); }
.fver-table tbody tr:nth-child(even) td { background-color: var(--fver-row-even); }

/* First column stays put while the rest scrolls sideways. */
.fver-table th:first-child,
.fver-table td:first-child {
    left: 0;
    position: sticky;
    z-index: 2;
}

.fver-table th:first-child { z-index: 3; }

.fver-table tbody tr:nth-child(odd) td:first-child { background-color: var(--fver-row-odd); }
.fver-table tbody tr:nth-child(even) td:first-child { background-color: var(--fver-row-even); }

.fver-sparkline {
    display: block;
    margin: 0 auto;
}

.fver-empty {
    color: #ffffff;
    padding: 8px 0;
}

/* ===== Footer ===== */

.fver-disclaimer {
    color: #ffffff;
    font-size: 0.8em;
    margin-top: 32px;
    text-align: center;
}

.fver-asof {
    color: #bbbbbb;
    font-size: 0.75em;
    margin-top: 4px;
    text-align: center;
}
