/*
 * 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-trend-line
 */
/*
 * trend-line — SVG plot with categorical x-axis, numeric y-axis,
 * connecting polyline, best-fit trend line, and running-average line.
 * Two-column layout: plot card on the left, readings panel on the right.
 */

.maths-activity .tl-mode-chip {
    display: inline-block;
    margin-top: 0.4rem;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    background: var(--maths-accent);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.maths-activity .tl-mode-chip.tl-mode-guided {
    background: var(--maths-primary);
}

.maths-activity .tl-mode-chip.tl-mode-challenge {
    background: var(--maths-primary-dark);
}

/* Prompt card (guided + challenge) */
.maths-activity .tl-prompt {
    background: var(--maths-surface);
    border: 1px solid var(--maths-border);
    border-left: 6px solid var(--maths-primary);
    border-radius: 10px;
    padding: 0.8rem 1.1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.maths-activity .tl-prompt-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--maths-ink-muted);
}

.maths-activity .tl-prompt-label i {
    margin-right: 0.4rem;
    color: var(--maths-primary);
}

.maths-activity .tl-prompt-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--maths-ink);
    line-height: 1.35;
}

.maths-activity .tl-check-btn {
    align-self: flex-start;
    min-width: 180px;
}

/* Layout */
.maths-activity .tl-layout {
    display: grid;
    grid-template-columns: minmax(360px, 2fr) minmax(200px, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.maths-activity .tl-plot-card {
    background: var(--maths-surface);
    border: 1px solid var(--maths-border);
    border-radius: 10px;
    padding: 0.5rem;
    position: relative;
}

.maths-activity .tl-svg {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 420px;
    aspect-ratio: 640 / 380;
    margin: 0 auto;
    user-select: none;
    touch-action: manipulation;
}

/* SVG element styling via classes */
.maths-activity .tl-grid-line {
    stroke: var(--maths-grid-line);
    stroke-width: 1;
}

.maths-activity .tl-axis-line {
    stroke: var(--maths-ink-muted);
    stroke-width: 1.5;
}

.maths-activity .tl-axis-label {
    fill: var(--maths-ink-muted);
    font-family: 'Nunito', sans-serif;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.maths-activity .tl-axis-title {
    fill: var(--maths-ink);
    font-family: 'Nunito', sans-serif;
    font-size: 12px;
    font-weight: 700;
}

.maths-activity .tl-column-hit {
    fill: transparent;
    cursor: crosshair;
}

.maths-activity .tl-column-hit:hover {
    fill: var(--maths-surface-alt);
}

.maths-activity[data-readonly="true"] .tl-column-hit {
    cursor: default;
}

.maths-activity[data-readonly="true"] .tl-column-hit:hover {
    fill: transparent;
}

.maths-activity .tl-polyline {
    fill: none;
    stroke: var(--maths-primary);
    stroke-width: 2.5;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.maths-activity .tl-trend-line {
    fill: none;
    stroke: var(--maths-accent);
    stroke-width: 2;
    stroke-dasharray: 8 5;
    stroke-linecap: round;
}

.maths-activity .tl-average-line {
    fill: none;
    stroke: var(--maths-success);
    stroke-width: 1.5;
    stroke-dasharray: 3 4;
    opacity: 0.8;
}

.maths-activity .tl-point {
    fill: var(--maths-primary);
    stroke: #fff;
    stroke-width: 2;
    cursor: pointer;
    transition: r 0.1s ease;
}

.maths-activity .tl-point:hover {
    r: 9;
}

.maths-activity[data-readonly="true"] .tl-point {
    cursor: default;
}

.maths-activity[data-readonly="true"] .tl-point:hover {
    r: 7;
}

.maths-activity .tl-point-peak {
    fill: var(--maths-accent);
}

.maths-activity .tl-point-trough {
    fill: var(--maths-primary-dark);
}

.maths-activity .tl-point-prediction {
    fill: var(--maths-warning);
    stroke-dasharray: 3 2;
}

.maths-activity .tl-target-slot {
    fill: var(--maths-surface-alt);
    stroke: var(--maths-warning);
    stroke-width: 2;
    stroke-dasharray: 4 3;
    cursor: crosshair;
}

.maths-activity .tl-target-slot:hover {
    fill: #FBF4E4;
}

.maths-activity .tl-target-label {
    fill: var(--maths-warning);
    font-family: 'Nunito', sans-serif;
    font-size: 11px;
    font-weight: 700;
    text-anchor: middle;
}

.maths-activity .tl-legend-item {
    font-family: 'Nunito', sans-serif;
    font-size: 11px;
    font-weight: 600;
    fill: var(--maths-ink-muted);
}

/* Readout panel */
.maths-activity .tl-readout {
    background: var(--maths-surface);
    border: 1px solid var(--maths-border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
}

.maths-activity .tl-readout-heading {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--maths-ink-muted);
}

.maths-activity .tl-readout-list {
    margin: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.35rem 0.75rem;
    font-size: 0.95rem;
}

.maths-activity .tl-readout-list dt {
    font-weight: 600;
    color: var(--maths-ink-muted);
}

.maths-activity .tl-readout-list dd {
    margin: 0;
    font-weight: 700;
    color: var(--maths-ink);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.maths-activity .tl-readout-list dd.tl-readout-up {
    color: var(--maths-success);
}

.maths-activity .tl-readout-list dd.tl-readout-down {
    color: var(--maths-danger);
}

.maths-activity .tl-readout-empty {
    grid-column: 1 / -1;
    color: var(--maths-ink-muted);
    font-weight: 500;
    font-style: italic;
    text-align: center;
    padding: 0.5rem 0;
}


/* Your turn */
.maths-activity .tl-your-turn {
    background: var(--maths-surface);
    border: 1px solid var(--maths-border);
    border-left: 6px solid var(--maths-accent);
    border-radius: 10px;
    padding: 0.9rem 1.15rem;
}

.maths-activity .tl-your-turn-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--maths-accent-dark);
    margin-bottom: 0.5rem;
}

.maths-activity .tl-your-turn-label i {
    margin-right: 0.4rem;
}

.maths-activity .tl-your-turn-list {
    margin: 0;
    padding-left: 1.25rem;
    color: var(--maths-ink);
    font-size: 1rem;
    line-height: 1.5;
}

.maths-activity .tl-your-turn-list li + li {
    margin-top: 0.35rem;
}

@media (max-width: 720px) {
    .maths-activity .tl-layout {
        grid-template-columns: 1fr;
    }
}

/* Display mode — content-step explainer. Plot + readings only. */
.maths-activity[data-display-mode="true"] .tl-prompt,
.maths-activity[data-display-mode="true"] .tl-callout,
.maths-activity[data-display-mode="true"] .tl-your-turn {
    display: none;
}

.maths-activity[data-display-mode="true"] .tl-column-hit {
    pointer-events: none;
    cursor: default;
}

.maths-activity[data-display-mode="true"] .tl-point {
    pointer-events: none;
    cursor: default;
}
