/* Interactive Exercise Styles - matching mathmuscle */

:root {
    --maths-font-size: 22pt;
    --maths-font-size-sup: 16pt;
    --maths-font-size-sub: 14pt;
    --maths-font-color: #597bd5;
    --color-green: green;
    --spacing1: 30px;
    --font-size-larger: 22pt;
    --font-size-smaller: 14pt;
}

/* Exercise rows */
.exerciseRow {
    display: inline-block;
    padding-top: var(--spacing1);
    padding-bottom: var(--spacing1);
    padding-left: 1em;
    width: 100%;
    border-top: 1px solid lightgrey;
    font-size: var(--maths-font-size);
    color: var(--maths-font-color);
}

.exercise-content-html {
    display: inline;
}

.exercise-row-html {
    display: inline;
}

.exercise-display {
    white-space: nowrap;
}

.exercise-answer {
    display: inline;
}

/* Math rendering */
.mathEquals {
    padding: 0 0.3em;
}

.sup {
    vertical-align: super;
    font-size: var(--maths-font-size-sup);
}

.sub {
    vertical-align: sub;
    font-size: var(--maths-font-size-sub);
}

.frac table {
    border-collapse: collapse;
    border-spacing: 0pt;
    display: inline-block;
    vertical-align: middle;
    margin: 0 0.2em;
    padding-bottom: 0.1em;
}

.frac tr {
    line-height: 1em;
    border-bottom: 2pt solid var(--maths-font-color);
    text-align: center;
}

.frac tr:last-child {
    border-bottom: none;
}

.frac td {
    margin: 0;
    padding: 0pt 0.2em;
    text-align: center;
    vertical-align: middle;
}

.mathcross {
    text-decoration: line-through;
    color: #999;
}

/* Input fields */
.numinput {
    font-family: inherit;
    font-size: inherit;
    color: var(--maths-font-color);
    text-align: center;
    height: 1.2em;
    border: 2px solid lightgrey;
    background: transparent;
    -webkit-appearance: none;
    -moz-appearance: textfield;
    padding: 0;
    margin: 0 0.2em;
}

.numinput::-webkit-outer-spin-button,
.numinput::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.numinput:focus {
    border-color: var(--maths-font-color);
}

.supinput {
    font-size: var(--maths-font-size-sup);
    text-align: left;
    width: 1em;
    margin: 0pt;
    padding: 0pt;
}

.fracinput {
    font-size: inherit;
    width: 2em;
}

/* Correct/incorrect feedback */
.numinput.correct {
    color: var(--color-green) !important;
}

.numinput.wrong {
    color: red !important;
}

.numinputSolved {
    pointer-events: none;
}

.row-tick {
    color: var(--color-green);
    font-size: var(--font-size-larger);
    font-weight: bold;
    margin-left: 20px;
}

.exerciseRow.row-correct {
    /* no background change - just tick mark */
}

.exerciseRow.row-incorrect {
    /* no background change - just tick mark */
}

/* Check answers button */
.btn-check-answers {
    background-color: #597bd5;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 0.7rem 1.5rem;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 1rem;
}

.btn-check-answers:hover {
    background-color: #4a6bc0;
}

.btn-check-answers.all-correct {
    background-color: var(--color-green);
}

/* Instructions button and modal */
.btn-instructions {
    background-color: #597bd5;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.4rem 1rem;
    font-size: 1.4rem;
    cursor: pointer;
    margin-left: 1rem;
    vertical-align: middle;
}

.btn-instructions:hover {
    background-color: #4a6bc0;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 8px;
    padding: 1.5rem 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: #666;
}

.modal-close:hover {
    color: #333;
}

.instructions-list {
    padding-left: 1.2rem;
    line-height: 1.8;
}

.instructions-list li {
    margin-bottom: 0.5rem;
}

/* Print */
@media print {
    .exerciseRow {
        border-top: 1px solid #ccc;
        padding-top: 10px;
        padding-bottom: 10px;
        page-break-inside: avoid;
        color: black;
    }
    .numinput {
        border: 1px solid #ccc;
        color: black;
    }
    .btn-check-answers, .btn-reset, .btn-instructions, .modal-overlay, .page-actions {
        display: none;
    }
}
