/* ═══════════════════════════════════════════════════════════════
   معهد الفضيلة العلي للتدريب — لوحة متابعة المحاضرات
   تصميم احترافي RTL مع 4 ثيمات وحركات سلسة
   ═══════════════════════════════════════════════════════════════ */

/* ─────────── الثيمات (4 بالتات) ─────────── */
:root, [data-theme="navy"] {
    --bg-1: #081426; --bg-2: #0d2144; --bg-3: #0a1a35;
    --glow-1: rgba(59,130,246,.20); --glow-2: rgba(34,211,238,.13); --glow-3: rgba(147,197,253,.09);
    --card: rgba(255,255,255,.055); --card-solid: #10254a; --card-hover: rgba(255,255,255,.09);
    --stroke: rgba(255,255,255,.10); --stroke-strong: rgba(255,255,255,.18);
    --text: #eaf2ff; --muted: #8fa5c5; --faint: #5f7699;
    --primary: #3b82f6; --primary-2: #60a5fa; --accent: #22d3ee;
    --grad: linear-gradient(135deg, #2563eb, #3b82f6 55%, #22d3ee);
    --ok: #10b981; --ok-bg: rgba(16,185,129,.13); --ok-bd: rgba(16,185,129,.35);
    --bad: #f43f5e; --bad-bg: rgba(244,63,94,.12); --bad-bd: rgba(244,63,94,.35);
    --warn: #f59e0b; --warn-bg: rgba(245,158,11,.13); --warn-bd: rgba(245,158,11,.35);
    --shadow: 0 18px 45px -18px rgba(2,8,23,.75);
    --ring-track: rgba(255,255,255,.08);
}
[data-theme="emerald"] {
    --bg-1: #03150e; --bg-2: #062b1d; --bg-3: #04231740;
    --glow-1: rgba(16,185,129,.20); --glow-2: rgba(163,230,53,.11); --glow-3: rgba(52,211,153,.10);
    --card: rgba(255,255,255,.05); --card-solid: #07281b; --card-hover: rgba(255,255,255,.085);
    --stroke: rgba(255,255,255,.10); --stroke-strong: rgba(255,255,255,.17);
    --text: #eafff5; --muted: #8fc4ab; --faint: #5d907b;
    --primary: #10b981; --primary-2: #34d399; --accent: #a3e635;
    --grad: linear-gradient(135deg, #059669, #10b981 55%, #84cc16);
    --ok: #34d399; --ok-bg: rgba(52,211,153,.13); --ok-bd: rgba(52,211,153,.35);
    --bad: #f87171; --bad-bg: rgba(248,113,113,.12); --bad-bd: rgba(248,113,113,.35);
    --warn: #fbbf24; --warn-bg: rgba(251,191,36,.13); --warn-bd: rgba(251,191,36,.35);
    --shadow: 0 18px 45px -18px rgba(1,20,12,.8);
    --ring-track: rgba(255,255,255,.08);
}
[data-theme="purple"] {
    --bg-1: #170b2e; --bg-2: #251150; --bg-3: #1d0d3f;
    --glow-1: rgba(139,92,246,.22); --glow-2: rgba(232,121,249,.12); --glow-3: rgba(167,139,250,.10);
    --card: rgba(255,255,255,.055); --card-solid: #251251; --card-hover: rgba(255,255,255,.09);
    --stroke: rgba(255,255,255,.11); --stroke-strong: rgba(255,255,255,.19);
    --text: #f3efff; --muted: #b0a2d4; --faint: #7d6fa3;
    --primary: #8b5cf6; --primary-2: #a78bfa; --accent: #e879f9;
    --grad: linear-gradient(135deg, #7c3aed, #8b5cf6 55%, #e879f9);
    --ok: #34d399; --ok-bg: rgba(52,211,153,.13); --ok-bd: rgba(52,211,153,.35);
    --bad: #fb7185; --bad-bg: rgba(251,113,133,.12); --bad-bd: rgba(251,113,133,.35);
    --warn: #fbbf24; --warn-bg: rgba(251,191,36,.13); --warn-bd: rgba(251,191,36,.35);
    --shadow: 0 18px 45px -18px rgba(10,2,30,.8);
    --ring-track: rgba(255,255,255,.08);
}
[data-theme="burgundy"] {
    --bg-1: #220509; --bg-2: #3d0d16; --bg-3: #2e0912;
    --glow-1: rgba(225,29,72,.20); --glow-2: rgba(251,191,36,.10); --glow-3: rgba(251,113,133,.10);
    --card: rgba(255,255,255,.05); --card-solid: #33101a; --card-hover: rgba(255,255,255,.085);
    --stroke: rgba(255,255,255,.10); --stroke-strong: rgba(255,255,255,.17);
    --text: #fff0f2; --muted: #d4a3ac; --faint: #9c717b;
    --primary: #e11d48; --primary-2: #fb7185; --accent: #fbbf24;
    --grad: linear-gradient(135deg, #be123c, #e11d48 55%, #fb923c);
    --ok: #34d399; --ok-bg: rgba(52,211,153,.13); --ok-bd: rgba(52,211,153,.35);
    --bad: #fb7185; --bad-bg: rgba(251,113,133,.13); --bad-bd: rgba(251,113,133,.38);
    --warn: #fbbf24; --warn-bg: rgba(251,191,36,.13); --warn-bd: rgba(251,191,36,.35);
    --shadow: 0 18px 45px -18px rgba(25,2,8,.85);
    --ring-track: rgba(255,255,255,.08);
}

/* ─────────── الأساسيات ─────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Cairo', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-1);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.7;
    transition: background .6s ease, color .4s ease;
    overflow-x: hidden;
}
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background: linear-gradient(165deg, var(--bg-1) 0%, var(--bg-2) 55%, var(--bg-1) 100%);
    transition: background .6s ease;
    pointer-events: none;
}
::selection { background: var(--primary); color: #fff; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--stroke-strong); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* فقاعات خلفية متوهجة */
.bg-decor { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 1; }
.b1 { width: 560px; height: 560px; background: var(--glow-1); top: -180px; left: -120px; animation: drift 22s ease-in-out infinite; }
.b2 { width: 460px; height: 460px; background: var(--glow-2); bottom: -160px; right: -100px; animation: drift 26s ease-in-out infinite reverse; }
.b3 { width: 340px; height: 340px; background: var(--glow-3); top: 42%; right: 22%; animation: drift 30s ease-in-out infinite; animation-delay: -8s; }
@keyframes drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(46px, -32px) scale(1.07); }
    66% { transform: translate(-30px, 26px) scale(.95); }
}

/* ─────────── شاشة الافتتاح ─────────── */
.splash {
    position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 8px;
    background: linear-gradient(165deg, var(--bg-1), var(--bg-2));
    transition: opacity .5s ease, visibility .5s;
}
.splash.hide { opacity: 0; visibility: hidden; }
.splash-logo { position: relative; width: 86px; height: 86px; display: grid; place-items: center; margin-bottom: 12px; }
.logo-ring {
    position: absolute; inset: 0; border-radius: 26px;
    background: var(--grad);
    animation: logoPulse 2.2s ease-in-out infinite;
    box-shadow: 0 0 42px var(--glow-1), 0 0 90px var(--glow-2);
}
@keyframes logoPulse { 0%,100% { transform: scale(1) rotate(0deg); border-radius: 26px; } 50% { transform: scale(1.07) rotate(3deg); border-radius: 32px; } }
.splash-ic { position: relative; z-index: 1; color: #fff; width: 40px; height: 40px; display: grid; place-items: center; }
.splash-ic svg { width: 40px; height: 40px; }
.splash-title { font-size: 21px; font-weight: 900; }
.splash-sub { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.splash-bar { width: 190px; height: 4px; border-radius: 99px; background: var(--ring-track); overflow: hidden; }
.splash-bar i { display: block; height: 100%; width: 40%; border-radius: 99px; background: var(--grad); animation: loadSlide 1.1s ease-in-out infinite; }
@keyframes loadSlide { 0% { transform: translateX(230%); } 100% { transform: translateX(-230%); } }

/* ─────────── التخطيط العام ─────────── */
.app { max-width: 1280px; margin: 0 auto; padding: 18px clamp(12px, 3vw, 28px) 70px; }

/* رأس الصفحة */
.topbar {
    position: sticky; top: 12px; z-index: 40;
    display: flex; align-items: center; gap: 14px;
    background: color-mix(in srgb, var(--card-solid) 72%, transparent);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--stroke); border-radius: 20px;
    padding: 12px 18px; margin-bottom: 20px; box-shadow: var(--shadow);
    animation: fadeDown .55s ease both;
}
@keyframes fadeDown { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-ic {
    width: 46px; height: 46px; flex: none; border-radius: 14px; display: grid; place-items: center;
    background: var(--grad); color: #fff; box-shadow: 0 8px 22px -8px var(--primary);
}
.brand-ic svg { width: 25px; height: 25px; }
.brand-name { font-size: 15.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-spacer { flex: 1; }

/* ساعة حية */
.liveclock { display: flex; align-items: center; gap: 10px; }
.clock-box { text-align: left; }
.clock-time { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.clock-date { font-size: 11px; color: var(--muted); }
.live-dot { position: relative; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); flex: none; }
.live-dot::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--ok); animation: ping 1.6s ease-out infinite; }
@keyframes ping { 0% { transform: scale(.5); opacity: 1; } 100% { transform: scale(1.7); opacity: 0; } }

/* زر عام */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid var(--stroke-strong); border-radius: 13px;
    background: var(--card); color: var(--text);
    font-family: inherit; font-size: 13.5px; font-weight: 700;
    padding: 9px 16px; cursor: pointer; position: relative; overflow: hidden;
    transition: transform .18s ease, background .25s, border-color .25s, box-shadow .25s, filter .2s;
    white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:hover { background: var(--card-hover); border-color: var(--primary); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn-primary { background: var(--grad); border: none; color: #fff; box-shadow: 0 10px 24px -10px var(--primary); }
.btn-primary:hover { filter: brightness(1.12); box-shadow: 0 14px 30px -10px var(--primary); background: var(--grad); }
.btn-primary::after {
    content: ''; position: absolute; top: 0; height: 100%; width: 60%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent);
    inset-inline-start: -80%; transform: skewX(-18deg);
    animation: shine 3.2s ease infinite;
}
@keyframes shine { 0%, 60% { inset-inline-start: -80%; } 100% { inset-inline-start: 160%; } }
.btn-danger { background: var(--bad-bg); border-color: var(--bad-bd); color: var(--bad); }
.btn-danger:hover { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn-ok { background: var(--ok-bg); border-color: var(--ok-bd); color: var(--ok); }
.btn-ok:hover { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 11px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-icon { padding: 9px; width: 40px; height: 40px; border-radius: 13px; }
.btn-icon.btn-sm { width: 33px; height: 33px; padding: 7px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* شريط التنقل */
.tabs {
    display: flex; gap: 6px; padding: 7px; margin-bottom: 22px;
    background: var(--card); border: 1px solid var(--stroke); border-radius: 18px;
    overflow-x: auto; scrollbar-width: none; animation: fadeUp .5s ease .06s both;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 18px; border-radius: 13px; border: none; background: transparent;
    color: var(--muted); font-family: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer;
    transition: all .25s ease; white-space: nowrap; position: relative;
}
.tab svg { width: 17px; height: 17px; }
.tab:hover { color: var(--text); background: var(--card-hover); }
.tab.active {
    color: #fff; background: var(--grad);
    box-shadow: 0 8px 20px -8px var(--primary);
    animation: tabPop .35s cubic-bezier(.34,1.56,.64,1);
}
@keyframes tabPop { 0% { transform: scale(.93); } 100% { transform: scale(1); } }

/* ─────────── بطاقات ─────────── */
.card {
    background: var(--card); border: 1px solid var(--stroke); border-radius: 20px;
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    padding: 20px 22px; box-shadow: var(--shadow);
    transition: transform .3s ease, border-color .3s, background .3s, box-shadow .3s;
    position: relative; overflow: hidden;
}
.card-hoverable:hover { transform: translateY(-4px); border-color: var(--stroke-strong); background: var(--card-hover); }
.card-head { display: flex; align-items: center; gap: 11px; margin-bottom: 16px; }
.card-head-ic {
    width: 38px; height: 38px; flex: none; border-radius: 12px; display: grid; place-items: center;
    background: var(--grad); color: #fff; box-shadow: 0 6px 16px -6px var(--primary);
}
.card-head-ic svg { width: 19px; height: 19px; }
.card-title { font-size: 15.5px; font-weight: 800; }
.card-sub { font-size: 11.5px; color: var(--muted); }
.card-head .spacer { flex: 1; }

/* شبكة المؤشرات */
.kpi-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi { padding: 18px; animation: fadeUp .55s ease both; }
.kpi:nth-child(1) { animation-delay: .05s; } .kpi:nth-child(2) { animation-delay: .12s; }
.kpi:nth-child(3) { animation-delay: .19s; } .kpi:nth-child(4) { animation-delay: .26s; }
.kpi:nth-child(5) { animation-delay: .33s; } .kpi:nth-child(6) { animation-delay: .40s; }
.kpi-top { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.kpi-ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.kpi-ic svg { width: 17px; height: 17px; }
.kpi-ic.rate { background: var(--grad); color: #fff; box-shadow: 0 6px 16px -6px var(--primary); }
.kpi-ic.total { background: rgba(96,165,250,.15); color: #93c5fd; border: 1px solid rgba(96,165,250,.3); }
.kpi-ic.done { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-bd); }
.kpi-ic.notdone { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad-bd); }
.kpi-ic.pending { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-bd); }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.kpi-value { font-size: 31px; font-weight: 900; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 14px; font-weight: 700; color: var(--muted); }
.kpi-foot { font-size: 11px; color: var(--faint); margin-top: 4px; }
.kpi-hero { display: flex; align-items: center; gap: 16px; }
.ring-wrap { position: relative; width: 84px; height: 84px; flex: none; }
.ring-wrap svg { transform: rotate(-90deg); width: 84px; height: 84px; }
.ring-bg { fill: none; stroke: var(--ring-track); stroke-width: 8; }
.ring-val { fill: none; stroke: url(#ringGrad); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 1.2s cubic-bezier(.22,1,.36,1); }
.ring-num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 19px; font-weight: 900; font-variant-numeric: tabular-nums; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.fade-up { animation: fadeUp .55s ease both; }

/* شبكة الصف الثاني */
.grid-2 { display: grid; grid-template-columns: 1.25fr 1fr; gap: 14px; margin-bottom: 20px; }

/* مقارنة الفترتين */
.period-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.period-card {
    border: 1px solid var(--stroke); border-radius: 16px; padding: 15px 16px;
    background: rgba(0,0,0,.14); transition: transform .25s, border-color .25s;
}
.period-card:hover { transform: translateY(-3px); border-color: var(--stroke-strong); }
.period-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; margin-bottom: 10px; }
.period-title svg { width: 17px; height: 17px; }
.p-morning svg, .p-morning { color: #fbbf24; }
.p-evening svg, .p-evening { color: #818cf8; }
.period-rate { font-size: 27px; font-weight: 900; font-variant-numeric: tabular-nums; }
.period-stats { display: flex; gap: 12px; font-size: 11.5px; color: var(--muted); margin-top: 2px; flex-wrap: wrap; }
.period-stats b { color: var(--text); }
.bar { height: 8px; border-radius: 99px; background: var(--ring-track); overflow: hidden; margin-top: 11px; }
.bar i {
    display: block; height: 100%; width: 0; border-radius: 99px;
    background: var(--grad); transition: width 1.1s cubic-bezier(.22,1,.36,1);
}
.bar i.ok { background: linear-gradient(90deg, var(--ok), var(--accent)); }
.bar i.warn { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.bar i.bad { background: linear-gradient(90deg, #e11d48, #fb7185); }

/* رسم الاتجاه */
.trend-chart { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding-top: 8px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; min-width: 0; }
.trend-bar-wrap { width: 100%; max-width: 44px; flex: 1; display: flex; align-items: flex-end; justify-content: center; position: relative; }
.trend-bar {
    width: 100%; border-radius: 9px 9px 4px 4px; position: relative;
    background: var(--grad); min-height: 5px;
    transform: scaleY(0); transform-origin: bottom;
    transition: transform .9s cubic-bezier(.22,1,.36,1), filter .2s;
    box-shadow: 0 6px 18px -6px var(--primary);
}
.trend-bar.zero { background: var(--ring-track); box-shadow: none; }
.trend-col:hover .trend-bar { filter: brightness(1.25); }
.trend-bar.empty { background: repeating-linear-gradient(-45deg, var(--ring-track) 0 4px, transparent 4px 8px); box-shadow: none; }
.trend-val { position: absolute; top: -22px; inset-inline: 0; text-align: center; font-size: 11.5px; font-weight: 800; opacity: 0; transition: opacity .25s; color: var(--accent); font-variant-numeric: tabular-nums; }
.trend-col:hover .trend-val { opacity: 1; }
.trend-day { font-size: 11px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.trend-day.friday { color: var(--faint); }
.trend-tip {
    position: absolute; bottom: calc(100% + 8px); inset-inline: 50%; translate: 50% 0;
    background: var(--card-solid); border: 1px solid var(--stroke-strong); color: var(--text);
    font-size: 11px; font-weight: 700; padding: 6px 11px; border-radius: 10px; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 5; box-shadow: var(--shadow);
}
.trend-col:hover .trend-tip { opacity: 1; }

/* لوحة المدربين */
.trainer-list { display: flex; flex-direction: column; gap: 9px; max-height: 430px; overflow-y: auto; padding-inline-end: 4px; }
.trainer-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 13px;
    border: 1px solid var(--stroke); border-radius: 15px; background: rgba(0,0,0,.13);
    transition: transform .22s, border-color .22s, background .22s;
    animation: fadeUp .5s ease both;
}
.trainer-row:hover { transform: translateX(-4px); border-color: var(--primary); background: var(--card-hover); }
.avatar {
    width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center;
    font-size: 14px; font-weight: 800; color: #fff; background: var(--grad);
    box-shadow: 0 6px 14px -6px var(--primary);
}
.avatar.r1 { background: linear-gradient(135deg, #d4a017, #fbbf24); box-shadow: 0 6px 14px -6px #d4a017; }
.avatar.r2 { background: linear-gradient(135deg, #64748b, #94a3b8); box-shadow: 0 6px 14px -6px #64748b; }
.avatar.r3 { background: linear-gradient(135deg, #b45309, #d97706); box-shadow: 0 6px 14px -6px #b45309; }
.trainer-info { flex: 1; min-width: 0; }
.trainer-name { font-size: 13.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trainer-meta { font-size: 11px; color: var(--muted); }
.trainer-rate-box { text-align: center; flex: none; width: 52px; }
.trainer-rate { font-size: 16px; font-weight: 900; font-variant-numeric: tabular-nums; }
.trainer-rate.good { color: var(--ok); } .trainer-rate.mid { color: var(--warn); } .trainer-rate.low { color: var(--bad); }
.trainer-mini-bar { height: 5px; width: 74px; border-radius: 99px; background: var(--ring-track); overflow: hidden; margin-top: 5px; margin-inline: auto; }
.trainer-mini-bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--grad); transition: width 1s cubic-bezier(.22,1,.36,1); }
.rank-badge {
    width: 24px; height: 24px; flex: none; border-radius: 8px; display: grid; place-items: center;
    font-size: 11.5px; font-weight: 900; background: var(--card-hover); border: 1px solid var(--stroke); color: var(--muted);
}
.rank-badge.r1 { background: var(--ok-bg); border-color: var(--ok-bd); color: var(--ok); }

/* بحث */
.search-box { position: relative; flex: 1; max-width: 320px; }
.search-box svg { position: absolute; top: 50%; inset-inline-start: 13px; translate: 0 -50%; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.search-box input {
    width: 100%; padding: 10px 42px 10px 14px; border-radius: 13px;
    border: 1px solid var(--stroke); background: rgba(0,0,0,.22); color: var(--text);
    font-family: inherit; font-size: 13px; transition: border-color .25s, box-shadow .25s;
}
.search-box input::placeholder { color: var(--faint); }
.search-box input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }

/* ─────────── شاشة الدخول ─────────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 22px; }
.login-card {
    width: 100%; max-width: 470px; padding: 34px 30px;
    background: var(--card); border: 1px solid var(--stroke); border-radius: 26px;
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow); animation: loginIn .6s cubic-bezier(.22,1,.36,1) both; text-align: center;
}
@keyframes loginIn { from { opacity: 0; transform: translateY(26px) scale(.97); } to { opacity: 1; transform: none; } }
.login-logo { position: relative; width: 78px; height: 78px; margin: 0 auto 14px; display: grid; place-items: center; }
.login-logo::before {
    content: ''; position: absolute; inset: -9px; border-radius: 26px; border: 2px dashed var(--stroke-strong);
    animation: spinSlow 14s linear infinite;
}
@keyframes spinSlow { to { transform: rotate(360deg); } }
.login-logo-ic { width: 78px; height: 78px; border-radius: 24px; background: var(--grad); display: grid; place-items: center; color: #fff; box-shadow: 0 14px 34px -10px var(--primary); animation: logoPulse 3s ease-in-out infinite; }
.login-logo-ic svg { width: 37px; height: 37px; }
.login-title { font-size: 21px; font-weight: 900; }
.login-sub { font-size: 12.5px; color: var(--muted); margin: 4px 0 24px; }
.role-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 20px; background: rgba(0,0,0,.2); padding: 6px; border-radius: 16px; border: 1px solid var(--stroke); }
.role-tab {
    padding: 11px; border-radius: 12px; border: none; background: transparent; color: var(--muted);
    font-family: inherit; font-size: 13.5px; font-weight: 800; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: all .3s;
}
.role-tab svg { width: 17px; height: 17px; }
.role-tab.active { background: var(--grad); color: #fff; box-shadow: 0 8px 18px -8px var(--primary); }
.login-field { text-align: right; margin-bottom: 15px; }
.login-field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 7px; }
.login-field select, .login-field input {
    width: 100%; padding: 13px 15px; border-radius: 14px; border: 1px solid var(--stroke);
    background: rgba(0,0,0,.25); color: var(--text); font-family: inherit; font-size: 14px; font-weight: 600;
    transition: border-color .25s, box-shadow .25s;
}
.login-field select:focus, .login-field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 20%, transparent); }
.login-btn { width: 100%; margin-top: 6px; padding: 14px; font-size: 15px; border-radius: 15px; }
.login-note { margin-top: 18px; font-size: 11.5px; color: var(--faint); display: flex; align-items: center; justify-content: center; gap: 6px; }
.login-note svg { width: 14px; height: 14px; }
.pin-hint { font-size: 11px; color: var(--faint); margin-top: 8px; }
.shake { animation: shake .45s ease; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-9px); } 40%,80% { transform: translateX(9px); } }

/* ─────────── محدد التاريخ ─────────── */
.datebar { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; margin-bottom: 20px; animation: fadeUp .5s ease .1s both; }
.date-nav { display: flex; align-items: center; gap: 5px; background: var(--card); border: 1px solid var(--stroke); border-radius: 16px; padding: 6px; }
.date-display { text-align: center; padding: 0 10px; min-width: 205px; }
.date-main { font-size: 14.5px; font-weight: 800; }
.date-hijri { font-size: 11px; color: var(--muted); }
.date-input {
    border: 1px solid var(--stroke); background: rgba(0,0,0,.25); color: var(--text);
    border-radius: 13px; padding: 9px 13px; font-family: inherit; font-size: 13px; font-weight: 700;
    color-scheme: dark;
}
.date-input:focus { outline: none; border-color: var(--primary); }
.friday-banner {
    display: flex; align-items: center; gap: 10px; padding: 12px 17px; border-radius: 15px;
    background: var(--warn-bg); border: 1px solid var(--warn-bd); color: var(--warn);
    font-size: 13px; font-weight: 700; margin-bottom: 18px; animation: fadeUp .4s ease both;
}
.friday-banner svg { width: 19px; height: 19px; flex: none; }

/* ─────────── قسم المحاضرات ─────────── */
.lect-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.chip-row { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
    padding: 7px 15px; border-radius: 99px; border: 1px solid var(--stroke);
    background: transparent; color: var(--muted); font-family: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
    transition: all .25s;
}
.chip:hover { color: var(--text); border-color: var(--stroke-strong); }
.chip.active { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 6px 16px -7px var(--primary); }
.lect-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 13px; }
.lect-card {
    background: var(--card); border: 1px solid var(--stroke); border-radius: 18px; padding: 16px 17px;
    position: relative; overflow: hidden; backdrop-filter: blur(10px);
    transition: transform .28s ease, border-color .28s, box-shadow .28s, background .28s;
    animation: fadeUp .5s ease both;
}
.lect-card::before { content: ''; position: absolute; top: 0; bottom: 0; inset-inline-start: 0; width: 4px; background: var(--ring-track); }
.lect-card.s-DONE::before { background: var(--ok); }
.lect-card.s-NOT_DONE::before { background: var(--bad); }
.lect-card.s-PENDING::before { background: var(--warn); }
.lect-card:hover { transform: translateY(-4px) scale(1.004); border-color: var(--stroke-strong); box-shadow: 0 20px 40px -18px rgba(0,0,0,.55); background: var(--card-hover); }
.lect-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 11px; }
.lect-title { font-size: 14.5px; font-weight: 800; flex: 1; line-height: 1.5; }
.lect-program { font-size: 11px; color: var(--muted); margin-top: 2px; }
.status-badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 99px;
    font-size: 11px; font-weight: 800; flex: none; border: 1px solid transparent;
}
.status-badge svg { width: 13px; height: 13px; }
.status-badge.DONE { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-bd); }
.status-badge.NOT_DONE { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-bd); }
.status-badge.PENDING { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-bd); }
.lect-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.meta-pill {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 10px;
    background: rgba(0,0,0,.18); border: 1px solid var(--stroke); font-size: 11.5px; color: var(--muted); font-weight: 600;
}
.meta-pill svg { width: 13.5px; height: 13.5px; color: var(--primary-2); flex: none; }
.lect-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.lect-actions .spacer { flex: 1; }
.note-chip {
    margin-top: 10px; padding: 8px 12px; border-radius: 11px; font-size: 11.5px;
    background: var(--bad-bg); border: 1px solid var(--bad-bd); color: var(--bad); display: flex; gap: 7px; align-items: center;
}
.note-chip svg { width: 14px; height: 14px; flex: none; }
.empty-state { text-align: center; padding: 46px 20px; color: var(--muted); animation: fadeIn .4s ease both; }
.empty-state svg { width: 52px; height: 52px; color: var(--faint); margin-bottom: 12px; opacity: .6; }
.empty-title { font-size: 15px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.empty-sub { font-size: 12.5px; }

/* ─────────── الجداول الإدارية ─────────── */
.table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid var(--stroke); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
table.data th {
    text-align: right; padding: 12px 14px; background: rgba(0,0,0,.25); color: var(--muted);
    font-size: 12px; font-weight: 800; border-bottom: 1px solid var(--stroke); white-space: nowrap;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--stroke); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .2s; }
table.data tbody tr:hover { background: var(--card-hover); }

/* النماذج */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.field label b { color: var(--bad); }
.field input, .field select, .field textarea {
    width: 100%; padding: 11px 14px; border-radius: 13px; border: 1px solid var(--stroke);
    background: rgba(0,0,0,.22); color: var(--text); font-family: inherit; font-size: 13.5px; font-weight: 600;
    transition: border-color .25s, box-shadow .25s;
}
.field textarea { resize: vertical; min-height: 74px; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--primary) 20%, transparent);
}
.field select option { background: var(--card-solid); color: var(--text); }

/* ─────────── المظهر: 4 ثيمات ─────────── */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.theme-card {
    border: 2px solid var(--stroke); border-radius: 18px; padding: 14px; cursor: pointer;
    background: rgba(0,0,0,.15); transition: all .3s cubic-bezier(.34,1.3,.64,1); position: relative; text-align: center;
}
.theme-card:hover { transform: translateY(-4px); border-color: var(--stroke-strong); }
.theme-card.active { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 20%, transparent); }
.theme-preview { height: 74px; border-radius: 13px; margin-bottom: 11px; position: relative; overflow: hidden; }
.theme-preview i { position: absolute; border-radius: 6px; }
.theme-preview .tp-bar { top: 10px; inset-inline: 14px; height: 12px; opacity: .9; }
.theme-preview .tp-a { bottom: 12px; inset-inline-start: 14px; width: 46%; height: 26px; opacity: .85; }
.theme-preview .tp-b { bottom: 12px; inset-inline-end: 14px; width: 30%; height: 26px; opacity: .55; }
.theme-name { font-size: 13.5px; font-weight: 800; }
.theme-check {
    position: absolute; top: -9px; inset-inline-end: -9px; width: 26px; height: 26px; border-radius: 50%;
    background: var(--grad); color: #fff; display: none; place-items: center; box-shadow: 0 4px 12px -3px var(--primary);
}
.theme-check svg { width: 14px; height: 14px; }
.theme-card.active .theme-check { display: grid; animation: tabPop .3s ease; }

/* ─────────── الاستيراد ─────────── */
.dropzone {
    border: 2px dashed var(--stroke-strong); border-radius: 20px; padding: 44px 24px;
    text-align: center; cursor: pointer; transition: all .3s; background: rgba(0,0,0,.13);
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); transform: scale(1.004); }
.dropzone svg { width: 46px; height: 46px; color: var(--primary-2); margin-bottom: 12px; animation: floatY 2.6s ease-in-out infinite; }
@keyframes floatY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.dropzone-title { font-size: 15.5px; font-weight: 800; margin-bottom: 4px; }
.dropzone-sub { font-size: 12px; color: var(--muted); }
.dropzone-formats { display: flex; gap: 8px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.fmt-badge {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 13px; border-radius: 10px;
    font-size: 11.5px; font-weight: 800; border: 1px solid var(--stroke); background: var(--card);
}
.fmt-badge svg { width: 14px; height: 14px; color: var(--primary-2); }
.import-steps { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.istep { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--faint); }
.istep-num {
    width: 27px; height: 27px; border-radius: 9px; display: grid; place-items: center;
    background: var(--card-hover); border: 1px solid var(--stroke); font-size: 12px; font-weight: 900;
}
.istep.active { color: var(--text); }
.istep.active .istep-num { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 5px 14px -5px var(--primary); }
.istep-line { width: 34px; height: 2px; background: var(--stroke); border-radius: 2px; }

/* هياكل تحميل */
.skeleton { border-radius: 14px; background: linear-gradient(90deg, var(--card) 25%, var(--card-hover) 50%, var(--card) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ─────────── النوافذ المنبثقة ─────────── */
.modal-back {
    position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 18px;
    background: rgba(3,8,18,.62); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
    animation: fadeIn .25s ease both;
}
.modal {
    width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
    background: var(--card-solid); border: 1px solid var(--stroke-strong); border-radius: 22px;
    box-shadow: 0 30px 80px -20px rgba(0,0,0,.7); animation: modalIn .35s cubic-bezier(.22,1.2,.36,1) both;
}
.modal.wide { max-width: 860px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(26px) scale(.96); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; gap: 11px; padding: 19px 22px; border-bottom: 1px solid var(--stroke); position: sticky; top: 0; background: var(--card-solid); z-index: 2; border-radius: 22px 22px 0 0; }
.modal-head-ic { width: 38px; height: 38px; border-radius: 12px; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; }
.modal-head-ic svg { width: 19px; height: 19px; }
.modal-title { font-size: 15.5px; font-weight: 800; flex: 1; }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-start; padding: 16px 22px; border-top: 1px solid var(--stroke); position: sticky; bottom: 0; background: var(--card-solid); border-radius: 0 0 22px 22px; }

/* ─────────── التنبيهات (Toasts) ─────────── */
.toasts { position: fixed; top: 18px; inset-inline-start: 18px; z-index: 90; display: flex; flex-direction: column; gap: 10px; max-width: min(360px, calc(100vw - 36px)); }
.toast {
    display: flex; align-items: center; gap: 11px; padding: 13px 16px;
    background: var(--card-solid); border: 1px solid var(--stroke-strong); border-radius: 15px;
    box-shadow: var(--shadow); font-size: 13px; font-weight: 700;
    animation: toastIn .45s cubic-bezier(.22,1.2,.36,1) both; position: relative; overflow: hidden;
}
.toast.out { animation: toastOut .3s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-40px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(-40px) scale(.95); } }
.toast-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.toast-ic svg { width: 16px; height: 16px; }
.toast.success .toast-ic { background: var(--ok-bg); color: var(--ok); }
.toast.error .toast-ic { background: var(--bad-bg); color: var(--bad); }
.toast.info .toast-ic { background: rgba(59,130,246,.15); color: var(--primary-2); }
.toast::after { content: ''; position: absolute; bottom: 0; inset-inline-start: 0; height: 3px; width: 100%; transform-origin: right; animation: toastTimer 3.4s linear both; }
.toast.success::after { background: var(--ok); } .toast.error::after { background: var(--bad); } .toast.info::after { background: var(--primary); }
@keyframes toastTimer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* لوحة الثيم السريع في الرأس */
.theme-menu { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 60; min-width: 210px; background: var(--card-solid); border: 1px solid var(--stroke-strong); border-radius: 16px; padding: 9px; box-shadow: var(--shadow); animation: modalIn .25s ease both; }
.theme-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border: none; background: transparent; color: var(--text); font-family: inherit; font-size: 13px; font-weight: 700; border-radius: 11px; cursor: pointer; transition: background .2s; text-align: right; }
.theme-menu-item:hover { background: var(--card-hover); }
.theme-dot { width: 22px; height: 22px; border-radius: 8px; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.theme-menu-item.active { background: var(--card-hover); outline: 1px solid var(--primary); }

/* مستخدم */
.user-chip { display: flex; align-items: center; gap: 9px; padding: 6px 7px; padding-inline-start: 13px; border-radius: 14px; border: 1px solid var(--stroke); background: rgba(0,0,0,.16); }
.user-chip .avatar { width: 32px; height: 32px; border-radius: 10px; font-size: 12px; }
.user-name { font-size: 12.5px; font-weight: 800; line-height: 1.3; max-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: var(--accent); font-weight: 700; }

/* تجاوب */
@media (max-width: 1024px) {
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .app { padding-bottom: 50px; }
    .topbar { flex-wrap: wrap; top: 8px; padding: 11px 13px; }
    .liveclock { order: 5; width: 100%; justify-content: center; background: rgba(0,0,0,.15); border-radius: 12px; padding: 5px; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .kpi-hero { flex-direction: column; text-align: center; }
    .period-row { grid-template-columns: 1fr; }
    .lect-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .date-display { min-width: 0; }
    .datebar .btn span { display: none; }
    .datebar .btn svg { margin: 0; }
    .user-chip .user-meta { display: none; }
    .brand-sub { display: none; }
    .trend-chart { height: 150px; gap: 6px; }
    .trend-day { font-size: 9.5px; }
    .modal { max-height: 92vh; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ═════════ الهيكل الأكاديمي: المواد والتخصيص + الحضور الفعلي ═════════ */
.kpi-ic.att { background: linear-gradient(135deg, var(--primary), var(--accent)); }
.att-pill { border-color: var(--ok-bd) !important; color: var(--ok); background: var(--ok-bg); }

.my-subjects { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.my-subject-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--stroke); border-radius: 13px; background: rgba(255,255,255,.02); animation: fadeUp .4s ease both; }
.my-subject-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; flex: none; }
.my-subject-ic svg { width: 17px; height: 17px; }

.group-card { border: 1px solid var(--stroke); border-radius: 16px; margin-bottom: 14px; overflow: hidden; background: rgba(255,255,255,.02); }
.group-head { display: flex; align-items: center; gap: 12px; padding: 13px 16px; background: rgba(255,255,255,.03); border-bottom: 1px solid var(--stroke); flex-wrap: wrap; }
.group-title { font-weight: 800; font-size: 14.5px; }
.group-meta { color: var(--muted); font-size: 12px; margin-inline-start: auto; }

.section-badge { font-size: 11px; font-weight: 800; padding: 4px 12px; border-radius: 99px; white-space: nowrap; }
.section-badge.b-men { background: rgba(59,130,246,.14); color: #93bbfd; border: 1px solid rgba(59,130,246,.3); }
.section-badge.b-women { background: rgba(236,72,153,.13); color: #f9a8d4; border: 1px solid rgba(236,72,153,.3); }
.section-badge.b-remote { background: rgba(139,92,246,.14); color: #c4b5fd; border: 1px solid rgba(139,92,246,.3); }

.subj-table td { padding: 9px 14px; }
.trainer-select { width: 100%; max-width: 280px; padding: 7px 11px; border-radius: 10px; border: 1px solid var(--stroke); background: rgba(0,0,0,.18); color: var(--text); font-family: inherit; font-size: 13px; cursor: pointer; }
.trainer-select:focus { outline: 2px solid var(--primary); border-color: transparent; }

.assign-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
.assign-badge svg { width: 13px; height: 13px; }
.assign-badge.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-bd); }
.assign-badge.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-bd); }

@media (max-width: 700px) {
    .trainer-select { max-width: 100%; }
    .group-meta { margin-inline-start: 0; }
}
