/*
 * 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-tally-chart
 */
/*
 * tally-chart — live count-and-tick chart. Tap a category row to add a
 * tally mark; every fifth tally crosses the previous four (classic
 * schoolyard tally). Use during a class survey, dice experiment, or
 * roll-and-record activity.
 */

.maths-activity .tc-chart {
    background: #fffaf0;
    border: 1px solid var(--maths-border, #e0e7ef);
    border-radius: 14px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 10px rgba(20, 40, 80, 0.05);
    overflow-x: auto;
}

.maths-activity .tc-table {
    width: 100%;
    border-collapse: collapse;
    font-weight: 700;
}

.maths-activity .tc-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    background: #f1f8e9;
    color: var(--maths-primary-dark, #1b5e20);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--maths-primary, #2E7D32);
}

.maths-activity .tc-th-count { text-align: right; width: 80px; }
.maths-activity .tc-th-controls { width: 100px; }

.maths-activity .tc-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--maths-border, #e0e7ef);
    vertical-align: middle;
    font-size: 1rem;
}

.maths-activity .tc-cat-cell {
    color: var(--maths-text, #1f2937);
    font-weight: 700;
}

.maths-activity .tc-tally-cell {
    cursor: pointer;
    min-width: 220px;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    transition: background-color 140ms ease-out;
}

.maths-activity .tc-tally-cell:hover { background: #fff8e1; }

.maths-activity .tc-tally-svg {
    height: 28px;
    width: auto;
    overflow: visible;
}

.maths-activity .tc-tally-bar {
    stroke: #1b5e20;
    stroke-width: 2.5;
    stroke-linecap: round;
}

.maths-activity .tc-tally-cross {
    stroke: #d84315;
    stroke-width: 2.5;
    stroke-linecap: round;
}

.maths-activity .tc-count-cell {
    text-align: right;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--maths-primary-dark, #1b5e20);
    font-variant-numeric: tabular-nums;
}

.maths-activity .tc-controls-cell { text-align: right; }

.maths-activity .tc-btn {
    background: var(--maths-primary, #2E7D32);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.3rem 0.55rem;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    line-height: 1;
    margin-left: 0.25rem;
}

.maths-activity .tc-btn:hover { filter: brightness(1.08); }
.maths-activity .tc-btn:disabled { background: #cbd5e1; cursor: not-allowed; }
.maths-activity .tc-btn-minus { background: #d84315; }
.maths-activity .tc-btn-minus:hover { background: #bf360c; }
.maths-activity .tc-btn-minus:disabled { background: #cbd5e1; }

.maths-activity .tc-total-label {
    font-weight: 800;
    color: var(--maths-primary-dark, #1b5e20);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    border-top: 2px solid var(--maths-primary, #2E7D32);
}

.maths-activity .tc-total-count {
    text-align: right;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--maths-primary-dark, #1b5e20);
    border-top: 2px solid var(--maths-primary, #2E7D32);
    font-variant-numeric: tabular-nums;
}

.maths-activity .tc-mode-chip {
    display: inline-block;
    background: var(--maths-primary, #2E7D32);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    margin-top: 0.25rem;
}

.maths-activity .tc-your-turn {
    margin-top: 1.25rem;
    background: #f1f8e9;
    border: 1px solid #aed581;
    border-radius: 14px;
    padding: 1rem 1.25rem;
}

.maths-activity .tc-your-turn-label {
    font-weight: 800;
    color: #33691e;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.maths-activity .tc-your-turn-list {
    margin: 0;
    padding-left: 1.25rem;
    color: #1f2937;
    font-weight: 600;
}

.maths-activity .tc-your-turn-list li { margin-bottom: 0.25rem; }

/* Display mode — content snapshot. Hide the +/- control column and
 * disable click-to-add on the tally cells. Tighten cell padding and
 * tally-mark height so a multi-row chart fits without scrolling.
 * Your-turn prompts stay — those are display-only discussion prompts.
 */
body.display-mode .tc-controls-cell,
body.display-mode .tc-th-controls { display: none !important; }

body.display-mode .tc-tally-cell { cursor: default !important; pointer-events: none; }
body.display-mode .tc-tally-cell:hover { background: transparent; }

body.display-mode .tc-table td {
    padding: 0.3rem 0.6rem;
    font-size: 0.95rem;
}

body.display-mode .tc-table th {
    padding: 0.4rem 0.6rem;
    font-size: 0.78rem;
}

body.display-mode .tc-tally-cell {
    min-width: 180px;
    padding: 0.25rem 0.6rem;
}

body.display-mode .tc-tally-svg {
    height: 22px;
}

body.display-mode .tc-count-cell {
    font-size: 1.05rem;
}

body.display-mode .tc-total-count {
    font-size: 1.2rem;
}

/* Compute mode — pupils type the frequency they count from the marks */
.maths-activity .tc-check-panel { margin-bottom: 1rem; }
.maths-activity .tc-check-prompt { flex: 1; font-weight: 700; color: #1f2937; }
.maths-activity .tc-count-input {
    width: 64px;
    padding: 0.3rem 0.4rem;
    font-size: 1.1rem;
    font-weight: 800;
    font-family: inherit;
    text-align: center;
    color: #1f2937;
    border: 2px solid var(--maths-border, #cfd8e3);
    border-radius: 8px;
    background: #fff;
}
.maths-activity .tc-count-input:focus { outline: none; border-color: var(--maths-primary, #2E7D32); }
.maths-activity .tc-count-input.is-correct { border-color: var(--maths-primary, #2E7D32); background: #e8f5e9; color: #1b5e20; }
.maths-activity .tc-count-input.is-wrong { border-color: #d84315; background: #fdecea; color: #b71c1c; }
