/* ================================================================
   lines.css
   ----------------------------------------------------------------
   Styling for the "What is a Line? (Foundations)" skill-quiz
   (E.1-E.5) on the Class 6 Math page. Exactly like patterns.css,
   every skill here shares ONE generic quiz modal (see lines.js)
   instead of one bespoke widget per skill — this file only styles
   the small set of reusable "visual" building blocks a line
   question can show above its answer chips: labelled point / line /
   segment / ray diagrams (single or side-by-side trio), a straight-
   or-curved path box, and a two-segment length-comparison box with
   a grid ruler. Loaded as a plain stylesheet link alongside
   quiz-popup-theme.css / quiz-modal-responsive.css, which already
   supply the shared .quiz-overlay / .quiz-modal / .card / .bq-* /
   .quiz-number-opt / .slot-dot rules every skill popup on the site
   uses.
   ================================================================ */

/* ---- Outer visual-question wrapper. Deliberately its own class
   (not the Pattern skills' external "pat-visual-wrap") so this
   module never depends on a rule defined in a different stylesheet
   loading correctly — it's self-contained end to end. The max-width
   / max-height here is a hard ceiling: even if a browser fails to
   pick up a rule further down for some reason, a diagram can never
   balloon past a sane size and blow out the modal. ---- */
.lin-visual-wrap {
    width: 100%;
    max-width: 480px;
    max-height: 320px;
    margin: 4px auto 6px;
    text-align: center;
    overflow: hidden;
    box-sizing: border-box;
}

/* ---- Shared diagram frame ---- */
.lin-diagram-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: #f8f9fb;
    border: 2px solid var(--line, #e2e8f0);
    border-radius: 14px;
    padding: 10px 8px 8px;
}
.lin-diagram-box svg {
    width: 100%;
    max-width: 220px;
    height: auto;
    display: block;
}
.lin-diagram-caption {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 13px;
    color: #6b7280;
    letter-spacing: 0.02em;
}

/* ---- Row of 3 diagrams (point / line / segment / ray) side by side ---- */
.lin-diagram-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    gap: 12px;
    margin: 16px auto 8px;
    max-width: 520px;
}
.lin-diagram-row .lin-diagram-box {
    flex: 1 1 140px;
    max-width: 170px;
}

/* ---- Single centered diagram (Ray, Naming skills) ---- */
.lin-diagram-single {
    display: flex;
    justify-content: center;
    margin: 18px auto 8px;
}
.lin-diagram-single .lin-diagram-box {
    max-width: 300px;
    width: 100%;
    padding: 16px 14px 12px;
}

/* ---- Notation pill text used inside answer options (Line AB, Ray AB...) ---- */
.lin-notation {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
}
.lin-notation.lin-note-segment { text-decoration: overline; text-decoration-thickness: 2px; }
.lin-notation-symbol {
    display: inline-block;
    margin-left: 4px;
    font-weight: 700;
    color: var(--secondary, #1d4ed8);
}

/* ---- Straight / Curved path box (E.4) ---- */
.lin-path-single {
    display: flex;
    justify-content: center;
    margin: 18px auto 8px;
}
.lin-path-single .lin-diagram-box {
    max-width: 320px;
    width: 100%;
    padding: 18px 14px 12px;
}

/* ---- Comparing lengths (E.5): two stacked segments over a dashed grid ---- */
.lin-compare-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 16px auto 8px;
    max-width: 380px;
    background: #f8f9fb;
    border: 2px solid var(--line, #e2e8f0);
    border-radius: 14px;
    padding: 14px 12px 10px;
}
.lin-compare-wrap svg {
    width: 100%;
    height: auto;
    display: block;
}

/* ---- Answer chips: reuse the shared quiz-number-opt button, but line
   answers are often labels/notation ("Segment A", "Line AB \u2194")
   rather than a single digit, so override the shared fixed circle
   sizing to a pill that grows to fit its own text and wraps if
   needed — same pattern as pattern.css' #patternOptions override. ---- */
.lin-options-wrap {
    margin: 14px auto 0;
    max-width: 480px;
    box-sizing: border-box;
}

/* Scoped to #lineOptions so these out-specificity the shared quiz
   theme's ".quiz-number-opt" / ".quiz-number-options" rules (built
   for single-digit 0-9 answers). !important guards against any
   theme rule loaded after this file. */
#lineOptions.quiz-number-options {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: stretch !important;
    gap: 10px !important;
    width: 100%;
    box-sizing: border-box;
}
#lineOptions .lin-opt-btn {
    width: auto !important;
    height: auto !important;
    min-width: 64px !important;
    min-height: 48px !important;
    max-width: 100%;
    flex: 0 1 auto !important;
    border-radius: 16px !important;
    padding: 10px 18px !important;
    white-space: normal !important;
    overflow-wrap: break-word;
    word-break: normal !important;
    line-height: 1.25 !important;
    text-align: center !important;
    box-sizing: border-box;
}
#lineOptions .lin-opt-btn.is-correct-choice {
    border-color: #10b981;
    background: color-mix(in srgb, #10b981 14%, white);
    color: #0d7a53;
}
#lineOptions .lin-opt-btn.is-wrong-choice {
    border-color: #ef4444;
    background: color-mix(in srgb, #ef4444 14%, white);
    color: #b91c1c;
}
#lineOptions .lin-opt-btn:disabled {
    cursor: default;
    transform: none;
}

/* Feedback + summary stars, scoped so they render correctly even if
   the shared theme file doesn't already style these modifier
   classes. */
#lineQuizCard .bq-feedback.is-correct { color: #0d7a53; }
#lineQuizCard .bq-feedback.is-wrong { color: #b91c1c; }
#lineSummaryCard .bq-star {
    font-size: 28px;
    color: #d1d5db;
    margin: 0 2px;
}
#lineSummaryCard .bq-star.filled { color: #f5b942; }

/* ---- Mobile responsiveness ---- */
@media (max-width: 560px) {
    .lin-visual-wrap { max-height: 260px; }
    .lin-diagram-row { gap: 8px; }
    .lin-diagram-row .lin-diagram-box { flex: 1 1 100px; max-width: 32%; padding: 8px 5px 6px; }
    .lin-diagram-caption { font-size: 11px; }
    .lin-diagram-single .lin-diagram-box,
    .lin-path-single .lin-diagram-box { max-width: 88%; padding: 12px 8px 10px; }
    .lin-compare-wrap { max-width: 100%; padding: 10px 8px 8px; }
}

@media (max-width: 400px) {
    .lin-diagram-row .lin-diagram-box { min-width: 84px; padding: 6px 4px 5px; }
    .lin-diagram-single .lin-diagram-box,
    .lin-path-single .lin-diagram-box { max-width: 96%; padding: 10px 6px 8px; }
    #lineOptions .lin-opt-btn { min-width: 52px !important; min-height: 42px !important; padding: 8px 12px !important; font-size: 14px; }
}