/*
 * 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-order-of-operations
 */
/*
 * order-of-operations activity styles.
 *
 * Two side-by-side boards: BIDMAS (correct) on the left, left-to-
 * right (wrong) on the right. Each board shows the expression as
 * a row of tokens (number / operator / bracket); the next operation
 * glows to suggest the tap. History below each board records the
 * reduction steps so pupils see how each evaluation unfolds.
 */

.oop-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;
}

.oop-target-label {
    font-weight: 800;
    color: #8a5a00;
    font-size: 0.95rem;
    margin-right: 0.5rem;
}

.oop-target-prompt {
    flex: 1 1 auto;
    color: #6b4500;
    font-weight: 700;
    font-size: 1rem;
}

.oop-expression-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--maths-surface);
    border: 1px solid var(--maths-border);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.oop-input-label {
    font-weight: 700;
    color: var(--maths-ink);
}

.oop-input {
    flex: 1 1 auto;
    font-family: 'Nunito', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: left;
    font-variant-numeric: tabular-nums;
}

.oop-stage {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.oop-board {
    background: var(--maths-surface);
    border: 1px solid var(--maths-border);
    border-radius: 12px;
    padding: 1rem 1.1rem;
}

.oop-board-bidmas {
    border-color: #66bb6a;
    background: #fbfff7;
}

.oop-board-wrong {
    border-color: #ef5350;
    background: #fffaf9;
}

.oop-board-title {
    font-weight: 800;
    color: var(--maths-primary-dark);
    margin-bottom: 0.6rem;
    letter-spacing: 0.02em;
    font-size: 1.15rem;
}

.oop-board-bidmas .oop-board-title { color: #166534; }
.oop-board-wrong .oop-board-title { color: #b71c1c; }

.oop-expression {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    min-height: 70px;
    font-family: 'Nunito', sans-serif;
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--maths-ink);
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed var(--maths-border);
    margin-bottom: 0.6rem;
}

.oop-token {
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-variant-numeric: tabular-nums;
}

.oop-token-number { background: var(--maths-surface-alt); color: var(--maths-primary-dark); }
.oop-token-op { background: transparent; color: var(--maths-ink); }
.oop-token-bracket { color: var(--maths-accent-dark); font-weight: 900; }

.oop-token-op.is-next-bidmas {
    background: #4caf50;
    color: #fff;
    cursor: pointer;
    animation: oop-glow-green 1.2s ease-in-out infinite;
}

.oop-token-op.is-next-wrong {
    background: #c62828;
    color: #fff;
    cursor: pointer;
    animation: oop-glow-red 1.2s ease-in-out infinite;
}

@keyframes oop-glow-green {
    0%, 100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
    50%      { box-shadow: 0 0 0 6px rgba(76, 175, 80, 0.35); }
}

@keyframes oop-glow-red {
    0%, 100% { box-shadow: 0 0 0 0 rgba(198, 40, 40, 0); }
    50%      { box-shadow: 0 0 0 6px rgba(198, 40, 40, 0.35); }
}

.oop-token-op[disabled],
body.display-mode .oop-token-op {
    cursor: default;
}

.oop-history {
    min-height: 60px;
    font-family: 'Nunito', monospace;
    font-variant-numeric: tabular-nums;
    color: var(--maths-ink);
    font-size: 1.1rem;
    line-height: 1.5;
    white-space: pre;
    font-weight: 700;
}

.oop-history-step {
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
}

.oop-history-step.is-final { color: var(--maths-primary-dark); font-size: 1.3rem; }

.oop-rules {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.oop-rule {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1rem;
    min-height: 52px;
    background: var(--maths-surface);
    border: 2px solid var(--maths-border);
    border-radius: 10px;
}

.oop-rule-letter {
    font-weight: 900;
    color: var(--maths-primary);
    font-size: 1.4rem;
    min-width: 2rem;
    text-align: center;
}

.oop-rule-name {
    font-weight: 700;
    color: var(--maths-ink);
    font-size: 1.05rem;
}

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

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

/* In display mode the expression-input row is redundant — both boards
 * carry the expression in their initial token row. */
body.display-mode .oop-expression-row {
    display: none;
}

/* The working-history strip reserves a floor for live evaluation; a static
 * snapshot only needs the height of whatever steps are actually shown. */
body.display-mode .oop-history { min-height: 0; }

/* On narrower IWBs (or zoomed-out projections) the side-by-side boards
 * shrink the tokens unreadably. Stack them so each board uses the full
 * width of the activity. */
@media (max-width: 980px) {
    .oop-stage { grid-template-columns: 1fr; }
}
