/* Web Analytics Sandbox — GA4-flavored reporting surface.
   Layout only; every color and font comes from shared/css/main.css. */

.wa-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem 1.25rem;
}

.wa-control {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.wa-control label {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    opacity: 0.75;
}

.wa-control select,
.wa-control input[type="date"] {
    min-width: 11rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 6px;
    background: #fff;
    font: inherit;
    font-size: 0.95rem;
}

.wa-control--inline {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.wa-control--inline select {
    min-width: 14rem;
}

.wa-control--compare {
    margin-left: auto;
}

.wa-data-through {
    flex-basis: 100%;
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.7;
}

/* ---------- Layout ---------- */

.wa-layout {
    display: grid;
    grid-template-columns: minmax(190px, 230px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 860px) {
    .wa-layout { grid-template-columns: 1fr; }
    .wa-control--compare { margin-left: 0; }
}

.wa-nav {
    position: sticky;
    top: 1rem;
}

.wa-nav__title {
    margin: 0 0 0.6rem;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.6;
}

.wa-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.wa-nav__btn {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
}

.wa-nav__btn:hover { background: rgba(0, 0, 0, 0.05); }

.wa-nav__btn[aria-current="page"] {
    background: rgba(26, 115, 232, 0.12);
    color: #10528f;
    font-weight: 600;
}

.wa-report {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}

.wa-report__head h2 { margin: 0 0 0.25rem; }

.wa-report__lede {
    margin: 0 0 1rem;
    font-size: 0.95rem;
    opacity: 0.8;
}

/* ---------- Scorecards ---------- */

.wa-scorecards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
    gap: 0.85rem;
}

.wa-card {
    padding: 0.85rem 0.95rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background: #fff;
}

/* Shown when a comparison period reaches outside the available history. Spans the whole
   grid row, because it explains the absence of every delta rather than one card's. */
.wa-compare-notice {
    grid-column: 1 / -1;
    padding: 0.7rem 0.9rem;
    border: 1px solid rgba(180, 120, 0, 0.35);
    border-left: 4px solid rgba(180, 120, 0, 0.75);
    border-radius: 8px;
    background: rgba(255, 196, 0, 0.09);
    font-size: 0.86rem;
    line-height: 1.45;
}

.wa-card__label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    opacity: 0.65;
}

.wa-card__value {
    display: block;
    margin-top: 0.3rem;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.wa-card__delta {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
}

/* Direction only. Whether a rise is good news is the student's call, not the tool's. */
.wa-card__delta--up { color: #0f7b3f; }
.wa-card__delta--down { color: #a81f1f; }
.wa-card__delta--flat { opacity: 0.6; }

.wa-card__help {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    line-height: 1.35;
    opacity: 0.62;
}

/* ---------- Segments and comparisons ---------- */

.wa-segments__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.6rem;
}

.wa-segments__title {
    margin: 0;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.6;
}

.wa-btn {
    padding: 0.4rem 0.85rem;
    border: 1px solid #1a73e8;
    border-radius: 6px;
    background: #1a73e8;
    color: #fff;
    font: inherit;
    font-size: 0.88rem;
    cursor: pointer;
}

.wa-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.wa-btn--ghost {
    background: #fff;
    color: #10528f;
    border-color: rgba(0, 0, 0, 0.2);
}

.wa-segment-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.wa-segment {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.4rem 0.35rem 0.7rem;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 999px;
    background: #fff;
    font-size: 0.88rem;
}

.wa-segment__swatch {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    flex: none;
}

.wa-segment__remove {
    border: 0;
    background: none;
    padding: 0 0.25rem;
    font: inherit;
    line-height: 1;
    color: inherit;
    opacity: 0.55;
    cursor: pointer;
}

.wa-segment__remove:hover { opacity: 1; }

/* Series colors. The chip/card swatches live here; their chart-stroke twins have to sit AFTER
   the base .wa-chart__series rule further down, or equal specificity lets the base repaint
   every line blue. */
.wa-seg-0 { background: #1a73e8; }
.wa-seg-1 { background: #b8600f; }
.wa-seg-2 { background: #0f7b5f; }

.wa-builder {
    margin-top: 0.9rem;
    padding: 0.9rem;
    border: 1px solid rgba(0, 0, 0, 0.14);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.02);
}

.wa-builder__rows {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.wa-builder__row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.6rem;
}

.wa-builder__row select[multiple] {
    min-width: 15rem;
    min-height: 5.5rem;
    padding: 0.3rem;
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 6px;
    font: inherit;
    font-size: 0.9rem;
}

.wa-builder__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.85rem;
}

.wa-builder__actions input[type="text"] {
    min-width: 13rem;
    padding: 0.4rem 0.55rem;
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 6px;
    font: inherit;
    font-size: 0.9rem;
}

.wa-builder__preview {
    margin: 0.7rem 0 0;
    font-size: 0.88rem;
    opacity: 0.8;
}

.wa-segment-note {
    margin: 0.7rem 0 0;
    font-size: 0.85rem;
    opacity: 0.7;
}

.wa-card__series {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    margin-top: 0.3rem;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}

.wa-card__series-name {
    font-size: 0.78rem;
    opacity: 0.7;
    margin-left: auto;
    text-align: right;
}

.wa-card__series-value { font-weight: 700; }

/* ---------- Chart ---------- */

.wa-chart__head,
.wa-table__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.wa-chart__head h3,
.wa-table__head h3 { margin: 0; }

.wa-chart svg { display: block; width: 100%; height: auto; }

.wa-chart__series { fill: none; stroke: #1a73e8; stroke-width: 2; }
.wa-chart__series--compare { stroke: #9aa0a6; stroke-dasharray: 4 3; stroke-width: 1.6; }

/* Must stay below the base rule above: same specificity, so source order decides the winner. */
.wa-chart__series--s0 { stroke: #1a73e8; }
.wa-chart__series--s1 { stroke: #b8600f; }
.wa-chart__series--s2 { stroke: #0f7b5f; }
.wa-chart__area { fill: rgba(26, 115, 232, 0.10); stroke: none; }
.wa-chart__axis { stroke: rgba(0, 0, 0, 0.2); stroke-width: 1; }
.wa-chart__grid { stroke: rgba(0, 0, 0, 0.07); stroke-width: 1; }

.wa-chart__tick {
    font-size: 11px;
    fill: rgba(0, 0, 0, 0.55);
    font-variant-numeric: tabular-nums;
}

.wa-chart__caption {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    opacity: 0.7;
}

/* ---------- Case brief ---------- */

/* Collapsed by default, so the summary has to carry the framing on its own: most students will
   read that line every visit and open the body once. */
.wa-case {
    border-left: 4px solid #1a73e8;
}

.wa-case__summary {
    cursor: pointer;
    font-size: 1rem;
    line-height: 1.5;
    list-style: none;
}

.wa-case__summary::-webkit-details-marker { display: none; }

.wa-case__tag {
    display: inline-block;
    margin-right: 0.5rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: rgba(26, 115, 232, 0.12);
    color: #10528f;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    vertical-align: middle;
}

.wa-case__more {
    color: #10528f;
    font-weight: 600;
    white-space: nowrap;
}

.wa-case__more::after { content: ' \25be'; }
.wa-case[open] .wa-case__more::after { content: ' \25b4'; }
.wa-case[open] .wa-case__more { opacity: 0.7; }

.wa-case__summary:focus-visible {
    outline: 2px solid #1a73e8;
    outline-offset: 3px;
}

.wa-case__body {
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 0.95rem;
    line-height: 1.6;
}

.wa-case__body p { margin: 0 0 0.9rem; }

.wa-case__facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.85rem;
    margin-bottom: 0.9rem;
}

.wa-case__facts > div {
    padding: 0.7rem 0.85rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.03);
}

.wa-case__label {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    opacity: 0.6;
}

.wa-case__questions {
    padding: 0.75rem 0.9rem;
    border-radius: 8px;
    background: rgba(26, 115, 232, 0.07);
}

/* ---------- Metric help ---------- */

/* Reuses the platform's shared .info-icon tooltip. These overrides only make it work as a
   <button> (so it is keyboard reachable, not hover only) and stop the uppercase table header
   from shouting the tooltip text. */
button.info-icon {
    border: 0;
    padding: 0;
    font-family: inherit;
}

.info-icon::after {
    text-transform: none;
    letter-spacing: normal;
}

button.info-icon:focus-visible::after,
button.info-icon:focus-visible::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.wa-metric-option .info-icon {
    margin-left: auto;
}

/* ---------- Funnel ---------- */

.wa-funnel {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.wa-funnel__step { padding: 0.5rem 0; }

.wa-funnel__labels {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.35rem;
}

.wa-funnel__name { font-weight: 600; }

.wa-funnel__count {
    font-variant-numeric: tabular-nums;
    opacity: 0.75;
    font-size: 0.9rem;
}

.wa-funnel__bars {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.wa-funnel__track {
    position: relative;
    height: 1.45rem;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.wa-funnel__bar {
    height: 100%;
    border-radius: 4px;
    min-width: 2px;
}

.wa-funnel__bar-label {
    position: absolute;
    top: 0;
    left: 0.5rem;
    line-height: 1.45rem;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    color: #202124;
}

.wa-funnel__drop {
    margin: 0.3rem 0 0;
    font-size: 0.85rem;
    opacity: 0.75;
    font-variant-numeric: tabular-nums;
}

.wa-funnel__step--worst .wa-funnel__drop {
    opacity: 1;
    font-weight: 600;
    color: #a81f1f;
}

.wa-funnel__flag {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    background: rgba(168, 31, 31, 0.12);
    font-size: 0.75rem;
    font-weight: 600;
    color: #a81f1f;
}

/* ---------- Explore builder ---------- */

.wa-explore {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.wa-metric-picker {
    margin: 0;
    padding: 0.75rem 0.9rem;
    border: 1px solid rgba(0, 0, 0, 0.14);
    border-radius: 8px;
}

.wa-metric-picker legend {
    padding: 0 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    opacity: 0.7;
}

.wa-metric-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.35rem 1rem;
}

.wa-metric-option {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.9rem;
}

.wa-table__tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

/* ---------- Dimension tabs ---------- */

.wa-dimension-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.wa-tab {
    padding: 0.35rem 0.7rem;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 999px;
    background: #fff;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.wa-tab[aria-selected="true"] {
    border-color: #1a73e8;
    background: rgba(26, 115, 232, 0.1);
    color: #10528f;
    font-weight: 600;
}

/* ---------- Table ---------- */

.wa-table__scroll { overflow-x: auto; }

.wa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.wa-table th,
.wa-table td {
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.wa-table th:first-child,
.wa-table td:first-child {
    text-align: left;
    white-space: normal;
    font-variant-numeric: normal;
}

.wa-table thead th {
    border-bottom: 2px solid rgba(0, 0, 0, 0.18);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    opacity: 0.75;
}

.wa-table__sort {
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-transform: inherit;
    letter-spacing: inherit;
}

.wa-table__sort[aria-sort-active="true"] {
    color: #10528f;
    font-weight: 700;
}

.wa-table tbody tr:hover { background: rgba(0, 0, 0, 0.025); }

.wa-table tfoot td {
    border-top: 2px solid rgba(0, 0, 0, 0.18);
    border-bottom: 0;
    font-weight: 700;
}

.wa-table__note {
    margin: 0.6rem 0 0;
    font-size: 0.85rem;
    opacity: 0.7;
}

@media (prefers-reduced-motion: reduce) {
    .wa-nav__btn, .wa-tab { transition: none; }
}
