/* ==========================================================================
   mo3alemi - views.css - student/teacher/admin view pieces
   Stage 1 (mobile-first redesign). 360px first, then 520 / 768 / 1024px.

   Original split from the single-file build (معلمي.html), source lines
   112-191 and 248-323. Plain classic script: it shares one global scope with
   the other files, so the load order in index.html matters. Never load these
   files with type="module".

   The old "notebook / chalkboard" skin (hard offset shadows, 2px ink borders,
   ruled paper) is gone: every surface here now uses the soft tokens from
   base.css. No tokens are defined or redefined in this file.
   ========================================================================== */

/* ------------------------------------------------- centers, marks, art --- */
.center{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:16px;
  padding-block:24px;
  text-align:center;
}
.mark{
  display:inline-block;
  font-family:var(--display);
  font-size:56px;
  line-height:1.15;
  color:var(--accent);
}
/* Welcome: main app logo above the copy, all content vertically centered */
.shell:has(> .welcome){
  min-height:calc(100vh - 28px - var(--sab));
  min-height:calc(100dvh - 28px - var(--sab));
}
.welcome{
  flex:1;
  justify-content:center;
  gap:20px;
  padding-block:24px;
}
.welcome-logo{
  width:112px;
  height:112px;
  object-fit:contain;
  flex:none;
  filter:drop-shadow(0 8px 18px rgba(0,0,0,.12));
}
.welcome-copy{display:flex;flex-direction:column;gap:8px;text-align:center}
.welcome-copy h1{margin:0}

/* Red X close-style icon that replaces every "back"/"close" label */
.xback{display:inline-block;vertical-align:middle;flex:none}
.ill{
  display:flex;
  justify-content:center;
  width:100%;
  padding:14px;
  border-radius:var(--r-lg);
  background:var(--surface);
  border:1px solid var(--line);
  box-shadow:var(--shadow-1);
}
.ill svg{width:100%;max-width:320px;height:auto}
.i-s{fill:var(--surface);stroke:var(--line-2);stroke-width:1.5}
.i-r{fill:var(--raised)}
.i-a{fill:var(--accent)}
.i-b{fill:var(--accent-2)}
.i-g{fill:var(--ok)}
.i-l{fill:none;stroke:var(--muted);stroke-width:2;stroke-linecap:round}
.i-t{
  fill:var(--fg);
  font-family:var(--font-mono);
  font-size:14px;
  font-weight:700;
  direction:ltr;
}

.dots{display:flex;justify-content:center;gap:6px}
.dots i{width:8px;height:8px;border-radius:var(--r-pill);background:var(--line);transition:width var(--t) var(--ease),background var(--t) var(--ease)}
.dots i.on{width:22px;background:var(--accent)}

.onb{display:flex;flex-direction:column;gap:18px;text-align:center}
.onb .row{justify-content:space-between;flex-wrap:nowrap}
.big{
  display:flex;
  flex-direction:column;
  gap:4px;
  width:100%;
  padding:16px;
  border:1px solid var(--line);
  border-radius:var(--r-lg);
  background:var(--surface);
  box-shadow:var(--shadow-1);
  cursor:pointer;
  text-align:start;
  transition:border-color var(--t-fast) var(--ease),transform var(--t-fast) var(--ease);
}
.big:active{transform:scale(.99);border-color:var(--accent)}
.big b{font-family:var(--display);font-weight:700;font-size:var(--fs-h3)}
.gbtn{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  background:var(--surface-2);
  color:var(--fg);
  border:1px solid var(--line);
  box-shadow:var(--shadow-1);
  font-weight:600;
  transition:all var(--t-fast) var(--ease);
}
.gbtn:hover{
  background:var(--raised);
  border-color:var(--accent);
}

.demo{
  padding:12px;
  border-radius:var(--r);
  background:var(--surface-2);
  color:var(--muted);
  font-size:var(--fs-sm);
}
.demo summary{cursor:pointer;font-weight:600;color:var(--fg-2)}
.demo p{margin-top:6px}

/* --------------------------------------------------------- teacher grid ---
   One card per row on a 360px phone: never a cramped two-column layout. */
.grid{display:grid;grid-template-columns:1fr;gap:18px}
.tcard{
  display:flex;
  flex-direction:column;
  gap:10px;
  min-width:0;
  padding:0;
  border:0;
  background:none;
  color:inherit;
  cursor:pointer;
  text-align:start;
}
.thumb{
  --c:var(--raised);
  position:relative;
  width:100%;
  aspect-ratio:16/9;
  border-radius:var(--r-lg);
  overflow:hidden;
  background:var(--c);
  color:#fff;
  box-shadow:var(--shadow-1);
}
.thumb::after{
  content:"";
  position:absolute;
  top:-50px;
  inset-inline-start:-40px;
  width:130px;
  height:130px;
  border-radius:50%;
  background:rgba(255,255,255,.1);
}
.thumb > img{position:absolute;inset:0;z-index:0;width:100%;height:100%;object-fit:cover}
.thumb .av img{position:relative !important;inset:auto !important;width:100% !important;height:100% !important;border-radius:50% !important;object-fit:cover !important}
.thumb .shade{position:absolute;inset:0;z-index:1;background:linear-gradient(transparent 45%,rgba(0,0,0,.72))}
/* the big subject glyph: scaled down on phones so it never overflows the tile */
.glyph{
  position:absolute;
  inset-inline-end:-6px;
  bottom:8px;
  z-index:1;
  max-width:70%;
  font-family:var(--display);
  font-size:64px;
  line-height:1;
  opacity:.18;
  direction:ltr;
  white-space:nowrap;
  pointer-events:none;
}
.subj{
  position:absolute;
  top:10px;
  inset-inline-start:10px;
  z-index:2;
  max-width:70%;
  padding:3px 10px;
  border-radius:var(--r-pill);
  background:var(--surface);
  color:var(--fg);
  font-size:var(--fs-xs);
  font-weight:600;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.tn{
  position:absolute;
  bottom:10px;
  inset-inline-start:10px;
  z-index:2;
  display:flex;
  align-items:center;
  gap:8px;
  max-width:72%;
  font-family:var(--display);
  font-size:17px;
  line-height:1.25;
}
.av{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:none;
  width:28px;
  height:28px;
  border-radius:50%;
  background:rgba(255,255,255,.95);
  color:var(--c);
  font-size:14px;
}
.cnt{
  position:absolute;
  bottom:10px;
  inset-inline-end:10px;
  z-index:2;
  padding:2px 8px;
  border-radius:var(--r-sm);
  background:rgba(0,0,0,.72);
  color:#fff;
  font-size:11px;
  line-height:1.5;
}
.tmeta{display:flex;align-items:flex-start;gap:10px;min-width:0}
.tmeta .a2{
  display:flex;
  align-items:center;
  justify-content:center;
  flex:none;
  width:40px;
  height:40px;
  border-radius:50%;
  background:var(--accent-soft);
  color:var(--accent);
  font-family:var(--display);
  font-size:var(--fs-h3);
  overflow:hidden;
}
.tmeta .a2 img{width:100%;height:100%;object-fit:cover}
.tmeta b{display:block;font-weight:600;line-height:1.45}
.tmeta span{color:var(--muted);font-size:var(--fs-sm)}

/* ------------------------------------------------------- empty states --- */
.empty{
  padding:24px;
  border-radius:var(--r-lg);
  background:var(--surface-2);
  color:var(--muted);
  text-align:center;
}
.empty svg{width:40px;height:40px;opacity:.6}

/* -------------------------------------------- tappable content rows --- */
.irow{
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  align-items:center;
  gap:12px;
  padding:14px;
  border-radius:var(--r);
  background:var(--surface);
  border:1px solid var(--line);
  min-height:56px;
}
.irow + .irow{margin-top:8px}
.ith{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  flex:none;
  width:84px;
  height:48px;
  border-radius:var(--r-sm);
  background:var(--raised);
  color:var(--muted);
  font-size:var(--fs-xs);
  font-weight:600;
  overflow:hidden;
}
.ith img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.irow .t{flex:1 1 140px;min-width:0}
.irow .t b{display:block;font-weight:600;line-height:1.5;overflow-wrap:anywhere}
.irow .acts,.irow .t + .acts{justify-content:flex-end}
.irow > .acts,.irow > .pill,.irow > .btn,.irow > .mbtn,.irow > .muted{grid-column:2}
.acts{display:flex;flex-wrap:wrap;gap:6px}

/* ------------------------------------------------------------ statistics --- */
.stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.stat{padding:12px 14px;border-radius:var(--r);background:var(--surface);border:1px solid var(--line)}
.stat b{
  display:block;
  font-family:var(--display);
  font-weight:700;
  font-size:26px;
  line-height:1.25;
  font-variant-numeric:tabular-nums;
  color:var(--fg);
}

/* ---------------------------------------------------------------- tables --- */
.tw{
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  border-radius:var(--r);
  border:1px solid var(--line);
  scrollbar-width:thin;
  scrollbar-color:var(--accent) var(--bg2);
}
.tw::-webkit-scrollbar{
  height:8px;
}
.tw::-webkit-scrollbar-track{
  background:var(--bg2,#161B22);
  border-radius:4px;
}
.tw::-webkit-scrollbar-thumb{
  background:var(--accent,#5B4BE8);
  border-radius:4px;
}
.tw::-webkit-scrollbar-thumb:hover{
  background:#7A6CF0;
}
table{border-collapse:collapse;width:100%;font-size:var(--fs-sm)}
th,td{
  padding:10px 12px;
  text-align:start;
  border-bottom:1px solid var(--line);
  white-space:nowrap;
}
th{
  position:sticky;
  top:0;
  z-index:1;
  background:var(--surface-2);
  color:var(--muted);
  font-size:var(--fs-xs);
  font-weight:600;
}
tbody tr:last-child td{border-bottom:0}
code{
  padding:2px 8px;
  border-radius:var(--r-sm);
  background:var(--raised);
  font-family:var(--font-mono);
  font-size:13px;
  direction:ltr;
  unicode-bidi:isolate;
}

/* ----------------------------------------------------------- key / value --- */
.kv{display:grid;grid-template-columns:auto minmax(0,1fr);gap:6px 12px;font-size:var(--fs-sm)}
.kv dt{color:var(--muted)}
.kv dd{margin:0;overflow-wrap:anywhere}

/* -------------------------------------------------------------- uploads --- */
.upz{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  padding:12px;
  border:1px dashed var(--line-2);
  border-radius:var(--r-lg);
  background:var(--surface-2);
}
.upz.drag{border-color:var(--accent);background:var(--accent-soft)}
.upv{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  flex:none;
  width:112px;
  height:76px;
  border-radius:var(--r);
  background:var(--raised);
  color:var(--muted);
  font-size:var(--fs-xs);
  overflow:hidden;
}
.upv img,.upv video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.upb{display:flex;flex-direction:column;align-items:flex-start;gap:8px}
.upt{font-size:var(--fs-xs);color:var(--muted)}
.edpl video{
  display:block;
  width:100%;
  max-height:260px;
  border-radius:var(--r);
  background:#000;              /* video content surface: stays black */
}

/* ------------------------------------------------- trim / chapter timeline ---
   Finger friendly: 36px tall track, 16px markers, touch-action none. */
.tl{
  position:relative;
  height:36px;
  border-radius:var(--r-sm);
  background:var(--raised);
  overflow:hidden;
  cursor:pointer;
  direction:ltr;
  touch-action:none;
}
.tl .sg{
  position:absolute;
  top:4px;
  bottom:4px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:6px;
  opacity:.9;
  overflow:hidden;
  font-style:normal;
  transition:opacity var(--t-fast) var(--ease);
}
.tl .sg b{
  padding:0 4px;
  color:#10122a;
  font-size:11px;
  font-weight:600;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.tl .sg.sel{outline:2px solid var(--accent);outline-offset:-2px;opacity:1}
.tl .ph{
  position:absolute;
  top:0;
  bottom:0;
  width:2px;
  background:var(--fg);
  box-shadow:0 0 0 1px var(--surface);
}
.crow .cdot{flex:none;width:16px;height:16px;border-radius:50%}
.rng{display:inline-flex;align-items:center;gap:8px;flex-wrap:wrap}
.tp{
  padding:6px 12px;
  border:1px solid var(--line);
  border-radius:var(--r-pill);
  background:var(--raised);
  color:var(--fg);
  font-size:var(--fs-xs);
  font-variant-numeric:tabular-nums;
  direction:ltr;
  cursor:pointer;
}
.tp.e{cursor:default;opacity:.85}

/* -------------------------------------------------------------- previews --- */
.photo-prev{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  width:96px;
  height:96px;
  border-radius:var(--r-lg);
  background:var(--raised);
  color:var(--muted);
  font-size:var(--fs-xs);
  overflow:hidden;
}
.photo-prev img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.thumb-prev{width:168px;aspect-ratio:16/9}

/* ------------------------------------------------------ exams and fields --- */
.erow{display:grid;grid-template-columns:1fr;gap:10px}
.qbox{
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:14px;
  border:1px solid var(--line);
  border-radius:var(--r-lg);
  background:var(--surface);
}
.opt{display:flex;align-items:center;gap:10px;padding:8px 0;min-height:var(--tap);cursor:pointer}
.opt input[type=radio]{flex:none;width:20px;height:20px;accent-color:var(--accent)}
fieldset.q{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin:0;
  padding:14px;
  border:1px solid var(--line);
  border-radius:var(--r-lg);
}
fieldset.q legend{padding-inline:6px;color:var(--muted);font-size:var(--fs-sm)}

/* ------------------------------------------------------------- avatars ---
   width / height come from the JS inline style; this file only owns the
   shape, the colour and the flex behaviour. */
.avt{
  position:relative;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:none;
  border-radius:50%;
  background:hsl(var(--h,220) 52% 44%);
  color:#fff;
  font-family:var(--display);
  line-height:1;
  overflow:hidden;
}
.avt img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.ibtn.avb{min-width:var(--tap);min-height:var(--tap);padding:0;overflow:hidden}

/* --------------------------------------------------------- score summary --- */
.scrow{display:flex;flex-wrap:wrap;align-items:center;gap:16px}
.ring{
  --p:0;
  position:relative;
  display:grid;
  place-items:center;
  flex:none;
  width:88px;
  height:88px;
  border-radius:50%;
  background:conic-gradient(var(--accent) calc(var(--p)*1%),var(--raised) 0);
}
.ring::before{content:"";position:absolute;inset:9px;border-radius:50%;background:var(--surface)}
.ring b{position:relative;font-family:var(--display);font-size:26px;font-weight:700;line-height:1}
.sbars{display:flex;flex-direction:column;gap:8px;flex:1 1 180px;min-width:0}
.sbr{display:grid;grid-template-columns:74px minmax(0,1fr) 44px;align-items:center;gap:8px;font-size:var(--fs-xs)}
.sbr b{text-align:end;font-weight:600;font-variant-numeric:tabular-nums}
.bar2{height:8px;border-radius:var(--r-pill);background:var(--raised);overflow:hidden}
.bar2 i{display:block;height:100%;border-radius:var(--r-pill);background:linear-gradient(90deg,var(--accent),var(--accent-2))}

/* ------------------------------------------------- blurred password view --- */
.pwv{display:inline-flex;align-items:center;gap:8px}
code.mask{filter:blur(5px);user-select:none;letter-spacing:2px}
code.mask.shown{filter:none;letter-spacing:normal}
.eye{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:none;
  width:var(--tap);
  height:var(--tap);
  border:0;
  border-radius:50%;
  background:var(--raised);
  color:var(--fg);
  cursor:pointer;
}
.eye:active{background:var(--line)}
.eye svg{width:20px;height:20px}

/* ------------------------------------------------ selection bar, banners --- */
.selbar{display:flex;align-items:center;gap:8px;padding:8px;border-radius:var(--r);background:var(--raised)}
.selbar input{flex:1 1 auto;min-width:0;min-height:var(--tap)}
.cnt2{
  position:absolute;
  top:-4px;
  inset-inline-end:-4px;
  z-index:1;
  display:flex;
  align-items:center;
  justify-content:center;
  min-width:18px;
  height:18px;
  padding:0 4px;
  border-radius:var(--r-pill);
  background:var(--err);
  color:var(--err-bg);
  font-size:11px;
  font-weight:700;
}
.banner{border:1px solid color-mix(in srgb,var(--warn) 40%,transparent)}
.banner.note{
  display:flex;
  align-items:center;
  gap:8px;
  width:100%;
  border:0;
  background:var(--accent-soft);
  color:var(--accent);
  font-weight:600;
  cursor:pointer;
  text-align:start;
}
.banner.note svg{flex:none;width:18px;height:18px}
.banner.soft{opacity:.9}

/* ------------------------------------------------------- notification row --- */
.nrow{
  display:flex;
  flex-direction:column;
  gap:4px;
  align-items:flex-start;
  width:100%;
  min-height:56px;
  padding:14px;
  border:1px solid var(--line);
  border-radius:var(--r);
  background:var(--surface);
  color:inherit;
  cursor:pointer;
  text-align:start;
}
.nrow + .nrow{margin-top:8px}
.nrow:active{background:var(--surface-2)}
.nrow b{font-weight:600;line-height:1.45}
.nrow span{font-size:var(--fs-sm);color:var(--fg-2);overflow-wrap:anywhere}

/* --------------------------------------------------------- media queries --- */
@media (min-width:520px){
  .center{gap:18px;padding-block:32px}
  .mark{font-size:72px}
  .ill{padding:18px}

  /* teacher cards: two per row */
  .grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}
  .glyph{font-size:96px;inset-inline-end:-8px;bottom:2px}
  .tn{font-size:18px}
  .tmeta .a2{width:44px;height:44px}

  .stats{grid-template-columns:repeat(auto-fit,minmax(110px,1fr))}
  .erow{grid-template-columns:1fr 1fr;gap:8px}
  .upv{width:128px;height:80px}
  .ring{width:96px;height:96px}
  .ring::before{inset:10px}
  .ring b{font-size:30px}
}

@media (min-width:768px){
  .grid{gap:22px}
  .mark{font-size:76px}
  .irow{padding:14px 16px}
  .qbox{padding:16px}
  .photo-prev{width:120px;height:120px}
}

@media (min-width:1024px){
  .grid{gap:24px}
  .thumb{border-radius:var(--r-xl)}
}
