/*
 * Test Paper Maker: the question editor and the page preview. The workspace,
 * panels, form sections and export column come from snapshot.css and
 * recap.css; the paper itself is styled inside the preview frame
 * (test-paper-layout.js), where the app's styles cannot reach it.
 */

.tp-starters { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .3rem; margin: .5rem 0 .9rem; }
.tp-starters > span { flex-basis: 100%; color: var(--text-tertiary); font-size: var(--text-xs); font-weight: 700; letter-spacing: var(--label-spacing); text-transform: uppercase; }
/* the shared reminder about client identifiers is for the adviser tools; a test paper holds no one's details */
.tp-workspace .pii-tip { display: none; }
.tp-optional { color: var(--text-tertiary); font-size: var(--text-xs); font-style: normal; font-weight: 500; margin-left: .25rem; }
#tp-details > label, #tp-details .field-grid { margin-bottom: .75rem; }
.tp-hint { margin: .35rem 0 .2rem; color: var(--text-tertiary); font-size: var(--text-xs); line-height: 1.45; }

/* sections and questions */
.tp-section-card { margin: .9rem 0 1rem; padding: .85rem .85rem .6rem; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: rgb(255 255 255 / 2%); }
.tp-section-head { display: flex; align-items: flex-end; gap: .5rem; }
.tp-section-title { flex: 1; margin: 0 !important; }
.tp-section-title input { font-weight: 700; }
.tp-section-head .item-actions { padding-bottom: .15rem; }
.tp-item-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .1rem; }
.tp-item-label { color: var(--accent-mint); font-size: var(--label-size); font-weight: 700; letter-spacing: var(--label-spacing); text-transform: uppercase; }
.tp-item-label.is-empty { color: var(--text-tertiary); }
.tp-item--passage { border-left: 3px solid var(--accent-gold); }
.tp-item .field { margin: .55rem 0; }
.tp-options-edit { margin: .4rem 0 .2rem; }
.tp-option { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: .45rem; margin: .35rem 0; }
.tp-option input[type="radio"] { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--accent-mint); cursor: pointer; }
.tp-option input[data-option] { margin-top: 0; min-height: 2.4rem; padding: .45rem .6rem; }
.tp-option-letter { color: var(--text-secondary); font-size: var(--text-sm); font-weight: 700; width: 1rem; text-align: center; }
.tp-icon-button { display: grid; place-items: center; min-width: 2.2rem; min-height: 2.2rem; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-secondary); cursor: pointer; }
.tp-icon-button:hover:not(:disabled) { background: rgb(255 143 128 / 10%); color: var(--danger); }
.tp-icon-button:disabled { opacity: .25; cursor: default; }
.tp-add-row { display: flex; align-items: center; gap: .5rem; margin-top: .55rem; }
.tp-add-row select { flex: 1; min-width: 0; margin-top: 0; }
.tp-add-row .quiet-button { white-space: nowrap; }
.tp-picture input[type="file"] { margin-top: .35rem; }
.tp-thumb { display: flex; align-items: center; gap: .6rem; margin: .55rem 0; }
.tp-thumb img { max-width: 7.5rem; max-height: 5rem; border-radius: .4rem; border: 1px solid var(--border-subtle); background: #fff; object-fit: contain; }
.tp-files { display: grid; gap: .5rem; margin: .6rem 0 .9rem; }
.tp-files .quiet-button { justify-self: start; }

/* the preview: the pages scroll inside their own frame */
.tp-stage { height: calc(100vh - var(--header-h) - var(--section-gap) * 2 - 3.9rem); min-height: 30rem; margin-top: .6rem; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); overflow: hidden; background: #e7e3da; }
#tp-preview { width: 100%; height: 100%; }
#tp-preview .pe-frame { display: block; width: 100%; height: 100%; border: 0; }
#tp-summary { color: var(--text-secondary); font-size: var(--text-sm); white-space: nowrap; align-self: flex-end; }

/* print column */
.tp-choice { display: grid; gap: .45rem; margin: 0; border: 0; border-bottom: 1px solid var(--border-subtle); }
.tp-choice label { display: flex; align-items: flex-start; gap: .6rem; padding: .6rem .7rem; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); cursor: pointer; }
.tp-choice label:has(input:checked) { border-color: var(--accent-mint); background: rgb(95 227 191 / 6%); }
.tp-choice input { margin: .2rem 0 0; accent-color: var(--accent-mint); }
.tp-choice strong { display: block; color: var(--text-primary); font-size: var(--text-sm); }
.tp-choice small { display: block; color: var(--text-tertiary); font-size: var(--text-xs); line-height: 1.4; }
.tp-two { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.tp-issues { margin-top: 1rem; padding: .7rem .85rem; border: 1px solid rgb(242 184 91 / 35%); border-left: 3px solid var(--warning); border-radius: var(--radius-sm); background: rgb(242 184 91 / 7%); color: var(--text-secondary); font-size: var(--text-xs); line-height: 1.5; }
.tp-issues p { margin: 0 0 .3rem; color: var(--text-primary); font-weight: 700; }
.tp-issues ul { margin: 0; padding-left: 1.1rem; }
.export-grid .tp-print { grid-column: 1 / -1; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: var(--button-h); border: 0; border-radius: var(--radius-md); background: var(--accent-mint); color: var(--accent-mint-ink); font: inherit; font-weight: 800; cursor: pointer; }
.export-grid .tp-print:hover:not(:disabled) { box-shadow: var(--glow-mint); }
.export-grid .tp-print:disabled { opacity: .6; cursor: progress; }
.export-grid .tp-print svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 48rem) {
    .tp-stage { height: 78vh; min-height: 26rem; }
    .tp-two { grid-template-columns: 1fr; }
    /* on the other tabs the preview stays laid out, off-screen, so it can be measured and printed from anywhere */
    .tp-workspace #preview-panel:not(.is-mobile-active) { display: block; position: absolute; left: -10000px; top: 0; width: 100%; pointer-events: none; }
}
