/* ============================================================
   دفتر المركز — صفحة التجربة
   Daftar Al-Markaz — Demo Page
   ------------------------------------------------------------
   يُحمَّل بعد style.css. الزائر يسجّل حلقة بنفسه في تطبيق
   مصغّر بعرض الهاتف.
   ============================================================ */

/* ============================================================
   1. الصفحة والرأس · Page & Header
   ============================================================ */
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body { background: radial-gradient(60% 40% at 50% 0%, rgba(26, 157, 184, .10), transparent 70%), var(--bg); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.dh {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 980px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 18px 10px;
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.lmark { height: 40px; width: auto; overflow: visible; }
.lword { height: 26px; width: auto; }
.back { font-size: 14px; font-weight: 700; color: var(--primary-deep); text-decoration: none; padding: 8px 12px; border-radius: 10px; }
.back:hover { background: rgba(27, 42, 107, .06); }
.intro { text-align: center; max-width: 560px; margin: 4px auto 16px; padding: 0 18px; }
.intro h1 { font-size: clamp(24px, 4.4vw, 34px); font-weight: 900; line-height: 1.4; }
.intro p { font-size: 14.5px; line-height: 1.8; color: var(--text-soft); margin-top: 4px; }

/* ============================================================
   2. التطبيق المصغّر · App Shell
   ============================================================ */
.app {
  position: relative; max-width: 440px; margin: 0 auto;
  height: min(780px, calc(100svh - 110px));
  display: flex; flex-direction: column; border-radius: 30px; overflow: hidden; background: var(--bg-app);
  box-shadow: 0 50px 100px -50px rgba(27, 42, 107, .55), 0 0 0 1px rgba(27, 42, 107, .08);
}

/* الشريط العلوي: اسم الحلقة وحلقة النسبة */
.top { flex: none; background: var(--primary-deep); color: #fff; padding: 16px; display: flex; align-items: center; gap: 14px; }
.top .info { flex: 1; min-width: 0; }
.top h1 { font-size: 18px; font-weight: 800; line-height: 1.4; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 12px; color: rgba(255, 255, 255, .66); }
.meta span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.meta i { width: 13px; height: 13px; display: inline-grid; place-items: center; font-size: 9.5px; opacity: .8; }
.meta .fa-moon { font-size: 10px; }
.meta .fa-user { font-size: 8.5px; }
.ring { position: relative; width: 52px; height: 52px; flex: none; }
.ring svg { width: 52px; height: 52px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4.5; }
.ring .bg { stroke: rgba(255, 255, 255, .14); }
.ring .fg { stroke: #2FC1D3; stroke-linecap: round; transition: stroke-dashoffset .35s; }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 700; }

/* ============================================================
   3. الجدول · Table
   عمود الاسم ثابت، والأعمدة تنزلق أفقياً
   ============================================================ */
.wrap {
  flex: 1; min-height: 0; margin: 10px 8px 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px 16px 0 0; overflow: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  padding-bottom: 84px;   /* مساحة لعدّاد «سُجّل اليوم» فوق آخر صف */
}
.wrap::-webkit-scrollbar { display: none; }
/* ظلّ خفيف على الحافة يدلّ على أعمدة مخفية */
.fade { position: absolute; z-index: 6; top: 0; bottom: 0; width: 22px; pointer-events: none; background: linear-gradient(to left, transparent, rgba(27, 42, 107, .10)); opacity: 0; transition: opacity .2s; }
table { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 12px; }
th, td { border-bottom: 1px solid var(--border); border-inline-start: 1px solid var(--border); text-align: center; vertical-align: middle; padding: 15px 6px; }
thead th { padding: 10px 6px; }
thead th {
  position: sticky; top: 0; z-index: 3; background: var(--primary-deep); color: #fff;
  font-weight: 700; font-size: 12.5px; white-space: nowrap;
  border-inline-start-color: rgba(255, 255, 255, .14); border-bottom-color: var(--primary-deep);
}
thead th .hd { display: inline-flex; align-items: center; gap: 4px; }
thead th .hd i { position: relative; width: 13px; height: 13px; display: inline-block; font-size: 10.5px; color: #7FD6E0; }
thead th .hd .fa-book { font-size: 9px; }
thead th .hd .fa-user-group { font-size: 7.5px; }   /* الرمز عريض، فيصغر حتى يساوي عرض الرسم الأصلي */
/* الرمز موضوع فوق المربّع لا داخله: هكذا لا يكون للمربّع خطّ أساس نصّي،
   فيبقى ارتفاع صف العناوين كما كان مع الرسم الأصلي */
thead th .hd i::before { position: absolute; inset: 0; display: grid; place-items: center; }
/* زر «للجميع» تحت عنوان العمود */
.all { display: grid; place-items: center; width: 26px; height: 26px; margin: 6px auto 0; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.all i { width: 12px; height: 12px; display: grid; place-items: center; font-size: 8px; color: #fff; opacity: .55; }
.all.on { background: var(--primary); }
.all.on i { opacity: 1; }
th.nm, td.nm { position: sticky; inset-inline-start: 0; z-index: 2; text-align: start; min-width: 112px; max-width: 112px; border-inline-start: 0; border-inline-end: 1px solid #D9DFEA; }
th.nm + th, td.nm + td { border-inline-start: 0; }
thead th.nm { border-inline-end-color: rgba(255, 255, 255, .14); }
thead th.nm { z-index: 4; }
td.nm { background: #fff; }
td.nm b { display: block; font-size: 13.5px; font-weight: 700; line-height: 1.45; }
td.nm small i { position: relative; width: 11px; height: 11px; display: inline-block; font-size: 8px; }
td.nm small i::before { position: absolute; inset: 0; display: grid; place-items: center; }   /* بلا خطّ أساس، كالرسم الأصلي */
/* شارة «قبل 4 أيام»: آخر تسجيل للطالب */
td.nm small { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 600; color: var(--warning); background: var(--warning-bg); padding: 1px 7px; border-radius: 99px; margin-top: 4px; white-space: nowrap; }
td.ls { min-width: 96px; transition: opacity .2s; }
tr.absent td.ls { opacity: .35; }

/* زر التسجيل: رمادي، ثم فيروزي مع نبضة عند الضغط */
.tap {
  position: relative; width: 36px; height: 36px; margin: 0 auto; border-radius: 12px;
  background: var(--soft); box-shadow: inset 0 0 0 1px #E3E8F1; display: grid; place-items: center;
  transition: background .18s, box-shadow .18s, transform .12s;
}
.tap i { width: 16px; height: 16px; display: grid; place-items: center; font-size: 11px; color: #C3CADB; transition: color .15s; }
.tap:active { transform: scale(.9); }
.tap.on { background: var(--primary); box-shadow: 0 6px 14px -6px rgba(26, 157, 184, .8); }
.tap.on i { color: #fff; }
.tap.on::after { content: ""; position: absolute; inset: -4px; border-radius: 15px; border: 2px solid var(--primary); opacity: 0; animation: ping .45s ease-out; }
@keyframes ping { 0% { opacity: .6; transform: scale(.85); } 100% { opacity: 0; transform: scale(1.15); } }
@media (prefers-reduced-motion: reduce) { .tap.on::after { animation: none; } }
.tap[disabled] { cursor: default; }
.rng { display: block; margin-top: 7px; font-size: 11.5px; font-weight: 700; color: var(--primary-dark); white-space: nowrap; }
.amt { display: block; font-size: 10px; color: var(--text-light); white-space: nowrap; }
.pl { font-size: 11px; color: #B4BBCE; }
.none { font-size: 11px; color: #C9CFDD; }

/* زر الغياب: رمادي، أحمر بدون عذر، برتقالي بعذر أو مرض */
td.ab { min-width: 70px; }
.abtn { width: 36px; height: 36px; margin: 0 auto; border-radius: 12px; background: #F7F8FB; box-shadow: inset 0 0 0 1px #EBEEF4; display: grid; place-items: center; color: #C9CFDD; }
.abtn i { width: 14px; height: 14px; display: grid; place-items: center; font-size: 10.5px; }
.abtn .fa-xmark { font-size: 11px; }
.abtn.red { box-shadow: inset 0 0 0 1px #F3C4C4; color: var(--danger); background: var(--danger-bg); }
.abtn.amber { box-shadow: inset 0 0 0 1px #F5D9A8; color: var(--warning); background: var(--warning-bg); }
.chip { display: inline-block; margin-top: 5px; font-size: 10.5px; font-weight: 600; padding: 1px 8px; border-radius: 99px; white-space: nowrap; }
.chip.red { background: var(--danger-bg); color: var(--danger); }
.chip.amber { background: var(--warning-bg); color: var(--warning); }

/* زر الملاحظة: يتلوّن إذا كُتبت ملاحظة */
td.nt { min-width: 52px; }
.nbtn { width: 32px; height: 32px; margin: 0 auto; border-radius: 9px; display: grid; place-items: center; color: #C3CADB; }
.nbtn i { width: 16px; height: 16px; display: grid; place-items: center; font-size: 12px; }
.nbtn.has { background: var(--info-bg); color: var(--primary-dark); }

/* ============================================================
   4. القائمة المنبثقة · Bottom Sheet
   ============================================================ */
.veil { position: absolute; inset: 0; background: rgba(15, 22, 55, .4); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; }
.sheet {
  position: absolute; inset-inline: 0; bottom: 0; z-index: 21; background: #fff; border-radius: 22px 22px 0 0;
  padding: 10px 16px calc(env(safe-area-inset-bottom, 0px) + 18px);
  transform: translateY(105%); transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}
.open .veil { opacity: 1; pointer-events: auto; }
.open .sheet { transform: none; }
.grab { width: 40px; height: 4px; border-radius: 4px; background: #D9DEEA; margin: 0 auto 12px; }
.sheet h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.sheet p { font-size: 13px; color: var(--text-soft); margin-bottom: 12px; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opts button { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 14px; border-radius: 13px; border: 1px solid var(--line); font-size: 15px; font-weight: 600; text-align: start; }
.opts button i { width: 18px; height: 18px; display: grid; place-items: center; font-size: 13.5px; }
.opts .fa-xmark { font-size: 14px; }
.opts .r { color: var(--danger); }
.opts .a { color: var(--warning); }
.opts .c { color: var(--text-soft); justify-content: center; }
textarea { width: 100%; min-height: 96px; border: 1px solid var(--line); border-radius: 13px; padding: 12px; font: inherit; font-size: 14px; color: var(--text); resize: vertical; }
textarea:focus { outline: 2px solid var(--primary); border-color: transparent; }
.sv { margin-top: 10px; width: 100%; min-height: 48px; border-radius: 13px; background: var(--primary-deep); color: #fff; font-weight: 700; }

/* عدّاد «سُجّل اليوم» ثابت أسفل التطبيق */
.foot { position: absolute; bottom: 0; inset-inline: 0; z-index: 9; padding: 10px 12px 12px; background: linear-gradient(transparent, var(--bg-app) 35%); }
.foot div { max-width: 428px; margin: 0 auto; background: var(--primary-deep); color: #fff; border-radius: 16px; padding: 12px 16px; display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 600; box-shadow: 0 14px 30px -14px rgba(27, 42, 107, .6); }
.foot b { color: #7FD6E0; }

/* ============================================================
   5. «قريباً» · Coming Soon
   ============================================================ */
.soon { max-width: 560px; margin: 34px auto 0; padding: 0 18px calc(env(safe-area-inset-bottom, 0px) + 40px); text-align: center; }
.soon .card2 { background: #fff; border-radius: 24px; padding: 28px 22px; box-shadow: 0 30px 60px -36px rgba(27, 42, 107, .45), 0 0 0 1px rgba(27, 42, 107, .06); }
.badge2 { display: inline-block; background: var(--primary-dark); color: #fff; font-size: 13px; font-weight: 800; padding: 4px 14px; border-radius: 99px; }
.soon h2 { font-size: clamp(22px, 4vw, 28px); font-weight: 900; margin-top: 12px; }
.soon p { font-size: 15px; line-height: 1.85; color: var(--text-soft); margin-top: 8px; }
.soon .acts { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.b2 { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 12px; font-weight: 700; font-size: 15px; text-decoration: none; }
/* أيقونة واتساب: مربّع 18px كالرسم الأصلي */
.b2 i { width: 18px; height: 18px; display: inline-grid; place-items: center; font-size: 14px; }
.b2.p { background: var(--primary-deep); color: #fff; }
.b2.g { background: #fff; color: var(--primary-deep); box-shadow: inset 0 0 0 1px rgba(27, 42, 107, .2); }
.b2:focus-visible, .back:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

/* ============================================================
   6. للجوال · Responsive
   ============================================================ */
@media (max-width: 520px) {
  .app { margin: 0 10px; border-radius: 22px; height: calc(100svh - 150px); min-height: 520px; }
  .lmark { height: 34px; }
  .lword { height: 22px; }
}
