/* Visual Resources — builder UI. Matches the math/writing worksheet pages:
   a z-depth-2 form card (options beside the card editor), then the shared
   action-button row and a live paper preview. The mt-* rules are shared with
   those engines; the vr-* rules are builder-specific (card rows + chooser). */

.mt-builder { margin-top: 0.5rem; }

/* Form card */
.mt-form { background: #fff; border-radius: 12px; max-width: 900px; }

/* Two-column card body: Options | Cards */
.vr-form-grid {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 1rem 1.5rem;
    align-items: start;
    margin-bottom: 0.5rem;
}
@media (max-width: 991px) { .vr-form-grid { grid-template-columns: 1fr; } }
.vr-settings-wrap > .hint,
.vr-cards-wrap > .hint { margin-bottom: 0.5rem; }
.mt-options-col { display: flex; flex-direction: column; gap: 0.5rem; }

/* Checkboxes share the small circular style from the reading pages. */
.mt-field-check input {
    -webkit-appearance: none; appearance: none; flex: 0 0 auto;
    width: 16px; height: 16px; margin: 0;
    border: 1.5px solid #9aa0a6; border-radius: 50%; background: #fff; cursor: pointer;
}
.mt-field-check input:checked { border-color: #2b2b2b; background: radial-gradient(circle at center, #2b2b2b 0 4px, #fff 5px); }
.mt-field-check input:focus-visible { outline: 2px solid #0b5d4a; outline-offset: 2px; }

/* Option fields — sentence-case sub-labels above each control */
.mt-field-opt { display: flex; flex-direction: column; gap: 0.2rem; margin: 0; }
.mt-field-full { grid-column: 1 / -1; }
.mt-sublabel { margin: 0; font-size: 0.85rem; font-weight: 600; color: #4f4f4f; text-transform: none; letter-spacing: 0; }
.mt-field-opt .mt-input,
.mt-field-opt select,
.mt-field-opt input[type="number"] {
    padding: 0.35rem 0.5rem; border: 1px solid #ced4da; border-radius: 6px;
    background: #fff; font-size: 0.9rem; color: #1a1a1a; width: 100%; max-width: 13rem;
}
.mt-field-opt input[type="number"] { max-width: 6rem; }
.mt-field-check { flex-direction: row; align-items: center; gap: 0.5rem; }
.mt-field-check .mt-opt-text { font-size: 0.9rem; color: #2b2b2b; }

/* ===================== Card editor ===================== */
.vr-cards { display: flex; flex-direction: column; gap: 0.4rem; }
.vr-card-row {
    display: flex; align-items: center; gap: 0.5rem;
    border: 1px solid #e4e8ec; border-radius: 10px; padding: 0.35rem 0.5rem; background: #fbfcfd;
}
.vr-order { display: flex; flex-direction: column; gap: 1px; }
.vr-order button {
    border: none; background: transparent; color: #6c757d; cursor: pointer;
    font-size: 0.6rem; line-height: 1; padding: 3px 5px; border-radius: 4px;
}
.vr-order button:hover:not([disabled]) { background: #e9f6f1; color: #0f5b49; }
.vr-order button[disabled] { opacity: 0.3; cursor: default; }
.vr-rownum { font-size: 0.85rem; font-weight: 700; color: #6c757d; min-width: 1.3rem; text-align: right; }
.vr-prefix {
    flex: 0 0 auto; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em;
    color: #0f5b49; background: #e2f5ee; border-radius: 999px; padding: 4px 10px; min-width: 3.2rem; text-align: center;
}
.vr-icon-btn {
    flex: 0 0 auto; width: 52px; height: 52px; border: 1.5px dashed #b9c4d0; border-radius: 10px;
    background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 4px;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.vr-icon-btn:hover { border-color: #0f7c63; box-shadow: 0 1px 5px rgba(15, 124, 99, 0.25); }
.vr-icon-btn img { max-width: 40px; max-height: 40px; }
.vr-icon-btn .vr-emoji { display: block; }
.vr-thumb-empty { font-size: 1.4rem; color: #9aa0a6; line-height: 1; }
.vr-label-in {
    flex: 1 1 auto; min-width: 0; padding: 0.45rem 0.55rem; border: 1px solid #ced4da; border-radius: 6px;
    background: #fff; font-size: 0.95rem; color: #1a1a1a;
}
/* Multiline card text (social story pages) */
textarea.vr-label-ta { resize: vertical; min-height: 3.2rem; font-family: inherit; line-height: 1.4; }
.vr-card-row:has(.vr-label-ta) { align-items: flex-start; }
.vr-card-row:has(.vr-label-ta) .vr-icon-btn,
.vr-card-row:has(.vr-label-ta) .vr-order,
.vr-card-row:has(.vr-label-ta) .vr-rownum,
.vr-card-row:has(.vr-label-ta) .vr-del { margin-top: 0.3rem; }
.vr-nolabel { flex: 1 1 auto; }
.vr-del {
    flex: 0 0 auto; border: none; background: transparent; color: #9aa0a6; cursor: pointer;
    font-size: 1.3rem; line-height: 1; padding: 2px 6px; border-radius: 6px;
}
.vr-del:hover { color: #c1121f; background: #fdecec; }
.vr-add-btn { margin-top: 0.6rem; }

/* Actions */
.mt-actions { gap: 0.6rem !important; align-items: center; margin-top: 1rem; }
/* Fallback button styling (ws-actions.css, loaded site-wide, overrides via
   !important). Dark text on mint per the site's WCAG 2.1 AA palette. */
.mt-actions .ws-action-btn,
.vr-add-btn,
.vr-ch-go {
    border: none; border-radius: 999px; padding: 8px 16px; background-color: #29f1c3;
    color: #07261f; font-weight: 700; font-size: 12px; cursor: pointer;
    display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap;
}
.mt-actions .ws-action-btn:hover { filter: brightness(0.95); }
.mt-builder .ws-action-btn {
    padding: 9px 18px !important;
    font-size: 13px !important;
    min-height: 40px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
    transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.mt-builder .ws-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 12px rgba(15, 23, 42, 0.16);
    filter: brightness(0.97);
}
.mt-builder .ws-action-btn:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12); }
.mt-builder .ws-action-btn .icon { height: 14px; width: 14px; }

.mt-msg { font-size: 0.85rem; color: #1e7d2e; margin-left: 0.25rem; }
.mt-msg-err { color: #c1121f; }
.mt-msg-ok { color: #1e7d2e; }

/* Preview "paper" — full-size pages (WYSIWYG: matches the printed sheet). */
.mt-preview { margin-top: 1.25rem; }
.mt-window { padding: 0; }

/* ===================== Image chooser (modal) ===================== */
/* The modal shell + tab styles are shared with the math/writing practice
   modal so the chooser matches the site. */
.mt-modal { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; }
.mt-modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.55); }
.mt-modal-dialog {
    position: relative; background: #fff; border-radius: 14px; width: min(560px, 94vw);
    max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.mt-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid #eef2f6; }
.mt-modal-head h2 { margin: 0; font-size: 1.1rem; font-weight: 700; color: #1a1a1a; }
.mt-modal-close { border: none; background: transparent; font-size: 1.6rem; line-height: 1; cursor: pointer; color: #4b5563; padding: 0 4px; }
.mt-modal-close:hover { color: #111827; }

.mt-tabs { display: flex; gap: 6px; padding: 12px 18px 0; flex-wrap: wrap; }
.mt-tab {
    border: 1px solid #d0d5da; background: #fff; border-radius: 999px; padding: 7px 15px;
    font-size: 0.85rem; font-weight: 700; color: #2b2b2b; cursor: pointer;
}
.mt-tab:hover { border-color: #29c7a0; }
.mt-tab.is-active { background: #0f7c63; border-color: #0f7c63; color: #fff; }

.mt-modal-body { padding: 18px; overflow-y: auto; }

/* Category pills (same look as the practice modal's type tabs). */
.mt-ptabs { display: flex; gap: 6px; flex-wrap: wrap; }
.mt-ptype {
    border: 1px solid #d0d5da; background: #fff; border-radius: 8px; padding: 6px 12px;
    font-size: 0.8rem; font-weight: 600; color: #2b2b2b; cursor: pointer;
}
.mt-ptype:hover { border-color: #29c7a0; }
.mt-ptype.is-active { background: #0f7c63; border-color: #0f7c63; color: #fff; }

.vr-ch-search {
    width: 100%; padding: 0.5rem 0.65rem; border: 1.5px solid #ced4da; border-radius: 8px;
    font-size: 0.95rem; margin-bottom: 10px;
}
.vr-ch-cats { margin-bottom: 12px; }
.vr-ch-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px;
}
.vr-ch-item {
    border: 1.5px solid #e4e8ec; background: #fff; border-radius: 10px; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px 8px;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.vr-ch-item:hover { border-color: #0f7c63; box-shadow: 0 1px 6px rgba(15, 124, 99, 0.2); }
.vr-ch-item img { width: 44px; height: 44px; }
.vr-ch-lbl { font-size: 0.7rem; color: #4f4f4f; line-height: 1.15; text-align: center; }
.vr-ch-note { font-size: 0.85rem; color: #6c757d; margin: 0 0 12px; }
.vr-ch-photorow { display: flex; gap: 8px; align-items: center; }
.vr-ch-term {
    flex: 1 1 auto; min-width: 0; padding: 0.5rem 0.65rem; border: 1.5px solid #ced4da;
    border-radius: 8px; font-size: 0.95rem;
}
.vr-ch-uplabel {
    display: inline-flex; align-items: center; gap: 0.5rem; border: 1.5px dashed #b9c4d0;
    border-radius: 10px; padding: 14px 18px; cursor: pointer; font-size: 0.95rem; font-weight: 600; color: #2b2b2b;
}
.vr-ch-uplabel:hover { border-color: #0f7c63; }
.vr-ch-uplabel input[type="file"] { max-width: 210px; }
.vr-ch-upmsg { margin-top: 10px; }
