/*
 * Coding Ireland proprietary interactive activity
 * Copyright (c) 2017-2026 Coding Ireland. All rights reserved.
 *
 * Part of the Coding Ireland online learning platform. Licensed for use only
 * as delivered on the platform. Copying, redistributing, or adapting this
 * file, in whole or in part, for use in any other product or service is not
 * permitted. Ref: CI-maths-stats-overlay
 */
/*
 * stats-overlay activity styles.
 *
 * A dot plot above a horizontal axis. Each value's dots stack
 * vertically. Overlay lines for mean / median / mode / range are
 * toggled with the chip buttons above the plot — each line carries
 * its own colour and a small label at the right edge.
 */

.so-mode-chip {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    background: var(--maths-surface-alt);
    color: var(--maths-primary-dark);
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.so-target-label { font-weight: 800; color: #8a5a00; font-size: 0.95rem; margin-right: 0.5rem; }
.so-target-prompt { flex: 1 1 auto; color: #6b4500; font-weight: 700; font-size: 1rem; }

.so-answer-input {
    width: 6rem !important;
    text-align: center;
    font-weight: 800;
    font-size: 1.1rem;
}

.so-stat-toggles {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.so-stat-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    background: var(--maths-surface);
    border: 2px solid var(--maths-border);
    border-radius: 10px;
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    transition: background-color 160ms ease, border-color 160ms ease;
    min-width: 140px;
    min-height: 64px;
}

.so-stat-btn:hover { background: var(--maths-surface-alt); }

.so-stat-key {
    font-weight: 800;
    color: var(--maths-ink);
    text-transform: uppercase;
    font-size: 1rem;
    letter-spacing: 0.05em;
}

.so-stat-val {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    font-size: 1.8rem;
    color: var(--maths-primary-dark);
    margin-top: 0.2rem;
}

.so-stat-btn[aria-pressed="true"] {
    background: var(--maths-surface-alt);
    border-color: currentColor;
}

.so-stat-mean[aria-pressed="true"] { color: #1F6FB2; }
.so-stat-median[aria-pressed="true"] { color: #3E8E7E; }
.so-stat-mode[aria-pressed="true"] { color: #E86A33; }
.so-stat-range[aria-pressed="true"] { color: #A14EA0; }

.so-stage {
    background: var(--maths-surface);
    border: 1px solid var(--maths-border);
    border-radius: 12px;
    padding: 0.4rem;
    margin-bottom: 1rem;
}

.so-plot-svg {
    width: 100%;
    height: auto;
    max-height: 500px;
    display: block;
}

.so-axis-line { stroke: var(--maths-ink); stroke-width: 3; }
.so-axis-tick { stroke: var(--maths-ink-muted); stroke-width: 2; }
.so-axis-label { fill: var(--maths-ink); font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 18px; text-anchor: middle; }

.so-dot {
    fill: var(--maths-primary);
    stroke: var(--maths-primary-dark);
    stroke-width: 1.5;
    cursor: pointer;
    transition: opacity 200ms ease, stroke 200ms ease, fill 200ms ease;
}

.so-dot.is-mode { fill: #E86A33; stroke: #BA4C1A; }

/* Median-middle highlight — the dot(s) that sit at the median position
 * when the sorted view is active. A solid gold ring + gentle pulse make
 * it unambiguous which dot the median is referring to. */
.so-dot.is-median-middle {
    stroke: #C28800;
    stroke-width: 4;
    filter: drop-shadow(0 0 6px rgba(194, 136, 0, 0.55));
    animation: so-median-pulse 1.4s ease-in-out infinite;
}

@keyframes so-median-pulse {
    0%, 100% { stroke-width: 4; }
    50%      { stroke-width: 6; }
}

.so-overlay-line { stroke-width: 2.5; fill: none; stroke-dasharray: 6 4; }
.so-overlay-mean { stroke: #1F6FB2; }
.so-overlay-median { stroke: #3E8E7E; }
.so-overlay-mode { stroke: #E86A33; stroke-dasharray: 2 3; }
.so-overlay-mode-band {
    fill: #E86A33;
    fill-opacity: 0.14;
    stroke: #E86A33;
    stroke-opacity: 0.5;
    stroke-dasharray: 3 3;
    stroke-width: 1.5;
}

.so-overlay-range-bracket { stroke: #A14EA0; stroke-width: 2.5; fill: none; }
.so-overlay-range-label { fill: #A14EA0; font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 17px; text-anchor: middle; }

.so-overlay-label {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 17px;
    text-anchor: start;
}

/* Big caption shown during the Mean / Median redistribution views.
 * Sits above the dot stack (mean) or the sorted row (median) and
 * states the resulting statistic plainly. */
.so-stat-caption {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 22px;
    font-variant-numeric: tabular-nums;
}

.so-caption-mean   { fill: #1F6FB2; }
.so-caption-median { fill: #C28800; }

.so-data-row {
    background: var(--maths-surface);
    border: 1px solid var(--maths-border);
    border-radius: 12px;
    padding: 0.55rem 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.so-data-label {
    font-weight: 700;
    color: var(--maths-ink-muted);
    text-transform: uppercase;
    font-size: 1rem;
    letter-spacing: 0.05em;
}

.so-data-value {
    font-weight: 800;
    color: var(--maths-ink);
    font-variant-numeric: tabular-nums;
    font-size: 1.3rem;
    flex: 1 1 auto;
}

.so-data-add {
    min-width: 48px;
    min-height: 48px;
    font-size: 1.05rem;
}

.so-overlay-label,
.so-overlay-range-label {
    font-size: 17px;
}

.so-your-turn {
    background: #FFF7DE;
    border: 1px solid #F0C14B;
    border-radius: 12px;
    padding: 0.9rem 1.1rem;
    margin-top: 1rem;
}

.so-your-turn-label { font-weight: 800; color: #8a5a00; margin-bottom: 0.4rem; }
.so-your-turn-list { margin: 0; padding-left: 1.2rem; color: #5e3c00; font-weight: 600; }

body.display-mode .so-dot { pointer-events: none; }
/* The "add a data point" control is meaningless on a read-only snapshot. */
body.display-mode .so-data-add { display: none; }

/* Stat toggles stay clickable in display mode so the teacher can reveal
 * mean / median / mode / range one at a time during IWB narration. */
