/*
 * ALMOMANI — page-level styles
 * Only layout/composition rules that are specific to a page or feature.
 * Colours come from tokens.css; no raw colour values here.
 */

/* Directional icons flip in RTL */
[dir="rtl"] .icon-flip { transform: scaleX(-1); }

/* ---------- Home: news & events ---------- */
.post-card--event { border-block-start-color: var(--info-solid); }
.post-card .icon-btn { width: 34px; height: 34px; }
.color-indicator--brand { background: var(--brand-red); }
.color-indicator--info { background: var(--info-solid); }

/* ---------- Dashboard ---------- */
.activity-list { list-style: none; margin: 0; padding: var(--space-2) var(--space-5) var(--space-4); max-height: 360px; overflow-y: auto; font-size: var(--fs-sm); }
.activity-list li { display: flex; flex-direction: column; gap: 2px; padding: var(--space-3) 0 var(--space-3) var(--space-4); border-inline-start: 2px solid var(--border); position: relative; }
.activity-list li::before { content: ""; position: absolute; inset-inline-start: -5px; inset-block-start: 1.05rem; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-red); }
.activity-list time { font-size: var(--fs-xs); }

.chart-card { position: relative; height: 100%; }
.chart-card .card-body { padding: var(--space-5); }
.chart-card__expand { position: absolute; inset-block-start: var(--space-2); inset-inline-end: var(--space-2); z-index: 2; opacity: 0; transition: opacity var(--dur-fast) var(--ease); }
.chart-card:hover .chart-card__expand, .chart-card__expand:focus-visible, .chart-card.is-expanded .chart-card__expand { opacity: 1; }
@media (hover: none) { .chart-card__expand { opacity: 1; } }
.chart-card.is-expanded { position: fixed; inset: var(--space-6); z-index: 1060; height: auto; box-shadow: 0 0 0 100vmax var(--overlay), var(--shadow-lg); }
.chart-card.is-expanded .card-body { height: 100%; }
body.chart-expanded { overflow: hidden; }
@media (max-width: 575.98px) { .chart-card.is-expanded { inset: var(--space-2); } }

/* ---------- Profile ---------- */
.profile-card__head { padding: var(--space-6) var(--space-5) var(--space-4); text-align: center; background: var(--surface-2); border-block-end: 1px solid var(--border); }
.profile-card__avatar { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; border: 3px solid var(--surface); box-shadow: 0 0 0 2px var(--border-strong); margin-block-end: var(--space-3); background: var(--surface-3); }
.profile-section + .profile-section { margin-block-start: var(--space-6); padding-block-start: var(--space-6); border-block-start: 1px solid var(--border); }
.profile-section__title { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-4); font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.profile-section__title > i { color: var(--brand-text); }

/* Definition list as label/value rows */
.meta-list { margin: 0; display: grid; gap: var(--space-3); }
.meta-list > div { display: grid; grid-template-columns: minmax(110px, 200px) 1fr; gap: var(--space-4); }
.meta-list dt { font-weight: var(--fw-medium); color: var(--text-muted); }
.meta-list dd { margin: 0; word-break: break-word; }
@media (max-width: 575.98px) { .meta-list > div { grid-template-columns: 1fr; gap: 0; } }
.profile-card .meta-list > div { grid-template-columns: 1fr auto; font-size: var(--fs-sm); }

/* Admin tiles */
.admin-tile, .admin-tile:hover { color: var(--text); text-decoration: none; }

/* ---------- Generic section title above a table/card ---------- */
.section-title { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-3); font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.section-title > i { color: var(--brand-text); }
.section-title u { text-decoration: none; }

/* ---------- Video / learning page ---------- */
.video-frame { aspect-ratio: 16 / 9; width: 100%; background: #000; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-md); }
.video-frame video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.min-w-0 { min-width: 0; }
.flex { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ---------- Search results ---------- */
.result-list { display: grid; gap: var(--space-3); }
.result-item h2 a { color: var(--text); }
.result-item h2 a:hover { color: var(--link); }

/* ---------- Results tables ---------- */
.thumb-100 { max-width: 100px; }
.table tr.row-subtle > * { background: var(--surface-3); font-weight: var(--fw-semibold); }
.table tr.row-accent > * { background: var(--brand-red); color: var(--on-brand); font-weight: var(--fw-semibold); }
.bg-gray > * { background: var(--surface-2); }


/* Training programs (cards, cover, assignment lists) - tokens only, so Light/Dark follow the theme */
.program-card { overflow: hidden; }
.program-card__cover { display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 9; background: var(--brand-tint); color: var(--brand-text); font-size: 2.5rem; text-decoration: none; }
.program-card__cover img, .program-cover { display: block; width: 100%; height: 100%; object-fit: cover; }
.program-cover { height: auto; border-radius: var(--radius-md); }
.program-card__title { color: var(--text); text-decoration: none; }
.program-card__title:hover { color: var(--brand-text); text-decoration: underline; }
.program-description { line-height: 1.7; }
.assign-list { max-height: 24rem; overflow: auto; padding-inline-start: 0; }
.assign-list .form-check { margin-block-end: var(--space-2); }

/* Training content management + learning (Phase 4) - tokens only, so Light/Dark/System follow the theme */
.content-list { list-style: none; padding: 0; margin: var(--space-4) 0 0; display: grid; gap: var(--space-3); }
.content-row { display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.content-row--archived { border-inline-start-color: var(--border-strong); border-style: dashed; } /* no opacity: keeps text contrast (WCAG AA) */
.content-row__order { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.content-row__num { font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.content-row__order .icon-btn { width: 30px; height: 30px; }
.content-row__order .icon-btn[disabled] { opacity: .35; cursor: not-allowed; }
.content-row__actions { display: flex; align-items: center; gap: var(--space-2); }
.content-row__main a { color: var(--text); text-decoration: none; }
.content-row__main a:hover { color: var(--brand-text); text-decoration: underline; }
@media (max-width: 575.98px) { .content-row { grid-template-columns: auto 1fr; } .content-row__actions { grid-column: 1 / -1; justify-content: flex-end; } }
.richtext-toolbar { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-block-end: var(--space-2); }
textarea[data-richtext] { font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: .9rem; }
.resource-item { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding-block: var(--space-2); border-block-end: 1px solid var(--border); }
.resource-item--archived { border-style: dashed; } /* the Archived badge carries the meaning */
.resource-item__main { display: flex; gap: var(--space-2); align-items: flex-start; min-width: 0; overflow-wrap: anywhere; }
.resource-item__actions { display: flex; gap: 2px; flex-shrink: 0; }
.resource-item__actions .icon-btn { width: 30px; height: 30px; }
.outline-stage__num { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: var(--radius-pill); background: var(--brand-tint-strong); color: var(--brand-text); font-weight: 700; font-size: .8rem; margin-inline-end: var(--space-2); }
.outline-lessons { margin: var(--space-2) 0 0; padding-inline-start: 1.1rem; display: grid; gap: var(--space-1); }
.outline-lessons a { color: var(--text); text-decoration: none; }
.outline-lessons a:hover { color: var(--brand-text); text-decoration: underline; }
.lesson-nav__panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-3); }
@media (min-width: 992px) { .lesson-nav { position: sticky; top: var(--space-4); } .lesson-nav__panel { max-height: calc(100vh - 8rem); overflow: auto; } }
.lesson-nav__program { display: block; font-weight: 700; color: var(--text); text-decoration: none; margin-block-end: var(--space-2); }
.lesson-nav__stage { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin: var(--space-3) 0 var(--space-1); }
.lesson-nav__list { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.lesson-nav__link { display: flex; gap: var(--space-2); align-items: baseline; padding: .4rem .5rem; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.lesson-nav__link:hover { background: var(--surface-3); }
.lesson-nav__link.is-current { background: var(--brand-tint-strong); color: var(--brand-text); font-weight: 600; }
.video-frame { background: #000; border-radius: var(--radius-md); overflow: hidden; aspect-ratio: 16 / 9; box-shadow: var(--shadow-md); }
.video-frame video { width: 100%; height: 100%; display: block; background: #000; }
.lesson-content { line-height: 1.75; overflow-wrap: anywhere; }
.lesson-content h2, .lesson-content h3 { margin-block: 1.4rem .6rem; }
.lesson-content pre, .lesson-content code { background: var(--surface-3); border-radius: var(--radius-sm); }
.lesson-content pre { padding: var(--space-3); overflow: auto; }
.lesson-content code { padding: .1rem .3rem; }
.lesson-content blockquote { border-inline-start: 3px solid var(--border-strong); padding-inline-start: var(--space-3); color: var(--text-muted); }
.lesson-content a { color: var(--brand-text); text-decoration: underline; }
.resource-downloads li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-block-end: var(--space-2); }
.lesson-pager { display: flex; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.lesson-pager .btn { max-width: 100%; }
.lesson-pager__label { display: inline-block; max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* Cohorts, departments & mentors (Phase 5) - tokens only, so Light/Dark/System follow the theme */
.mentor-cards { display: grid; gap: var(--space-3); }
.mentor-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.mentor-card__name { font-weight: var(--fw-bold, 700); }
.mentor-card__role { color: var(--text-muted); font-size: var(--fs-sm, .875rem); }
.mentor-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3); padding-block: var(--space-3); border-block-end: 1px solid var(--border); }
.mentor-row:last-of-type { border-block-end: 0; }
.mentor-row__actions { min-width: min(100%, 22rem); }
@media (max-width: 575.98px) { .mentor-card .btn { width: 100%; } }
/* an absolutely positioned .visually-hidden label inside a scrolling table must be clipped by the scroller, not widen the page */
.table-responsive { position: relative; }

/* ---- Phase 6: progress, completion, locks (tokens only) ---- */
.progress--brand { height: .6rem; background: var(--surface-3); border-radius: var(--radius-pill); overflow: hidden; }
.progress--brand .progress-bar { background: var(--brand); }
.progress-block__label { margin-block-start: .25rem; font-weight: 600; }
.progress-block--compact .progress--brand { height: .45rem; }
.program-card__progress { min-height: 4.5rem; }
.lesson-nav__progress { margin-block-end: var(--space-3); }
.lesson-nav__link.is-done i { color: var(--success-text); }
.lesson-nav__link.is-locked { color: var(--text-muted); }
.lesson-nav__link i { flex: 0 0 1.1rem; text-align: center; }
.outline-stage--locked { opacity: .92; border-style: dashed; }
.outline-lessons { list-style: none; padding-inline-start: 0; }
.outline-lessons li.is-locked a { color: var(--text-muted); }
.outline-lessons i { margin-inline-end: var(--space-1); }
.lock-note { color: var(--text-muted); margin: 0; }
.locked-reasons { text-align: start; max-width: 38rem; margin-inline: auto; margin-block-end: var(--space-4); }

/* ---- Phase 7: assignments, submissions, reviews (tokens only) ---- */
.assignment-card--overdue { border-color: var(--danger-border); background: var(--danger-bg); }
.assignment-facts dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-block-start: var(--space-3); }
.assignment-facts dt:first-child { margin-block-start: 0; }
.assignment-facts dd { margin: 0; }
.submission-text { background: var(--surface-3); border-radius: var(--radius-sm); padding: var(--space-3); overflow-wrap: anywhere; }
.review-note { border-inline-start: 3px solid var(--border); padding: var(--space-2) var(--space-3); margin-block-start: var(--space-3); overflow-wrap: anywhere; }
.review-note--approved { border-color: var(--success-solid); }
.review-note--revision, .review-note--reopened { border-color: var(--warning-solid, var(--brand)); }
.review-note--rejected, .review-note--overturned { border-color: var(--brand); }
.attempt-card a { overflow-wrap: anywhere; }
.filter-tabs { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ---------- Video recorder + upload progress (lesson form, course video form) ---------- */
.video-tools { margin-block: var(--space-3); }
.video-recorder { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-3); padding: var(--space-3); margin-bottom: var(--space-3); }
.video-recorder__title { font-size: 1rem; margin: 0 0 var(--space-2); }
.video-recorder__modes { border: 0; padding: 0; margin: 0 0 var(--space-2); display: flex; flex-wrap: wrap; gap: var(--space-2); }
.video-recorder__stage { margin-block: var(--space-2); }
.video-recorder__live, .video-recorder__preview { display: block; width: 100%; max-width: 640px; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius-md); object-fit: contain; }
.video-recorder__live[hidden], .video-recorder__preview[hidden], [data-recorder][hidden], [data-upload-panel][hidden], [data-upload-retry][hidden] { display: none; }
.video-recorder__bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.video-recorder__time { font-variant-numeric: tabular-nums; margin-inline-start: auto; font-size: .875rem; }
.video-recorder__modes { gap: var(--space-2); }
.video-recorder__mode { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--touch-target); padding: 0 var(--space-3); margin: 0; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); cursor: pointer; font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.video-recorder__mode:hover { background: var(--surface-3); }
.video-recorder__mode:has(input:checked) { border-color: var(--primary, currentColor); box-shadow: 0 0 0 1px var(--primary, currentColor); }
.video-recorder__mode:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.video-recorder__mode input { margin: 0; }
.video-recorder__options { margin: 0 0 var(--space-2); padding: var(--space-2) var(--space-3); border: 1px dashed var(--border); border-radius: var(--radius-md); }
.video-recorder__options[hidden], .video-recorder__options [hidden], [data-rec-mic][hidden], [data-rec-warn][hidden], [data-rec-screen-note][hidden] { display: none; }
.video-recorder__corner { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--fs-sm); margin-top: var(--space-1); }
.video-recorder__corner .form-select { width: auto; }
.video-recorder__mic { display: flex; align-items: center; gap: var(--space-2); margin: var(--space-2) 0; font-size: var(--fs-sm); }
.video-recorder__mic--ok i { color: var(--success-solid); }
.video-recorder__mic--bad i, .video-recorder__mic--bad .video-recorder__mic-label { color: var(--danger-solid); font-weight: var(--fw-semibold); }
.video-recorder__meter { flex: 0 0 8rem; height: .5rem; border-radius: 999px; background: var(--border); overflow: hidden; }
.video-recorder__meter > span { display: block; height: 100%; width: 0; background: var(--success-solid); transition: width .12s linear; }
.video-recorder__mic--bad .video-recorder__meter > span { background: var(--danger-solid); }
.video-recorder__note { padding: var(--space-2) var(--space-3); border: 1px solid var(--warning-border); border-radius: var(--radius-md); background: var(--warning-bg); color: var(--warning-text); }
.video-upload { margin-block: var(--space-2); }
.video-upload__bar { width: 100%; height: 1rem; }
.video-upload__errors ul { padding-inline-start: 1.2rem; }
@media (max-width: 575.98px) {
  .video-recorder { padding: var(--space-2); }
  .video-recorder__bar .btn { flex: 1 1 auto; }
  .video-recorder__time { margin-inline-start: 0; flex-basis: 100%; }
}

/* ---- Program > Course > nested sections > lessons (collapsible with native <details>; logical properties keep RTL correct) ---- */
.outline-course .outline-sec { border: 1px solid var(--border); border-radius: var(--radius-md); margin-block: var(--space-2); background: var(--surface); }
.outline-sec > summary, .lesson-nav__sec > summary { cursor: pointer; list-style: none; }
.outline-sec > summary::-webkit-details-marker, .lesson-nav__sec > summary::-webkit-details-marker, .content-tree__sec > summary::-webkit-details-marker { display: none; }
.outline-sec__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); font-weight: 600; }
.outline-sec__head::before, .lesson-nav__sec > summary::before { content: "\25B8"; display: inline-block; transition: transform .15s; color: var(--text-muted); }
[dir="rtl"] .outline-sec__head::before, [dir="rtl"] .lesson-nav__sec > summary::before { content: "\25C2"; }
.outline-sec[open] > .outline-sec__head::before, .lesson-nav__sec[open] > summary::before { transform: rotate(90deg); }
.outline-sec__body { padding: 0 var(--space-3) var(--space-3); }
.outline-sec .outline-sec { margin-inline-start: var(--space-3); }
.outline-sec:focus-within, .lesson-nav__sec > summary:focus-visible { outline: 2px solid var(--focus, currentColor); outline-offset: 1px; }
.lesson-nav__coursename { font-size: .9rem; font-weight: 700; margin: var(--space-3) 0 var(--space-1); }
.lesson-nav__sec { margin-block: var(--space-1); }
.lesson-nav__sec .lesson-nav__sec { margin-inline-start: var(--space-3); }
.lesson-nav__sec > summary.lesson-nav__stage { display: flex; align-items: center; gap: var(--space-1); }
.content-tree { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.content-tree .content-tree { margin-inline-start: var(--space-4); margin-block-start: var(--space-2); border-inline-start: 2px solid var(--border); padding-inline-start: var(--space-3); }
.content-tree__sec > summary { list-style: none; cursor: pointer; }
.content-tree__lessons { list-style: none; margin: var(--space-2) 0 0; margin-inline-start: var(--space-4); padding: 0; display: grid; gap: var(--space-2); }
.content-tree .content-row, .content-tree__lessons .content-row { grid-template-columns: 1fr auto; }
.content-row--lesson { background: transparent; box-shadow: none; }
@media (max-width: 575.98px) { .content-tree .content-tree { margin-inline-start: var(--space-2); padding-inline-start: var(--space-2); } }

/* ---- Manage access (students / instructors) ---- */
.access-tabs .nav-link { font-weight: 600; }
.access-tabs .nav-link.active { border-color: var(--border) var(--border) var(--surface); border-bottom: 3px solid var(--brand-red); color: var(--text); }
.access-list { margin: 0; padding: var(--space-3) var(--space-4); max-height: 28rem; overflow: auto; }
.access-item { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) 0; border-bottom: 1px solid var(--border); margin: 0; padding-inline-start: 0; }
.access-item .form-check-input { float: none; margin: 0; flex: none; }
.access-item .form-check-label { flex: 1; min-width: 0; }
.access-item__remove { flex: none; }
