/* The question box (teacher-box.js) and the challenge home (teacher-challenges.js). Laptop first (1366–1440),
   one column under 1100px of content, still usable at 375. Tokens only (tokens.css + the design files). */

/* things the dashboard hides with [hidden] whose own display would win */
#settings-challenge-card .t-srow[hidden], #qm-lesson-row[hidden], .t-podcard[hidden],
#modal-question [hidden] { display: none !important; }
.bx-lesson-pick { max-height: 190px; overflow: auto; padding: 2px; }

/* ---------- shared bits ---------- */
.bx-lv, .chh-pill, .bx-pill, .bx-own { font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px; white-space: nowrap; line-height: 1.6; }
.bx-lv--easy { background: var(--success-tint); color: var(--success); }
.bx-lv--mid { background: var(--reward-tint); color: var(--on-reward); }
.bx-lv--hard { background: var(--error-tint); color: var(--error); }
.bx-own { background: var(--tint); color: var(--on-tint); }
.chh-pill.is-test { background: var(--success-tint); color: var(--success); }
.chh-pill.is-train { background: var(--tint); color: var(--on-tint); }
.bx-seg, .chh-seg { display: inline-flex; border: 1.5px solid var(--card-border); border-radius: 12px; overflow: hidden; background: var(--surface); flex-wrap: nowrap; max-width: 100%; }
.bx-seg button, .chh-seg button { border: 0; background: transparent; padding: 7px 14px; font: inherit; font-weight: 700; color: var(--deep); cursor: pointer; min-height: 38px; white-space: nowrap; }
.bx-seg button + button, .chh-seg button + button { border-inline-start: 1.5px solid var(--card-border); }
.bx-seg button[aria-pressed="true"], .chh-seg button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.bx-seg button:disabled { opacity: .5; cursor: not-allowed; }
.bx-seg--sm button { padding: 5px 10px; min-height: 34px; font-size: 14.5px; }

/* ---------- the box ---------- */
.bx-host { gap: var(--s4); }
.bx-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(340px, 1fr); gap: var(--s5); align-items: start; }
.bx-main { min-width: 0; }
.bx-rev { padding: var(--s3) var(--s4); margin-block-end: var(--s2); }
.bx-rev-h { font-weight: 700; color: var(--deep); display: flex; align-items: center; gap: 6px; margin-block-end: var(--s2); }
.bx-rev-h i { color: var(--primary); font-size: 22px; }
.bx-rev-b { display: flex; flex-wrap: wrap; gap: var(--s2); }
.bx-rev-s { font-size: 14.5px; color: var(--muted); margin-block-start: var(--s2); }

.bx-chap { display: flex; align-items: center; gap: 10px; margin: 22px 0 10px; font-family: var(--f-head); font-weight: var(--hw); color: var(--deep); font-size: 17.5px; }
.bx-chap i { color: var(--accent); font-size: 22px; }
.bx-chap .bx-ln { flex: 1; height: 1.5px; background: var(--border); }

.bx-wk { border: 1.5px solid var(--border); border-radius: 14px; margin-bottom: 10px; background: var(--surface); overflow: hidden; }
.bx-wk.is-cur { border: 2.5px solid var(--accent); box-shadow: 0 0 0 5px var(--tint); margin: 16px 0; }
.bx-wk.is-cur > .bx-wh { background: var(--tint); }
.bx-wk.is-cur .bx-wn { font-size: 20px; }
.bx-wk.is-past { opacity: .6; background: var(--surface-2); }
.bx-wk.is-past:hover, .bx-wk.is-past.open, .bx-wk.is-past:focus-within { opacity: 1; }
.bx-wk.is-past .bx-wn { text-decoration: line-through; text-decoration-color: var(--accent); }
.bx-wh { display: flex; align-items: center; gap: 12px; padding: 12px 16px; width: 100%; background: none; border: 0; text-align: start; color: inherit; font: inherit; cursor: pointer; min-height: 52px; }
.bx-mark { width: 26px; height: 26px; border-radius: 50%; background: var(--tint); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-size: 16.5px; flex: none; }
.bx-mark.is-future { background: none; border: 1.5px dashed var(--card-border); }
.bx-wk.is-cur .bx-mark { background: var(--accent); color: #fff; }
.bx-wn { font-family: var(--f-head); font-weight: var(--hw); color: var(--deep); min-width: 84px; white-space: nowrap; }
.bx-wt { flex: 1; min-width: 0; color: var(--muted); font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bx-pill.is-now { background: var(--accent); color: #fff; }
.bx-pill.is-past { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.bx-wc { font-size: 14.5px; color: var(--muted); white-space: nowrap; }
.bx-chev { color: var(--primary); transition: transform .2s; font-size: 20px; flex: none; }
.bx-wk.open > .bx-wh .bx-chev, .bx-ls.open .bx-ls-b .bx-chev { transform: rotate(-90deg); }
.bx-wb { border-top: 1.5px solid var(--border); }

.bx-ls + .bx-ls { border-top: 1px solid var(--border); }
.bx-ls-h { display: flex; align-items: center; gap: var(--s2); padding-inline-end: var(--s3); background: var(--surface-2); }
.bx-ls-b { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: none; border: 0; font: inherit; font-weight: 700; color: var(--deep); text-align: start; cursor: pointer; min-height: 46px; }
.bx-ls-b > i:first-child { color: var(--primary); font-size: 21px; flex: none; }
.bx-ls-n { flex: 1; min-width: 0; }
.bx-ls-c { font-weight: 400; font-size: 14.5px; color: var(--muted); white-space: nowrap; }
.bx-ls-c b { color: var(--primary); font-weight: 700; }
.bx-new { flex: none; }

.bx-q { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-top: 1px solid var(--border); transition: background-color .15s; }
.bx-q.is-picked { background: color-mix(in srgb, var(--tint) 70%, transparent); }
.bx-q.is-hidden { opacity: .55; }
.bx-q-l { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding-block: 4px; }
.bx-q-l input { width: 18px; height: 18px; margin-block-start: 4px; accent-color: var(--primary); flex: none; cursor: pointer; }
.bx-q.is-hidden .bx-q-l { cursor: default; }
.bx-q-t { flex: 1; min-width: 0; font-size: 16px; line-height: 1.7; }
.bx-q-m { display: flex; align-items: center; gap: 6px; flex: none; }
.bx-use { font-size: 13px; color: var(--muted); min-width: 74px; text-align: start; white-space: nowrap; }
.bx-use.is-used { color: var(--primary); font-weight: 700; }
.bx-ib { width: 32px; height: 32px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-size: 18.5px; cursor: pointer; }
.bx-ib:hover { background: var(--tint); color: var(--deep); }
.bx-more { display: block; width: 100%; padding: 10px 16px; border: 0; border-top: 1px solid var(--border); background: none; color: var(--primary); font: inherit; font-weight: 700; text-align: start; cursor: pointer; }
.bx-none { padding: 12px 16px; font-size: 15.5px; color: var(--muted); }

/* the tray */
.bx-tray { position: sticky; top: var(--s4); max-height: calc(100vh - 2 * var(--s4)); overflow: auto; padding: var(--s5); display: flex; flex-direction: column; gap: var(--s4); scroll-margin-top: var(--s4); }
.bx-tray h2 { font-family: var(--f-head); font-weight: var(--hw); font-size: 21px; color: var(--deep); display: flex; align-items: center; gap: 8px; }
.bx-tray h2 i { color: var(--accent); font-size: 26.5px; }
.bx-sub { font-size: 14.5px; color: var(--muted); margin-top: calc(-1 * var(--s3)); }
.bx-edit { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; background: var(--reward-tint); color: var(--on-reward); border-radius: 12px; padding: 8px 12px; font-size: 15px; font-weight: 700; }
.bx-edit span { display: inline-flex; align-items: center; gap: 6px; }
.bx-f { display: flex; flex-direction: column; gap: 6px; }
.bx-lbl { font-weight: 700; font-size: 15.5px; color: var(--deep); }
.bx-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bx-when input[type="date"] { width: 100%; flex: 1 1 100%; }
.bx-when input[type="time"] { width: auto; flex: 1 1 110px; }
.bx-when input:disabled, #bx-title:disabled { opacity: .6; }
/* «من تاريخ / إلى تاريخ»: two rows, each a day and a time */
.bx-when { flex-direction: column; align-items: stretch; }
.bx-when2 { display: flex; gap: 8px; align-items: center; }
.bx-when2 > span { min-width: 2.2em; font-weight: 700; }
.bx-when .bx-when2 input[type="date"] { flex: 1 1 140px; width: auto; min-width: 0; }
.bx-when .bx-when2 input[type="time"] { flex: 1 1 110px; width: auto; min-width: 0; }
.bx-hint { font-size: 14px; color: var(--muted); }
.bx-msg:empty { display: none; }
.bx-picked { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow: auto; }
.bx-picked li { background: var(--surface-2); border-radius: 10px; padding: 6px 10px; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.bx-picked li > b { color: var(--primary); min-width: 1.2em; font-family: var(--f-head); }
.bx-pk-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bx-pk-l { font-size: 12.5px; color: var(--on-tint); background: var(--tint); border-radius: 999px; padding: 1px 8px; white-space: nowrap; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
.bx-x { border: 0; background: none; color: var(--accent); font-size: 18.5px; width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.bx-x:hover { background: var(--tint); }
.bx-picked li.bx-empty { border: 2px dashed var(--card-border); background: none; padding: 20px; flex-direction: column; text-align: center; color: var(--muted); }
.bx-picked li.bx-empty i { font-size: 29.5px; }
.bx-sw { color: var(--text); }
.bx-sw:disabled { opacity: .6; cursor: not-allowed; }
.bx-go { margin-top: var(--s1, 4px); }
.bx-go .btn-primary { flex: 1; justify-content: center; }
.bx-jump { display: none; }

/* the preview */
.bxp-dlg, .chr-dlg { max-width: 760px; }
.bxp-list { margin: 0; padding-inline-start: 22px; display: flex; flex-direction: column; gap: var(--s4); max-height: 60vh; overflow: auto; }
.bxp-list > li > p { font-weight: 700; margin-bottom: 6px; }
.bxp-list ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.bxp-list ul li { border: 1.5px solid var(--card-border); border-radius: 10px; padding: 6px 10px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.bxp-list ul li.is-right { border-color: var(--success); background: var(--success-tint); }
.bxp-list ul li.is-right i { color: var(--success); }

/* ---------- home: the challenge columns ---------- */
.chh { display: flex; flex-direction: column; gap: var(--s4); }
.chh-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; background: var(--tint); color: var(--on-tint); border-radius: 14px; padding: 10px 16px; }
.chh-top p { display: flex; align-items: center; gap: 8px; font-size: 16px; min-width: 0; }
.chh-top p i { font-size: 22px; }
.chh-top b { font-family: var(--f-head); }
.chh-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); align-items: start; }
.chh-col { padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.chh-colh { display: flex; align-items: center; gap: 8px; }
.chh-colh h2 { font-family: var(--f-head); font-weight: var(--hw); font-size: 18.5px; color: var(--deep); }
.chh-colh i { font-size: 24px; }
.chh-col--live .chh-colh i { color: var(--success); }
.chh-col--upcoming .chh-colh i { color: var(--accent); }
.chh-col--ended .chh-colh i { color: var(--primary); }
.chh-n { margin-inline-start: auto; font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 1px 9px; }
.chh-empty { color: var(--muted); font-size: 15.5px; padding: 6px 0; }
.chh-empty a { color: var(--primary); font-weight: 700; }
.chh-ch { border: 1.5px solid var(--border); border-radius: 14px; padding: 12px 14px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.chh-ch.is-live { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.chh-ch-h { display: flex; align-items: flex-start; gap: 8px; justify-content: space-between; }
.chh-ch-h b { color: var(--deep); font-family: var(--f-head); line-height: 1.5; min-width: 0; }
.chh-meta { font-size: 14.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.chh-meta b { color: var(--text); }
.chh-bar { height: 10px; border-radius: 999px; background: var(--tint); overflow: hidden; margin: 6px 0 2px; }
.chh-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: inherit; transition: width .4s; }
.chh-row { display: flex; align-items: center; gap: 8px; font-size: 15px; flex-wrap: wrap; }
.chh-left { margin-inline-start: auto; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.chh-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chh-more { border: 0; background: none; color: var(--primary); font: inherit; font-weight: 700; cursor: pointer; padding: 4px 0; text-align: start; }

/* the ranking card is a .t-podcard (classic / bloom styles apply); its text column holds the period switch */
.chh-rank { grid-template-columns: minmax(340px, 1fr) 360px minmax(0, 1fr); }
.chh-rank .chh-seg button { padding-inline: 12px; }
.chh-rank h2 { display: flex; align-items: center; gap: 8px; }
.chh-rank h2 i { color: var(--reward); font-size: 26.5px; }
.chh-rank .chh-seg { margin-block: var(--s2); }
.chh-range-t { font-weight: 700; color: var(--text); }
.chh-range { display: flex; gap: var(--s2); flex-wrap: wrap; margin-block-end: var(--s2); }
.chh-range[hidden] { display: none; }
.chh-range label { display: flex; align-items: center; gap: 6px; font-size: 15.5px; }
.chh-range input { width: auto; min-width: 140px; }

/* results */
.chr-wrap { max-height: 60vh; overflow: auto; }
.chr-tbl td, .chr-tbl th { padding: 8px 10px; text-align: start; }
.chr-ok { display: inline-flex; align-items: center; gap: 4px; color: var(--success); font-size: 14.5px; }
.chr-mid { color: var(--warn); font-size: 14.5px; }

/* ---------- narrower screens ---------- */
@media (max-width: 1279.98px) {
    .bx-grid { grid-template-columns: minmax(0, 1.2fr) minmax(320px, 1fr); }
    .bx-wt { display: none; }
}
@media (max-width: 1099.98px) {
    .bx-grid, .chh-cols, .chh-rank { grid-template-columns: minmax(0, 1fr); }
    .bx-tray { position: static; max-height: none; }
    .bx-wt { display: block; }
    .bx-jump { display: inline-flex; position: sticky; bottom: var(--s3); align-self: center; z-index: 5; align-items: center; gap: 6px; background: var(--primary); color: var(--on-primary); border-radius: 999px; padding: 10px 18px; font-weight: 700; box-shadow: var(--btn-shadow); text-decoration: none; }
}
@media (max-width: 639.98px) {
    .bx-wh { flex-wrap: wrap; gap: 6px 10px; padding: 10px 12px; }
    .bx-wt { flex-basis: 100%; order: 5; white-space: normal; }
    .bx-wc { margin-inline-start: auto; }
    .bx-q { flex-wrap: wrap; padding: 8px 12px; }
    .bx-q-m { width: 100%; padding-inline-start: 28px; flex-wrap: wrap; }
    .bx-ls-h { flex-wrap: wrap; padding-inline-end: 0; }
    .bx-new { margin-inline-start: 40px; margin-block-end: 6px; }
    .bx-tray { padding: var(--s4); }
    .bxp-list ul { grid-template-columns: minmax(0, 1fr); }
    .chh-seg { width: 100%; }
    .chh-seg button { flex: 1; padding-inline: 6px; }
}
