/* ========================================================================
   منصة اختباراتي - تصميم متجاوب لكل الأجهزة | RTL | Tajawal
   ======================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&family=Tajawal:wght@400;500;700;800&display=swap');

:root {
  --bg-primary:#0b0f19;
  --bg-secondary:#111827;
  --bg-card:rgba(17,24,39,.8);
  --bg-card-hover:rgba(31,41,55,.9);
  --bg-glass:rgba(255,255,255,.04);
  --text-primary:#f8fafc;
  --text-secondary:#94a3b8;
  --text-muted:#64748b;
  --border-color:rgba(255,255,255,.08);
  --accent-blue:#38bdf8;
  --accent-cyan:#06b6d4;
  --accent-indigo:#6366f1;
  --accent-purple:#a855f7;
  --success:#10b981;
  --success-bg:rgba(16,185,129,.15);
  --success-border:rgba(16,185,129,.4);
  --danger:#f43f5e;
  --danger-bg:rgba(244,63,94,.15);
  --danger-border:rgba(244,63,94,.4);
  --warning:#f59e0b;
  --r-sm:8px; --r-md:14px; --r-lg:20px; --r-xl:28px;
  --sh-sm:0 4px 6px -1px rgba(0,0,0,.25);
  --sh-md:0 10px 25px -5px rgba(0,0,0,.4);
  --sh-lg:0 20px 40px -10px rgba(0,0,0,.5);
  --tr:all .25s cubic-bezier(.4,0,.2,1);
  --font:'Tajawal','Cairo',system-ui,sans-serif;
}
body.light-mode {
  --bg-primary:#f1f5f9;
  --bg-secondary:#fff;
  --bg-card:rgba(255,255,255,.92);
  --bg-card-hover:#f8fafc;
  --bg-glass:rgba(0,0,0,.03);
  --text-primary:#0f172a;
  --text-secondary:#475569;
  --text-muted:#94a3b8;
  --border-color:rgba(0,0,0,.09);
}
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html {
  font-family: var(--font);
  direction: rtl;
  text-align: right;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
body {
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.65;
  background-image: radial-gradient(circle at 10% 20%, rgba(56, 189, 248, .07) 0%, transparent 40%), radial-gradient(circle at 90% 80%, rgba(99, 102, 241, .07) 0%, transparent 40%);
  background-attachment: fixed;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
  transition: background .3s, color .3s;
}
.container {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 1.25rem;
  box-sizing: border-box;
}

/* ── HEADER ───────────────────────────────────── */
.main-header{position:sticky;top:0;z-index:50;backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px);
  background:rgba(11,15,25,.8);border-bottom:1px solid var(--border-color);transition:var(--tr)}
body.light-mode .main-header{background:rgba(255,255,255,.85)}
.header-container{display:flex;align-items:center;justify-content:space-between;padding:.8rem 0}
.brand-logo{display:flex;align-items:center;gap:.75rem;text-decoration:none;color:var(--text-primary)}
.brand-icon{width:44px;height:44px;border-radius:var(--r-md);background:linear-gradient(135deg,var(--accent-blue),var(--accent-indigo));
  display:flex;align-items:center;justify-content:center;font-size:1.5rem;box-shadow:0 4px 14px rgba(56,189,248,.3);flex-shrink:0}
.brand-name{font-family:'Cairo',sans-serif;font-size:1.2rem;font-weight:800;letter-spacing:-.02em;line-height:1.2}
.brand-sub{font-size:.75rem;color:var(--text-muted)}
.header-actions{display:flex;align-items:center;gap:.5rem}
.icon-btn{background:var(--bg-glass);border:1px solid var(--border-color);color:var(--text-primary);
  width:40px;height:40px;border-radius:var(--r-sm);display:flex;align-items:center;justify-content:center;
  cursor:pointer;font-size:1.15rem;transition:var(--tr)}
.icon-btn:hover{border-color:var(--accent-blue);transform:translateY(-2px)}

/* ── HERO ─────────────────────────────────────── */
.hero-section{padding:2.5rem 0 1.75rem;text-align:center}
.hero-badge{display:inline-flex;align-items:center;gap:.45rem;padding:.35rem 1rem;border-radius:9999px;
  background:rgba(56,189,248,.1);border:1px solid rgba(56,189,248,.25);color:var(--accent-blue);
  font-size:.82rem;font-weight:700;margin-bottom:1rem}
.hero-title{font-family:'Cairo',sans-serif;font-size:2.4rem;font-weight:900;margin-bottom:.75rem;line-height:1.25}
.hero-title .grad{background:linear-gradient(135deg,var(--accent-blue),var(--accent-purple));-webkit-background-clip:text;-webkit-text-fill-color:transparent}
.hero-desc{max-width:640px;margin:0 auto 1.5rem;color:var(--text-secondary);font-size:1.02rem}
.quick-stats{display:flex;justify-content:center;gap:.85rem;flex-wrap:wrap;margin-bottom:2rem}
.qs-item{background:var(--bg-card);backdrop-filter:blur(10px);border:1px solid var(--border-color);
  padding:.6rem 1.2rem;border-radius:var(--r-md);display:flex;align-items:center;gap:.7rem;box-shadow:var(--sh-sm)}
.qs-icon{font-size:1.3rem}
.qs-val{font-weight:800;font-size:1.05rem}
.qs-lbl{font-size:.73rem;color:var(--text-muted)}

/* ── SUBJECTS GRID ────────────────────────────── */
.sec-hd{display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:1.5rem}
.sec-hd h2{font-family:'Cairo',sans-serif;font-size:1.45rem;font-weight:800}
.sec-hd p{font-size:.88rem;color:var(--text-secondary)}
.subjects-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:1.5rem;padding-bottom:3.5rem}
.subj-card{position:relative;background:var(--bg-card);backdrop-filter:blur(12px);border:1px solid var(--border-color);
  border-radius:var(--r-xl);padding:1.75rem;display:flex;flex-direction:column;transition:var(--tr);overflow:hidden;box-shadow:var(--sh-sm)}
.subj-card::before{content:'';position:absolute;top:0;right:0;left:0;height:4px;
  background:linear-gradient(90deg,var(--cc,var(--accent-blue)),transparent);opacity:.85}
.subj-card:hover{transform:translateY(-8px);border-color:var(--cc,var(--accent-blue));box-shadow:var(--sh-lg),0 0 25px rgba(56,189,248,.12)}
.card-top{display:flex;align-items:flex-start;justify-content:space-between;margin-bottom:1.2rem}
.subj-icon{width:58px;height:58px;border-radius:var(--r-md);background:var(--cb,rgba(56,189,248,.15));
  color:var(--cc,var(--accent-blue));display:flex;align-items:center;justify-content:center;font-size:1.85rem}
.subj-badge{background:var(--bg-glass);border:1px solid var(--border-color);
  padding:.22rem .65rem;border-radius:9999px;font-size:.73rem;color:var(--text-secondary);font-weight:700}
.subj-title{font-family:'Cairo',sans-serif;font-size:1.22rem;font-weight:700;margin-bottom:.45rem}
.subj-desc{font-size:.87rem;color:var(--text-secondary);margin-bottom:1.2rem;flex-grow:1;line-height:1.5}
.subj-meta{display:flex;gap:1rem;padding:.7rem 0;border-top:1px solid var(--border-color);
  border-bottom:1px solid var(--border-color);margin-bottom:1.2rem;font-size:.8rem;color:var(--text-muted)}
.meta-item{display:flex;align-items:center;gap:.35rem}
.meta-item strong{color:var(--text-primary)}
.best-score-row{display:flex;justify-content:space-between;align-items:center;
  background:var(--bg-glass);border-radius:var(--r-sm);padding:.4rem .8rem;font-size:.8rem;margin-bottom:1.2rem}
.best-score-val{font-weight:800;color:var(--cc,var(--accent-blue))}
.start-btn{width:100%;padding:.88rem;border-radius:var(--r-md);
  background:linear-gradient(135deg,var(--cc,var(--accent-blue)),var(--accent-indigo));
  color:#fff;border:none;font-family:var(--font);font-size:.95rem;font-weight:800;
  cursor:pointer;display:flex;align-items:center;justify-content:center;gap:.5rem;transition:var(--tr);box-shadow:var(--sh-sm)}
.start-btn:hover{filter:brightness(1.15);transform:translateY(-2px);box-shadow:0 6px 20px rgba(56,189,248,.35)}

/* ── MODAL ────────────────────────────────────── */
.overlay{position:fixed;inset:0;background:rgba(0,0,0,.75);backdrop-filter:blur(10px);
  display:flex;align-items:center;justify-content:center;z-index:100;padding:1.25rem;
  opacity:0;visibility:hidden;transition:var(--tr)}
.overlay.open{opacity:1;visibility:visible}
.modal{background:var(--bg-secondary);border:1px solid var(--border-color);border-radius:var(--r-xl);
  width:100%;max-width:520px;padding:2rem;box-shadow:var(--sh-lg);transform:scale(.95) translateY(12px);transition:var(--tr)}
.overlay.open .modal{transform:scale(1) translateY(0)}
.modal-hd{display:flex;align-items:center;justify-content:space-between;margin-bottom:1.2rem}
.modal-hd h3{font-family:'Cairo',sans-serif;font-size:1.3rem;font-weight:800}
.close-btn{background:none;border:none;color:var(--text-muted);font-size:1.5rem;cursor:pointer;transition:var(--tr);line-height:1}
.close-btn:hover{color:var(--danger)}
.modal-preview{display:flex;align-items:center;gap:1rem;background:var(--bg-glass);
  padding:1rem;border-radius:var(--r-md);margin-bottom:1.5rem;border:1px solid var(--border-color)}
.preview-icon{font-size:2rem}
.mode-list{display:flex;flex-direction:column;gap:.8rem;margin-bottom:1.4rem}
.mode-card{display:flex;align-items:center;gap:1rem;padding:1rem;
  border:2px solid var(--border-color);border-radius:var(--r-md);background:var(--bg-glass);cursor:pointer;transition:var(--tr)}
.mode-card:hover{border-color:var(--accent-blue)}
.mode-card.sel{border-color:var(--accent-blue);background:rgba(56,189,248,.1)}
.mode-icon{width:44px;height:44px;border-radius:var(--r-sm);background:rgba(56,189,248,.15);
  color:var(--accent-blue);display:flex;align-items:center;justify-content:center;font-size:1.35rem;flex-shrink:0}
.mode-info h4{font-size:.97rem;font-weight:700;margin-bottom:.2rem}
.mode-info p{font-size:.78rem;color:var(--text-secondary)}
.timer-row{display:flex;align-items:center;justify-content:space-between;
  padding:.8rem 0;border-top:1px solid var(--border-color);margin-bottom:1.4rem}
.timer-lbl{font-size:.9rem;color:var(--text-secondary)}
.toggle{position:relative;width:46px;height:26px}
.toggle input{opacity:0;width:0;height:0}
.slider{position:absolute;cursor:pointer;inset:0;background:var(--bg-glass);border:1px solid var(--border-color);
  transition:.3s;border-radius:9999px}
.slider:before{position:absolute;content:"";height:18px;width:18px;right:3px;bottom:3px;
  background:var(--text-muted);transition:.3s;border-radius:50%}
input:checked+.slider{background:var(--accent-blue);border-color:var(--accent-blue)}
input:checked+.slider:before{transform:translateX(-20px);background:#fff}
.modal-actions{display:flex;gap:.7rem}
.btn-ghost{background:var(--bg-glass);border:1px solid var(--border-color);color:var(--text-primary);
  padding:.85rem 1.2rem;border-radius:var(--r-md);font-family:var(--font);font-weight:600;cursor:pointer;transition:var(--tr)}
.btn-ghost:hover{background:var(--bg-card-hover)}
.btn-go{flex-grow:1;background:linear-gradient(135deg,var(--accent-blue),var(--accent-indigo));border:none;color:#fff;
  padding:.85rem 1.5rem;border-radius:var(--r-md);font-family:var(--font);font-weight:800;font-size:1rem;
  cursor:pointer;transition:var(--tr);box-shadow:0 4px 14px rgba(56,189,248,.3)}
.btn-go:hover{filter:brightness(1.12);transform:translateY(-2px)}

/* ── QUIZ SCREEN ──────────────────────────────── */
.quiz-screen,.results-screen{display:none;padding:1.5rem 0 4rem}
.quiz-screen.active,.results-screen.active{display:block}
.home-screen.hidden{display:none}
.quiz-bar{display:flex;align-items:center;justify-content:space-between;
  background:var(--bg-card);backdrop-filter:blur(12px);border:1px solid var(--border-color);
  border-radius:var(--r-md);padding:.8rem 1.2rem;margin-bottom:1.2rem;gap:1rem;flex-wrap:wrap}
.qbar-left{display:flex;align-items:center;gap:.6rem}
.qbar-icon{font-size:1.35rem}
.qbar-name{font-weight:800;font-size:1rem}
.qbar-right{display:flex;align-items:center;gap:1rem}
.timer-chip{display:flex;align-items:center;gap:.4rem;background:rgba(245,158,11,.1);
  border:1px solid rgba(245,158,11,.25);color:var(--warning);
  padding:.3rem .75rem;border-radius:9999px;font-weight:800;font-size:.9rem}
.prog-count{font-weight:700;color:var(--text-secondary);font-size:.92rem;white-space:nowrap}
.prog-count span{color:var(--accent-blue);font-size:1.05rem}
.progress-track{height:8px;background:rgba(255,255,255,.06);border-radius:9999px;overflow:hidden;
  border:1px solid var(--border-color);margin-bottom:1.75rem}
.progress-fill{height:100%;width:0%;background:linear-gradient(90deg,var(--accent-blue),var(--accent-indigo));
  border-radius:9999px;transition:width .4s ease}
.quiz-layout{display:grid;grid-template-columns:1fr;gap:1.75rem}
.q-card{background:var(--bg-card);backdrop-filter:blur(16px);border:1px solid var(--border-color);
  border-radius:var(--r-xl);padding:2.25rem;box-shadow:var(--sh-md)}
.q-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:1.4rem}
.q-tag{display:inline-flex;align-items:center;gap:.4rem;padding:.3rem .85rem;border-radius:9999px;
  background:rgba(56,189,248,.1);color:var(--accent-blue);font-size:.78rem;font-weight:700;border:1px solid rgba(56,189,248,.25)}
.q-type{font-size:.78rem;color:var(--text-muted)}
.q-text{font-family:'Cairo',sans-serif;font-size:1.35rem;font-weight:700;line-height:1.65;margin-bottom:2rem}
.opts{display:grid;grid-template-columns:1fr;gap:.9rem;margin-bottom:2rem}
.opt{display:flex;align-items:center;gap:1rem;padding:1.1rem 1.35rem;
  background:var(--bg-glass);border:2px solid var(--border-color);border-radius:var(--r-md);
  color:var(--text-primary);font-family:var(--font);font-size:1.02rem;cursor:pointer;text-align:right;transition:var(--tr)}
.opt:hover:not(.disabled){border-color:var(--accent-blue);background:var(--bg-card-hover);transform:translateX(-4px)}
.opt-mark{width:34px;height:34px;border-radius:50%;background:rgba(255,255,255,.05);
  border:1px solid var(--border-color);display:flex;align-items:center;justify-content:center;
  font-weight:800;font-size:.88rem;flex-shrink:0;transition:var(--tr)}
.opt.sel{border-color:var(--accent-blue);background:rgba(56,189,248,.12)}
.opt.sel .opt-mark{background:var(--accent-blue);color:#0b0f19;border-color:var(--accent-blue)}
.opts.tf-grid{grid-template-columns:1fr 1fr}
.opt.ok{border-color:var(--success)!important;background:var(--success-bg)!important}
.opt.ok .opt-mark{background:var(--success)!important;color:#fff!important;border-color:var(--success)!important}
.opt.bad{border-color:var(--danger)!important;background:var(--danger-bg)!important}
.opt.bad .opt-mark{background:var(--danger)!important;color:#fff!important;border-color:var(--danger)!important}
.opt.disabled{cursor:default}
.exp-box{display:none;background:rgba(56,189,248,.06);border:1px solid rgba(56,189,248,.2);
  border-radius:var(--r-md);padding:1.2rem;margin-bottom:1.75rem;animation:fadeIn .3s ease}
.exp-box.show{display:flex;gap:.85rem;align-items:flex-start}
.exp-ico{font-size:1.5rem;color:var(--accent-blue);flex-shrink:0}
.exp-title{font-size:.92rem;font-weight:800;color:var(--accent-blue);margin-bottom:.3rem}
.exp-text{font-size:.88rem;color:var(--text-secondary);line-height:1.6}
.quiz-nav{display:flex;align-items:center;justify-content:space-between;gap:1rem;
  padding-top:1.5rem;border-top:1px solid var(--border-color)}
.nav-btn{padding:.85rem 1.6rem;border-radius:var(--r-md);font-family:var(--font);font-weight:700;
  font-size:.92rem;cursor:pointer;display:inline-flex;align-items:center;gap:.5rem;transition:var(--tr)}
.btn-prev{background:var(--bg-glass);border:1px solid var(--border-color);color:var(--text-primary)}
.btn-prev:hover:not(:disabled){background:var(--bg-card-hover)}
.btn-prev:disabled{opacity:.35;cursor:not-allowed}
.btn-next{background:linear-gradient(135deg,var(--accent-blue),var(--accent-indigo));border:none;color:#fff;box-shadow:0 4px 14px rgba(56,189,248,.25)}
.btn-next:hover{filter:brightness(1.15);transform:translateY(-2px)}
.btn-finish{background:linear-gradient(135deg,var(--success),#059669);border:none;color:#fff;box-shadow:0 4px 14px rgba(16,185,129,.3)}
.btn-finish:hover{filter:brightness(1.15);transform:translateY(-2px)}
/* question map desktop */
.qmap-card{display:none;background:var(--bg-card);border:1px solid var(--border-color);border-radius:var(--r-xl);
  padding:1.5rem;height:fit-content}
.qmap-title{font-size:1rem;font-weight:800;margin-bottom:1rem}
.qmap-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:.45rem;max-height:350px;overflow-y:auto;padding-left:.2rem}
.qdot{aspect-ratio:1;border-radius:var(--r-sm);background:var(--bg-glass);border:1px solid var(--border-color);
  color:var(--text-secondary);font-size:.82rem;font-weight:700;display:flex;align-items:center;justify-content:center;
  cursor:pointer;transition:var(--tr)}
.qdot:hover{border-color:var(--accent-blue);color:var(--text-primary)}
.qdot.cur{border-color:var(--accent-blue);background:rgba(56,189,248,.2);color:var(--accent-blue);box-shadow:0 0 10px rgba(56,189,248,.3)}
.qdot.ans{background:rgba(99,102,241,.25);border-color:var(--accent-indigo);color:#fff}
.qdot.right{background:var(--success);border-color:var(--success);color:#fff}
.qdot.wrong{background:var(--danger);border-color:var(--danger);color:#fff}

/* ── RESULTS SCREEN ───────────────────────────── */
.res-hero{background:var(--bg-card);backdrop-filter:blur(16px);border:1px solid var(--border-color);
  border-radius:var(--r-xl);padding:2.5rem 1.5rem;text-align:center;margin-bottom:2.5rem;box-shadow:var(--sh-lg)}
.gauge-wrap{position:relative;width:175px;height:175px;margin:0 auto 1.5rem}
.gauge-svg{width:100%;height:100%;transform:rotate(-90deg)}
.gauge-bg{fill:none;stroke:rgba(255,255,255,.07);stroke-width:10}
.gauge-prog{fill:none;stroke:var(--accent-blue);stroke-width:10;stroke-linecap:round;
  stroke-dasharray:440;stroke-dashoffset:440;transition:stroke-dashoffset 1.5s ease-out}
.score-inner{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center}
.score-pct{font-family:'Cairo',sans-serif;font-size:2.5rem;font-weight:900;line-height:1}
.score-lbl{font-size:.8rem;color:var(--text-muted)}
.res-title{font-family:'Cairo',sans-serif;font-size:1.8rem;font-weight:800;margin-bottom:.45rem}
.res-sub{color:var(--text-secondary);font-size:1rem;margin-bottom:2rem}
.res-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(125px,1fr));gap:1rem;max-width:720px;margin:0 auto 2rem}
.rs-card{background:var(--bg-glass);border:1px solid var(--border-color);border-radius:var(--r-md);padding:1rem;text-align:center}
.rs-icon{font-size:1.5rem;margin-bottom:.35rem}
.rs-val{font-family:'Cairo',sans-serif;font-size:1.55rem;font-weight:800}
.rs-lbl{font-size:.78rem;color:var(--text-muted)}
.rs-card.c-ok .rs-val{color:var(--success)}
.rs-card.c-bad .rs-val{color:var(--danger)}
.rs-card.c-time .rs-val{color:var(--warning)}
.rs-card.c-score .rs-val{color:var(--accent-blue)}
.res-actions{display:flex;justify-content:center;gap:1rem;flex-wrap:wrap}
.btn-retake{background:linear-gradient(135deg,var(--accent-blue),var(--accent-indigo));border:none;color:#fff;
  padding:.95rem 2rem;border-radius:var(--r-md);font-family:var(--font);font-weight:800;font-size:1.02rem;
  cursor:pointer;display:inline-flex;align-items:center;gap:.6rem;box-shadow:0 4px 16px rgba(56,189,248,.3);transition:var(--tr)}
.btn-retake:hover{filter:brightness(1.12);transform:translateY(-2px)}
.btn-home{background:var(--bg-glass);border:1px solid var(--border-color);color:var(--text-primary);
  padding:.95rem 1.75rem;border-radius:var(--r-md);font-family:var(--font);font-weight:700;font-size:.97rem;
  cursor:pointer;display:inline-flex;align-items:center;gap:.5rem;transition:var(--tr)}
.btn-home:hover{background:var(--bg-card-hover)}
/* review */
.review-sec{margin-top:3rem}
.review-hd{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:1rem;margin-bottom:1.5rem}
.review-hd h3{font-family:'Cairo',sans-serif;font-size:1.4rem;font-weight:800}
.review-filters{display:flex;gap:.4rem;background:var(--bg-card);border:1px solid var(--border-color);border-radius:var(--r-sm);padding:.25rem}
.rf-btn{background:none;border:none;color:var(--text-secondary);font-family:var(--font);font-size:.82rem;
  font-weight:600;padding:.38rem .8rem;border-radius:6px;cursor:pointer;transition:var(--tr)}
.rf-btn.on{background:var(--accent-blue);color:#0b0f19;font-weight:700}
.review-list{display:flex;flex-direction:column;gap:1.25rem}
.rev-item{background:var(--bg-card);border:1px solid var(--border-color);border-radius:var(--r-lg);padding:1.5rem;box-shadow:var(--sh-sm)}
.rev-item.ok{border-right:4px solid var(--success)}
.rev-item.bad{border-right:4px solid var(--danger)}
.rev-top{display:flex;align-items:center;justify-content:space-between;margin-bottom:.7rem}
.rev-qnum{font-weight:700;font-size:.85rem;color:var(--text-muted)}
.rev-badge{display:inline-flex;align-items:center;gap:.3rem;font-size:.78rem;font-weight:700;padding:.22rem .65rem;border-radius:9999px}
.rev-badge.b-ok{background:var(--success-bg);color:var(--success);border:1px solid var(--success-border)}
.rev-badge.b-bad{background:var(--danger-bg);color:var(--danger);border:1px solid var(--danger-border)}
.rev-q{font-family:'Cairo',sans-serif;font-size:1.08rem;font-weight:700;margin-bottom:1rem;line-height:1.55}
.rev-ans-row{display:grid;grid-template-columns:1fr;gap:.55rem;margin-bottom:.85rem}
.rev-ans{padding:.6rem .95rem;border-radius:var(--r-sm);font-size:.88rem}
.rev-ans.user{background:var(--bg-glass);border:1px solid var(--border-color)}
.rev-ans.user.wrong{background:var(--danger-bg);border-color:var(--danger-border);color:var(--danger)}
.rev-ans.correct{background:var(--success-bg);border:1px solid var(--success-border);color:var(--success)}
.rev-exp{background:rgba(255,255,255,.025);border-radius:var(--r-sm);padding:.8rem 1rem;
  font-size:.83rem;color:var(--text-secondary);border-top:1px dashed var(--border-color)}
.rev-exp strong{color:var(--accent-blue)}

/* ── FOOTER ───────────────────────────────────── */
.main-footer{margin-top:auto;border-top:1px solid var(--border-color);
  padding:1.75rem 0;text-align:center;color:var(--text-muted);font-size:.83rem}

/* ── ANIMATIONS ───────────────────────────────── */
@keyframes fadeIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
.fade-in{animation:fadeIn .35s ease forwards}
@keyframes pop{0%{transform:scale(.8)}60%{transform:scale(1.06)}100%{transform:scale(1)}}
.pop{animation:pop .4s ease forwards}

/* ── SCROLLBAR ────────────────────────────────── */
::-webkit-scrollbar{width:6px}
::-webkit-scrollbar-track{background:var(--bg-glass)}
::-webkit-scrollbar-thumb{background:var(--border-color);border-radius:9999px}
::-webkit-scrollbar-thumb:hover{background:var(--accent-blue)}

/* ======================================================
   RESPONSIVE — 3 تيراتير رئيسية
   ====================================================== */

/* 📱 هواتف ذكية <= 640px */
@media(max-width:640px){
  .container{padding:0 .9rem}
  .brand-sub{display:none}
  .brand-name{font-size:1rem}
  .hero-title{font-size:1.75rem}
  .hero-desc{font-size:.93rem}
  .qs-item{padding:.5rem .75rem}
  .subjects-grid{grid-template-columns:1fr}
  .subj-card{padding:1.25rem}
  .q-card{padding:1.2rem 1rem;border-radius:var(--r-lg)}
  .q-text{font-size:1.12rem;margin-bottom:1.4rem}
  .opt{padding:.88rem .95rem;font-size:.95rem}
  .opt-mark{width:28px;height:28px;font-size:.78rem}
  .opts.tf-grid{grid-template-columns:1fr}
  .quiz-nav{position:sticky;bottom:0;z-index:20;
    background:rgba(11,15,25,.96);backdrop-filter:blur(14px);
    margin:1rem -1rem -1.2rem;padding:.85rem 1rem;
    border-radius:0 0 var(--r-lg) var(--r-lg);border-top:1px solid var(--border-color)}
  body.light-mode .quiz-nav{background:rgba(255,255,255,.96)}
  .nav-btn{padding:.75rem 1.1rem;font-size:.85rem}
  .gauge-wrap{width:145px;height:145px}
  .score-pct{font-size:2rem}
  .res-title{font-size:1.35rem}
  .res-stats{grid-template-columns:1fr 1fr}
  .rev-ans-row{grid-template-columns:1fr}
}

/* 📱 هواتف كبيرة 480-640 */
@media(min-width:480px) and (max-width:640px){
  .opts.tf-grid{grid-template-columns:1fr 1fr}
}

/* 💻 أجهزة لوحية 641-1024 */
@media(min-width:641px) and (max-width:1024px){
  .hero-title{font-size:2.1rem}
  .subjects-grid{grid-template-columns:repeat(2,1fr)}
  .q-card{padding:2rem}
  .q-text{font-size:1.25rem}
  .res-stats{grid-template-columns:repeat(4,1fr)}
  .rev-ans-row{grid-template-columns:1fr 1fr}
}

/* 🖥️ ديسكتوب كبير >= 1025px */
@media(min-width:1025px){
  .subjects-grid{grid-template-columns:repeat(4,1fr)}
  .quiz-layout{grid-template-columns:1fr 280px}
  .qmap-card{display:block;position:sticky;top:5.5rem}
  .q-card{padding:2.5rem}
  .q-text{font-size:1.4rem}
  .opt{font-size:1.07rem}
  .rev-ans-row{grid-template-columns:1fr 1fr}
}

/* ── Bootstrap Icons — تناسق الحجم ─────────────── */
.bi{display:inline-flex;align-items:center;justify-content:center;vertical-align:middle;font-style:normal}
.brand-icon .bi{font-size:1.5rem;color:#fff}
.icon-btn .bi{font-size:1.1rem}
.subj-icon .bi{font-size:1.85rem}
.mode-icon .bi{font-size:1.35rem}
.qs-icon .bi{font-size:1.3rem}
.start-btn .bi{font-size:1.1rem}
.q-tag .bi{font-size:.95rem}
.opt-mark .bi{font-size:1rem}
.exp-ico .bi{font-size:1.5rem}
.rs-icon .bi{font-size:1.5rem}
.btn-retake .bi,.btn-home .bi{font-size:1.1rem}
.nav-btn .bi{font-size:1rem}
.qmap-title .bi{font-size:1rem}
.timer-chip .bi{font-size:.95rem}
.close-btn .bi{font-size:1.1rem;display:flex}
.hero-badge .bi{font-size:.95rem}
.review-hd h3 .bi{font-size:1.2rem;vertical-align:-.1em}
.rev-badge .bi{font-size:.85rem}
.res-title .bi{font-size:1.4rem;vertical-align:-.1em}
.meta-item .bi{font-size:.9rem}
.best-score-row .bi{font-size:.85rem;opacity:.7}
.modal-actions .btn-ghost .bi,.modal-actions .btn-go .bi{font-size:1rem}
.timer-lbl .bi{font-size:.95rem}
.rev-exp .bi{font-size:.9rem}

/* ── خريطة الأسئلة — legend ─────────────────────── */
.qmap-legend{display:flex;flex-direction:column;gap:.35rem;margin-top:.9rem;font-size:.73rem;color:var(--text-muted)}
.ql-item{display:flex;align-items:center;gap:.45rem}
.ql-item::before{content:'';width:12px;height:12px;border-radius:3px;flex-shrink:0}
.ql-unanswered::before{background:rgba(255,255,255,.06);border:1px solid var(--border-color)}
.ql-answered::before{background:rgba(99,102,241,.25);border:1px solid var(--accent-indigo)}
.ql-right::before{background:var(--success)}
.ql-wrong::before{background:var(--danger)}
body.light-mode .ql-unanswered::before{background:rgba(0,0,0,.06)}

/* ── STATS PAGE ────────────────────────────────── */
.stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.stat-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--r-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  box-shadow: var(--sh-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
}
.kpi-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.icon-blue   { background: rgba(56, 189, 248, 0.12); color: #38bdf8; }
.icon-purple { background: rgba(168, 85, 247, 0.12); color: #c084fc; }
.icon-green  { background: rgba(52, 211, 153, 0.12); color: #34d399; }
.icon-gold   { background: rgba(251, 191, 36, 0.12); color: #fbbf24; }

.kpi-info {
  display: flex;
  flex-direction: column;
}
.kpi-val {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: 'Cairo', sans-serif;
  line-height: 1.2;
}
.kpi-lbl {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stats-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--r-md);
}

.stats-section-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  box-shadow: var(--sh-sm);
}
.sec-subtitle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.85rem;
}
.sec-subtitle h3 {
  font-size: 1.15rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
}
.sec-subtitle h3 .bi {
  color: var(--accent-blue);
}
.sub-count {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.table-responsive {
  overflow-x: auto;
}
.styled-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.92rem;
}
.styled-table th {
  background: var(--bg-glass);
  color: var(--text-muted);
  font-weight: 700;
  padding: 0.85rem 1rem;
  text-align: right;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}
.styled-table td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}
.styled-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}
body.light-mode .styled-table tbody tr:hover td {
  background: rgba(0, 0, 0, 0.02);
}

.text-muted-cell {
  color: var(--text-muted) !important;
  font-size: 0.85rem;
}
.attempts-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
}
.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 0.28rem 0.65rem;
  border-radius: 9999px;
  font-weight: 800;
  font-size: 0.85rem;
}
.badge-exc  { background: rgba(52, 211, 153, 0.18); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.3); }
.badge-good { background: rgba(56, 189, 248, 0.18); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.badge-pass { background: rgba(251, 191, 36, 0.18); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.3); }
.badge-fail { background: rgba(244, 63, 94, 0.18); color: #f43f5e; border: 1px solid rgba(244, 63, 94, 0.3); }

.btn-del-record {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  border-radius: 6px;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-del-record:hover {
  background: rgba(244, 63, 94, 0.12);
  color: var(--danger);
  border-color: rgba(244, 63, 94, 0.25);
}

.empty-stats-card {
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--r-lg);
}
.empty-stats-card .empty-icon {
  font-size: 3.5rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.empty-stats-card h3 {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}
.empty-stats-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.75rem;
}
.btn-primary-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  color: #0b0f19;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.75rem 1.6rem;
  border-radius: var(--r-md);
  text-decoration: none;
  transition: transform 0.2s ease;
}
.btn-primary-action:hover {
  transform: translateY(-2px);
  color: #0b0f19;
}

/* ── Q WARNING ALERT ────────────────────────────── */
.q-warning {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #f43f5e;
  padding: 0.8rem 1.1rem;
  border-radius: var(--r-md);
  margin-top: 1.25rem;
  font-size: 0.94rem;
  font-weight: 700;
  animation: shakeWarning 0.4s ease;
}
.q-warning i {
  font-size: 1.25rem;
  flex-shrink: 0;
}
@keyframes shakeWarning {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
.opts-shake {
  animation: shakeWarning 0.4s ease;
}
.opts-shake .opt:not(.sel) {
  border-color: rgba(244, 63, 94, 0.5) !important;
}

/* ── PRACTICE NOTICE BANNER ────────────────────── */
.practice-notice-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(56, 189, 248, 0.07);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-right: 4px solid var(--accent-blue);
  border-radius: var(--r-md);
  padding: 0.95rem 1.35rem;
  margin: 1.75rem auto 0;
  max-width: 820px;
  text-align: right;
  backdrop-filter: blur(8px);
}
.practice-notice-banner .pnb-icon {
  font-size: 1.75rem;
  color: var(--accent-blue);
  flex-shrink: 0;
  display: flex;
}
.practice-notice-banner .pnb-content {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text-secondary);
}
.practice-notice-banner .pnb-content strong {
  color: var(--text-primary);
  display: block;
  font-size: 0.98rem;
  margin-bottom: 0.2rem;
}
@media (max-width: 640px) {
  .practice-notice-banner {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
    padding: 1rem;
  }
}

/* ======================================================
   AUTHENTICATION & DASHBOARD STYLES
   ====================================================== */

/* ── AUTHENTICATION PAGE ────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
}
.auth-container {
  width: 100%;
  max-width: 480px;
}
.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--r-lg);
  padding: 2.25rem 2rem;
  box-shadow: var(--sh-md);
  backdrop-filter: blur(16px);
}
.auth-header {
  text-align: center;
  margin-bottom: 1.75rem;
}
.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 0.3rem 0.85rem;
  border-radius: 9999px;
  margin-bottom: 0.8rem;
}
.auth-header h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}
.auth-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.auth-tabs {
  display: flex;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--r-md);
  padding: 0.3rem;
  gap: 0.3rem;
  margin-bottom: 1.5rem;
}
.auth-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.65rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: all 0.2s;
}
.auth-tab.active {
  background: var(--accent-blue);
  color: #0b0f19;
  box-shadow: var(--sh-sm);
}

.form-group {
  margin-bottom: 1.25rem;
}
.form-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.45rem;
}
.form-label i {
  color: var(--accent-blue);
}
.form-input {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--bg-glass);
  border: 1.5px solid var(--border-color);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.95rem;
  transition: all 0.2s;
  box-sizing: border-box;
}
.form-input:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}
.form-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.45rem;
}

.input-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-password-wrap .form-input {
  padding-left: 2.75rem;
}
.btn-toggle-pwd {
  position: absolute;
  left: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.15rem;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}
.btn-toggle-pwd:hover {
  color: var(--text-primary);
}

.auth-link-sm {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-blue);
  text-decoration: none;
  transition: opacity 0.2s;
}
.auth-link-sm:hover {
  text-decoration: underline;
}

.btn-auth-submit {
  width: 100%;
  padding: 0.95rem 1.25rem;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  color: #0b0f19;
  border: none;
  border-radius: var(--r-md);
  font-family: var(--font);
  font-size: 1.02rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  box-shadow: var(--sh-md);
  transition: all 0.25s;
  margin-top: 1rem;
}
.btn-auth-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.35);
}
.btn-auth-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.auth-alert {
  padding: 0.85rem 1.1rem;
  border-radius: var(--r-md);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  line-height: 1.45;
  animation: fadeIn 0.3s ease;
}
.alert-error {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #f43f5e;
}
.alert-success {
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: #34d399;
}

/* ── STUDENT DASHBOARD HEADER & PROFILE ─────────────── */
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
}
.user-profile-badge i {
  font-size: 1.3rem;
  color: var(--accent-blue);
}
.user-badge-info {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.user-badge-name {
  font-weight: 800;
  font-size: 0.86rem;
  color: var(--text-primary);
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-badge-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.btn-logout-action {
  color: var(--danger) !important;
  border-color: rgba(244, 63, 94, 0.3) !important;
  padding: 0.45rem 0.9rem !important;
  font-size: 0.85rem !important;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.btn-logout-action:hover {
  background: rgba(244, 63, 94, 0.12) !important;
}

/* ── DASHBOARD HERO ─────────────────────────────────── */
.dash-hero {
  padding: 2.25rem 0 1.5rem;
}
.dash-welcome-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.dash-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--success);
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.28);
  padding: 0.3rem 0.85rem;
  border-radius: 9999px;
  margin-bottom: 0.6rem;
}
.dash-title {
  font-size: 2.15rem;
  font-weight: 900;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}
.dash-desc {
  color: var(--text-secondary);
  font-size: 0.98rem;
  max-width: 620px;
  line-height: 1.6;
}
.dash-student-card-badge {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 1rem 1.25rem;
  border-radius: var(--r-md);
  box-shadow: var(--sh-sm);
}
.dash-student-card-badge i {
  font-size: 1.8rem;
  color: var(--accent-blue);
}

/* ── DASHBOARD KPI GRID ─────────────────────────────── */
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.15rem;
  margin-bottom: 1.5rem;
}
.dash-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--r-lg);
  padding: 1.25rem 1.35rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--sh-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.dash-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
}

/* ── DASHBOARD TWO COLUMNS (HISTORY & LEADERBOARD) ───── */
.dash-two-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
  min-width: 0;
  max-width: 100%;
}
.dash-col-main,
.dash-col-side {
  min-width: 0;
  max-width: 100%;
}
@media (min-width: 960px) {
  .dash-two-cols {
    grid-template-columns: 2fr 1fr;
  }
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  border-radius: var(--r-md);
  transition: background 0.2s;
}
.leaderboard-item:hover {
  background: rgba(255, 255, 255, 0.03);
}
.lb-rank {
  font-size: 1.35rem;
  width: 32px;
  text-align: center;
}
.lb-info {
  flex: 1;
  min-width: 0;
}
.lb-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
}
.lb-score {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--accent-blue);
  font-family: 'Cairo', sans-serif;
}

/* ── DASHBOARD PAGE ZERO-OVERFLOW PROTECTION ─────────── */
body.dashboard-page,
.dashboard-page {
  overflow-x: hidden !important;
  width: 100% !important;
  max-width: 100vw !important;
  position: relative !important;
}

body.dashboard-page .main-header,
body.dashboard-page main,
body.dashboard-page section,
body.dashboard-page .container,
body.dashboard-page .dash-hero,
body.dashboard-page .dash-welcome-row,
body.dashboard-page .dash-kpi-grid,
body.dashboard-page .subjects-grid,
body.dashboard-page .subj-card,
body.dashboard-page .dash-two-cols,
body.dashboard-page .dash-col-main,
body.dashboard-page .dash-col-side,
body.dashboard-page .stats-section-box,
body.dashboard-page .table-responsive {
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* ── COMPREHENSIVE RESPONSIVE ADJUSTMENTS ──────────── */

/* 📱 شاشات الهواتف المحمولة <= 640px */
@media (max-width: 640px) {
  .container {
    padding: 0 0.85rem;
  }
  .header-container {
    padding: 0.55rem 0;
    gap: 0.35rem;
  }
  .brand-logo {
    gap: 0.45rem;
    min-width: 0;
    flex-shrink: 1;
  }
  .brand-icon {
    width: 35px;
    height: 35px;
    font-size: 1.1rem;
    flex-shrink: 0;
  }
  .brand-name {
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brand-sub {
    display: none !important;
  }
  .header-actions {
    gap: 0.3rem;
    flex-shrink: 0;
  }
  .user-profile-badge {
    padding: 0.25rem 0.5rem;
    gap: 0.35rem;
  }
  .user-profile-badge i {
    font-size: 1.15rem;
  }
  .user-badge-role {
    display: none !important;
  }
  .user-badge-name {
    max-width: 65px;
    font-size: 0.78rem;
  }
  .icon-btn {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
  }
  .btn-logout-action {
    padding: 0.35rem 0.55rem !important;
    font-size: 0.82rem !important;
  }
  .auth-card {
    padding: 1.6rem 1.25rem;
  }
  .dash-title {
    font-size: 1.55rem;
  }
  .hide-mobile {
    display: none !important;
  }
  .dash-welcome-row {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    margin-bottom: 1.5rem;
  }
  .dash-student-card-badge {
    width: 100%;
    max-width: 100%;
    padding: 0.85rem 1rem;
    overflow: hidden;
  }
  #dash-card-email {
    word-break: break-all;
    overflow-wrap: break-word;
    font-size: 0.88rem;
  }
  .dash-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.65rem;
  }
  .dash-kpi-card {
    padding: 0.85rem 0.75rem;
    gap: 0.6rem;
    min-width: 0;
  }
  .kpi-icon {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
    border-radius: 10px;
    flex-shrink: 0;
  }
  .kpi-val {
    font-size: 1.25rem;
  }
  .kpi-lbl {
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .stats-section-box {
    padding: 1rem 0.85rem;
    min-width: 0;
    max-width: 100%;
  }
  .table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
  }
  .styled-table {
    min-width: 480px;
  }
}

@media (max-width: 380px) {
  .user-badge-info {
    display: none !important;
  }
  .user-profile-badge {
    padding: 0.35rem 0.45rem;
  }
  .brand-name {
    font-size: 0.85rem;
  }
}

/* 📱 أجهزة لوحية Tablets (641px - 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
  .dash-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dash-title {
    font-size: 1.95rem;
  }
}

/* 🖥️ شاشات الحواسيب الكبيرة PC / Desktop >= 1025px */
@media (min-width: 1025px) {
  .dash-kpi-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ======================================================
   LANDING / INTRODUCTORY PAGE STYLES
   ====================================================== */

.landing-nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  margin-right: 2.5rem;
}
.landing-nav .nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 700;
  transition: color 0.2s;
}
.landing-nav .nav-link:hover {
  color: var(--accent-blue);
}

.landing-hero {
  padding: 4.5rem 0 3rem;
  text-align: center;
  position: relative;
}
.landing-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: var(--accent-blue);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.4rem 1.1rem;
  border-radius: 9999px;
  margin-bottom: 1.5rem;
}
.landing-title {
  font-size: 3.2rem;
  font-weight: 900;
  line-height: 1.25;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}
.landing-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 760px;
  margin: 0 auto 2.25rem;
  line-height: 1.75;
}

.hero-cta-btns {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 3.5rem;
}
.btn-hero-main {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  color: #0b0f19;
  font-weight: 800;
  font-size: 1.05rem;
  padding: 0.95rem 2.25rem;
  border-radius: var(--r-md);
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-hero-main:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(56, 189, 248, 0.45);
  color: #0b0f19;
}
.btn-hero-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  color: var(--text-primary);
  font-weight: 800;
  font-size: 1.05rem;
  padding: 0.95rem 2rem;
  border-radius: var(--r-md);
  text-decoration: none;
  transition: all 0.2s ease;
}
.btn-hero-ghost:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  transform: translateY(-2px);
}

.landing-stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  max-width: 880px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}
.ls-item {
  text-align: center;
}
.ls-val {
  font-size: 2.1rem;
  font-weight: 900;
  color: var(--accent-blue);
  font-family: 'Cairo', sans-serif;
  line-height: 1.2;
}
.ls-lbl {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.landing-section {
  padding: 5rem 0;
}
.sub-pill {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--accent-indigo);
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 0.3rem 0.9rem;
  border-radius: 9999px;
  margin-bottom: 0.75rem;
}
.text-center {
  text-align: center;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--r-lg);
  padding: 2rem;
  box-shadow: var(--sh-sm);
  transition: transform 0.25s ease, border-color 0.25s ease;
}
.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-blue);
}
.feat-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 1.25rem;
}
.feature-card h3 {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 0.6rem;
}
.feature-card p {
  color: var(--text-secondary);
  font-size: 0.94rem;
  line-height: 1.6;
}

.landing-subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}
.l-subj-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--r-lg);
  padding: 1.75rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.l-subj-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: var(--c);
}
.l-subj-card:hover {
  transform: translateY(-3px);
  border-color: var(--c);
}
.l-subj-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--c);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  margin-bottom: 1.2rem;
}
.l-subj-card h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}
.l-subj-card p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.55;
  margin-bottom: 1.2rem;
  min-height: 42px;
}
.l-subj-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 0.85rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.landing-cta-sec {
  padding: 3rem 0 5rem;
}
.cta-box {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.08), rgba(99, 102, 241, 0.08));
  border: 1.5px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--r-lg);
  padding: 3.5rem 2rem;
  text-align: center;
  backdrop-filter: blur(12px);
}
.cta-box h2 {
  font-size: 2.2rem;
  font-weight: 900;
  margin-bottom: 0.8rem;
}
.cta-box p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

/* 📱 Responsive adjustments for Landing */
@media (max-width: 640px) {
  .landing-hero {
    padding: 3rem 0 2rem;
  }
  .landing-title {
    font-size: 2.1rem;
  }
  .landing-subtitle {
    font-size: 0.95rem;
  }
  .landing-stats-bar {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 1.25rem 1rem;
  }
  .features-grid {
    grid-template-columns: 1fr;
  }
  .btn-hero-main, .btn-hero-ghost {
    width: 100%;
    justify-content: center;
  }
  .cta-box {
    padding: 2.25rem 1.25rem;
  }
  .cta-box h2 {
    font-size: 1.65rem;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .landing-title {
    font-size: 2.6rem;
  }
  .landing-stats-bar {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ======================================================
   MOBILE DROPDOWN MENU STYLES
   ====================================================== */

.mobile-menu-toggle {
  display: none;
}
.mobile-dropdown-menu {
  display: block;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  background: rgba(11, 15, 25, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border-color);
}
body.light-mode .mobile-dropdown-menu {
  background: rgba(255, 255, 255, 0.98);
}
.mobile-dropdown-menu.open {
  max-height: 420px;
  opacity: 1;
}
.mobile-menu-inner {
  padding: 0.75rem 1rem 1.25rem;
}
.mobile-menu-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.96rem;
  border-radius: var(--r-md);
  transition: all 0.2s ease;
}
.mobile-nav-link i {
  font-size: 1.25rem;
  color: var(--accent-blue);
  width: 24px;
  display: flex;
  justify-content: center;
}
.mobile-nav-link:hover, .mobile-nav-link:active {
  background: var(--bg-glass);
  color: var(--accent-blue);
}
.mobile-menu-divider {
  border: 0;
  border-top: 1px solid var(--border-color);
  margin: 0.65rem 0;
}
.mobile-menu-btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  color: #0b0f19 !important;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0.85rem 1.25rem;
  border-radius: var(--r-md);
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.3);
  margin-top: 0.4rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mobile-menu-btn-primary:active {
  transform: scale(0.98);
}

@media (max-width: 768px) {
  .landing-nav,
  #auth-header-btn {
    display: none !important;
  }
  .mobile-menu-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }
}

@media (min-width: 769px) {
  .mobile-dropdown-menu {
    display: none !important;
  }
  .mobile-menu-toggle {
    display: none !important;
  }
}

/* ========================================================================
   IN-APP MODAL DIALOGS & TOAST NOTIFICATIONS (بديل تنبيهات المتصفح)
   ======================================================================== */
.app-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(4, 7, 15, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s ease;
  direction: rtl;
}
.app-dialog-overlay.open {
  opacity: 1;
  visibility: visible;
}
.app-dialog-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 480px;
  padding: 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  transform: scale(0.92) translateY(12px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
  position: relative;
  overflow: hidden;
}
body.light-mode .app-dialog-card {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.app-dialog-overlay.open .app-dialog-card {
  transform: scale(1) translateY(0);
}
.app-dialog-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-indigo));
}
.app-dialog-card.is-danger::before {
  background: linear-gradient(90deg, #f43f5e, #f59e0b);
}
.app-dialog-card.is-success::before {
  background: linear-gradient(90deg, #10b981, #06b6d4);
}
.app-dialog-icon-wrap {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  margin: 0 auto 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.3);
}
.app-dialog-card.is-danger .app-dialog-icon-wrap {
  background: rgba(244, 63, 94, 0.12);
  color: var(--danger);
  border-color: rgba(244, 63, 94, 0.35);
}
.app-dialog-card.is-warning .app-dialog-icon-wrap {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.35);
}
.app-dialog-card.is-success .app-dialog-icon-wrap {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.35);
}
.app-dialog-title {
  font-family: 'Cairo', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.65rem;
  line-height: 1.3;
}
.app-dialog-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1.5rem;
  word-break: break-word;
}
.app-dialog-alert-box {
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.25);
  border-radius: var(--r-md);
  padding: 0.85rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
  color: #fb7185;
  text-align: right;
  line-height: 1.6;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}
body.light-mode .app-dialog-alert-box {
  background: rgba(244, 63, 94, 0.08);
  color: #e11d48;
}
.app-dialog-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: center;
}
.app-dialog-btn {
  flex: 1;
  padding: 0.8rem 1.25rem;
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--tr);
  border: none;
  outline: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
}
.app-dialog-btn-cancel {
  background: var(--bg-glass);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.app-dialog-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}
body.light-mode .app-dialog-btn-cancel:hover {
  background: rgba(0, 0, 0, 0.05);
}
.app-dialog-btn-confirm {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  color: #fff;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.3);
}
.app-dialog-btn-confirm:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}
.app-dialog-btn-danger {
  background: linear-gradient(135deg, #f43f5e, #dc2626);
  color: #fff;
  box-shadow: 0 4px 16px rgba(244, 63, 94, 0.35);
}
.app-dialog-btn-danger:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

/* ── TOAST NOTIFICATIONS ───────────────────────── */
.app-toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: none;
  max-width: 420px;
}
@media (max-width: 768px) {
  .app-toast-container {
    left: 1rem;
    right: 1rem;
    max-width: none;
    bottom: 1rem;
  }
}
.app-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.25rem;
  border-radius: var(--r-md);
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 600;
  direction: rtl;
  animation: appToastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
body.light-mode .app-toast {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}
.app-toast.hide {
  opacity: 0;
  transform: translateY(12px) scale(0.95);
}
.app-toast-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}
.app-toast-msg {
  flex: 1;
  line-height: 1.5;
}
.app-toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}
.app-toast-close:hover {
  color: var(--text-primary);
}
.app-toast.toast-success {
  border-right: 4px solid var(--success);
}
.app-toast.toast-success .app-toast-icon {
  color: var(--success);
}
.app-toast.toast-error, .app-toast.toast-danger {
  border-right: 4px solid var(--danger);
}
.app-toast.toast-error .app-toast-icon, .app-toast.toast-danger .app-toast-icon {
  color: var(--danger);
}
.app-toast.toast-warning {
  border-right: 4px solid var(--warning);
}
.app-toast.toast-warning .app-toast-icon {
  color: var(--warning);
}
.app-toast.toast-info {
  border-right: 4px solid var(--accent-blue);
}
.app-toast.toast-info .app-toast-icon {
  color: var(--accent-blue);
}

@keyframes appToastIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ========================================================================
   CYBER SPIDERWEB ANIMATED LOGO (شعار الشبكة العنكبوتية للأمن السيبراني المتحركة)
   ======================================================================== */
.cyber-spider-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: radial-gradient(circle at center, rgba(14, 23, 42, 0.95), rgba(7, 11, 20, 0.98));
  border: 1.5px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.3), inset 0 0 12px rgba(99, 102, 241, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  transition: var(--tr);
}
.cyber-spider-logo:hover {
  border-color: var(--accent-blue);
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.55), inset 0 0 16px rgba(168, 85, 247, 0.35);
  transform: scale(1.05);
}
.cyber-spider-logo .spider-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.cyber-spider-logo .web-ring {
  transition: stroke 0.3s ease;
  transform-origin: 50% 50%;
}
.cyber-spider-logo .ring-3 {
  animation: spiderRingRotate 24s linear infinite;
}
.cyber-spider-logo .ring-2 {
  animation: spiderRingRotateCounter 18s linear infinite;
}
.cyber-spider-logo .ring-1 {
  animation: spiderRingPulse 3s ease-in-out infinite alternate;
}
.cyber-spider-logo .web-strand {
  opacity: 0.7;
}
.cyber-spider-logo .radar-pulse {
  transform-origin: 50% 50%;
  animation: spiderRadarScan 2.6s cubic-bezier(0.1, 0.5, 0.3, 1) infinite;
}
.cyber-spider-logo .cyber-node {
  animation: spiderNodePulse 2s ease-in-out infinite alternate;
}
.cyber-spider-logo .node-n { animation-delay: 0s; }
.cyber-spider-logo .node-ne { animation-delay: 0.3s; }
.cyber-spider-logo .node-e { animation-delay: 0.6s; }
.cyber-spider-logo .node-se { animation-delay: 0.9s; }
.cyber-spider-logo .node-s { animation-delay: 1.2s; }
.cyber-spider-logo .node-sw { animation-delay: 1.5s; }
.cyber-spider-logo .node-w { animation-delay: 1.8s; }
.cyber-spider-logo .node-nw { animation-delay: 2.1s; }

.cyber-spider-logo .spider-core {
  transform-origin: 50% 50%;
  animation: spiderCoreGlow 2.4s ease-in-out infinite alternate;
}
.cyber-spider-logo .core-spark {
  animation: spiderSparkBlink 1.2s infinite;
}

@keyframes spiderRingRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes spiderRingRotateCounter {
  from { transform: rotate(360deg); }
  to { transform: rotate(0deg); }
}
@keyframes spiderRingPulse {
  0% { transform: scale(0.92); opacity: 0.6; }
  100% { transform: scale(1.08); opacity: 1; stroke: #38bdf8; }
}
@keyframes spiderRadarScan {
  0% { transform: scale(0.1); opacity: 1; }
  100% { transform: scale(1.15); opacity: 0; }
}
@keyframes spiderNodePulse {
  0% { transform: scale(0.8); opacity: 0.5; }
  100% { transform: scale(1.4); opacity: 1; filter: drop-shadow(0 0 6px #38bdf8); }
}
@keyframes spiderCoreGlow {
  0% { transform: scale(0.95); opacity: 0.85; filter: drop-shadow(0 0 2px #38bdf8); }
  100% { transform: scale(1.08); opacity: 1; filter: drop-shadow(0 0 10px #818cf8); }
}
@keyframes spiderSparkBlink {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ========================================================================
   ADMIN PORTAL & DASHBOARD STYLES (لوحة تحكم وبوابة الإدارة)
   ======================================================================== */
.admin-badge-owner {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.15), rgba(245, 158, 11, 0.15));
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fb7185;
  font-weight: 800;
  font-size: 0.78rem;
}
.admin-badge-mod {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--accent-blue);
  font-weight: 800;
  font-size: 0.78rem;
}

/* ── ENTERPRISE CORPORATE ADMIN DASHBOARD ────────────────── */
.admin-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font);
}

.admin-topbar-enterprise {
  position: sticky;
  top: 0;
  z-index: 10010;
  height: 68px;
  background: rgba(11, 15, 25, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  transition: var(--tr);
}
body.light-mode .admin-topbar-enterprise {
  background: rgba(255, 255, 255, 0.94);
  border-bottom-color: #e2e8f0;
}

.admin-topbar-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.admin-topbar-brand-text {
  display: flex;
  flex-direction: column;
}
.admin-brand-title {
  font-family: 'Cairo', var(--font);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}
.admin-brand-tag {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-blue);
  letter-spacing: 0.2px;
}
.admin-badge-enterprise {
  font-size: 0.65rem;
  font-weight: 800;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.admin-topbar-center {
  display: flex;
  align-items: center;
  gap: 1rem;
}
@media (max-width: 992px) {
  .admin-topbar-center {
    display: none;
  }
}
.admin-search-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--r-md);
  padding: 0.45rem 1rem;
  width: 280px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  transition: var(--tr);
}
.admin-search-box:focus-within {
  border-color: var(--accent-blue);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}
.admin-search-box input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  width: 100%;
}
.admin-search-shortcut {
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  color: var(--text-muted);
}

.admin-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-server-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-size: 0.78rem;
  font-weight: 700;
  color: #34d399;
}
@media (max-width: 640px) {
  .admin-server-status {
    display: none;
  }
}

.admin-profile-pill {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  padding: 0.3rem 0.85rem 0.3rem 0.4rem;
  transition: var(--tr);
}
.admin-profile-pill:hover {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(255, 255, 255, 0.06);
}
.admin-avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #6366f1);
  color: #fff;
  font-weight: 900;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
  position: relative;
}
.admin-avatar-status {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #0b0f19;
}

.admin-layout-enterprise {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 68px);
}

.admin-sidebar-enterprise {
  width: 275px;
  flex-shrink: 0;
  background: rgba(13, 18, 32, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.5rem 0.85rem 1.25rem;
  position: sticky;
  top: 68px;
  height: calc(100vh - 68px);
  overflow-y: auto;
  transition: var(--tr);
  z-index: 900;
}
body.light-mode .admin-sidebar-enterprise {
  background: #ffffff;
  border-left-color: #e2e8f0;
}

@media (max-width: 992px) {
  .admin-sidebar-enterprise {
    position: fixed;
    top: 68px;
    right: -285px;
    bottom: 0;
    height: auto;
    box-shadow: -15px 0 35px rgba(0, 0, 0, 0.5);
  }
  .admin-sidebar-enterprise.open {
    right: 0;
  }
  .admin-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 890;
  }
  .admin-sidebar-backdrop.active {
    display: block;
  }
}

.admin-nav-group-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  padding: 0 0.85rem;
  margin: 1.25rem 0 0.45rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-nav-group-title:first-child {
  margin-top: 0;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.95rem;
  border-radius: 12px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: right;
  width: 100%;
  margin-bottom: 0.25rem;
}
.admin-nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}
body.light-mode .admin-nav-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.admin-nav-item.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(99, 102, 241, 0.12));
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent-blue);
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.08);
}
body.light-mode .admin-nav-item.active {
  background: #e0f2fe;
  border-color: #38bdf8;
  color: #0284c7;
}
.admin-nav-item i {
  font-size: 1.15rem;
  width: 22px;
  text-align: center;
}
.admin-nav-item .badge-pill {
  margin-right: auto;
  font-size: 0.72rem;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
}
.admin-nav-item.active .badge-pill {
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent-blue);
  font-weight: 800;
}

.admin-sidebar-footer-card {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  font-size: 0.78rem;
  color: var(--text-muted);
}
body.light-mode .admin-sidebar-footer-card {
  background: #f8fafc;
  border-color: #e2e8f0;
}
.admin-sidebar-footer-card .telemetry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}
.admin-sidebar-footer-card .telemetry-row:last-child {
  margin-bottom: 0;
}

.admin-workspace {
  flex: 1;
  min-width: 0;
  padding: 2rem 2.5rem 4rem;
  overflow-y: auto;
}
@media (max-width: 768px) {
  .admin-workspace {
    padding: 1.25rem 1rem 3rem;
  }
}

.admin-pane {
  display: none;
  animation: fadeIn 0.25s ease forwards;
}
.admin-pane.active {
  display: block;
}

.admin-breadcrumb-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.admin-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.admin-breadcrumbs a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}
.admin-breadcrumbs a:hover {
  color: var(--accent-blue);
}
.admin-breadcrumbs .separator {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.admin-breadcrumbs .current {
  color: var(--text-primary);
  font-weight: 800;
}

.admin-exec-header {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.85));
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 1.75rem 2rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.4);
}
body.light-mode .admin-exec-header {
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  border-color: #e2e8f0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}
.admin-exec-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #38bdf8, #818cf8, #f43f5e);
}
.admin-exec-title {
  font-family: 'Cairo', var(--font);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}
.admin-exec-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0;
}
.admin-exec-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* ── CORPORATE KPI CARDS ─────────────────────────────────── */
.enterprise-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.enterprise-kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 1.4rem 1.5rem;
  box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}
body.light-mode .enterprise-kpi-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
}
.enterprise-kpi-card:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 12px 30px -6px rgba(0, 0, 0, 0.4), 0 0 20px rgba(56, 189, 248, 0.1);
}
.enterprise-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.enterprise-kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}
.enterprise-kpi-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.enterprise-kpi-val {
  font-family: 'Cairo', var(--font);
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 0.4rem;
}
.enterprise-kpi-lbl {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
}
.enterprise-kpi-footer {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── CORPORATE DATA TABLE CONTAINER ──────────────────────── */
.enterprise-data-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 30px -6px rgba(0, 0, 0, 0.3);
  margin-bottom: 2rem;
}
body.light-mode .enterprise-data-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}
.enterprise-data-toolbar {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.015);
}
body.light-mode .enterprise-data-toolbar {
  background: #f8fafc;
  border-bottom-color: #e2e8f0;
}

.enterprise-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: right;
}
.enterprise-data-table th {
  padding: 0.9rem 1.25rem;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}
body.light-mode .enterprise-data-table th {
  background: #f1f5f9;
  color: #64748b;
  border-bottom-color: #e2e8f0;
}
.enterprise-data-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  vertical-align: middle;
  transition: background 0.15s;
}
body.light-mode .enterprise-data-table td {
  border-bottom-color: #f1f5f9;
}
.enterprise-data-table tbody tr:hover td {
  background: rgba(56, 189, 248, 0.04);
}
body.light-mode .enterprise-data-table tbody tr:hover td {
  background: #f0f9ff;
}

/* Action Buttons in Corporate Tables */
.admin-table-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.admin-table-btn {
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: inherit;
  border: 1px solid var(--border-color);
  background: var(--bg-glass);
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--tr);
}
.admin-table-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}
.admin-table-btn.btn-danger {
  color: var(--danger);
  border-color: rgba(244, 63, 94, 0.35);
  background: rgba(244, 63, 94, 0.08);
}
.admin-table-btn.btn-danger:hover {
  background: rgba(244, 63, 94, 0.2);
  border-color: var(--danger);
}
.admin-table-btn.btn-warning {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.08);
}
.admin-table-btn.btn-warning:hover {
  background: rgba(251, 191, 36, 0.2);
}


.permission-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--r-md);
  padding: 1rem;
}
.permission-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}
.permission-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-blue);
  cursor: pointer;
}

/* ========================================================================
   ADMIN MOBILE HEADER DROPDOWN & COMPREHENSIVE RESPONSIVENESS
   ======================================================================== */
.admin-mobile-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  border-radius: 9999px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: var(--accent-blue);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.25s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  touch-action: manipulation;
  pointer-events: auto;
  position: relative;
  z-index: 10012;
}
body.light-mode .admin-mobile-nav-toggle {
  background: #f0f9ff;
  border-color: #38bdf8;
  color: #0284c7;
}
.admin-mobile-nav-toggle:hover,
.admin-mobile-nav-toggle.expanded {
  background: rgba(56, 189, 248, 0.22);
  border-color: var(--accent-blue);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.3);
}
.mobile-pill-icon {
  font-size: 1rem;
}
.mobile-pill-text {
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mobile-pill-chevron {
  font-size: 0.75rem;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dropdown Menu Container (Fixed below sticky topbar) */
.admin-mobile-header-dropdown {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  background: rgba(11, 15, 25, 0.98);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75);
  z-index: 10005;
  max-height: calc(100vh - 64px);
  max-height: calc(100dvh - 64px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: none;
  animation: mobileDropdownSlide 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
body.light-mode .admin-mobile-header-dropdown {
  background: rgba(255, 255, 255, 0.98);
  border-bottom-color: #e2e8f0;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
}
.admin-mobile-header-dropdown.open {
  display: block;
}

@keyframes mobileDropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.admin-mobile-dropdown-inner {
  padding: 1.25rem 1rem 2rem;
  max-width: 600px;
  margin: 0 auto;
}

/* User Card in Dropdown */
.admin-mobile-profile-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
}
body.light-mode .admin-mobile-profile-card {
  background: #f8fafc;
  border-color: #e2e8f0;
}
.admin-mobile-profile-info {
  flex: 1;
  min-width: 0;
}
.admin-mobile-profile-info .mobile-name {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.2rem;
}

/* Section Title */
.admin-mobile-nav-group-title {
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 1.1rem 0 0.5rem 0;
  padding: 0 0.5rem;
}

/* Navigation Items in Dropdown */
.admin-mobile-nav-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.admin-mobile-menu-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: inherit;
  text-align: right;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
body.light-mode .admin-mobile-menu-item {
  background: #ffffff;
  border-color: #e2e8f0;
}
.admin-mobile-menu-item:hover,
.admin-mobile-menu-item:active {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.3);
  transform: translateX(-3px);
}
.admin-mobile-menu-item.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.16), rgba(99, 102, 241, 0.14));
  border-color: var(--accent-blue);
  box-shadow: 0 4px 18px rgba(56, 189, 248, 0.12);
}
body.light-mode .admin-mobile-menu-item.active {
  background: #e0f2fe;
  border-color: #38bdf8;
  color: #0284c7;
}

.mobile-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.mobile-item-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.mobile-item-title {
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text-primary);
}
.mobile-item-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mobile-item-arrow {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}
.admin-mobile-menu-item:hover .mobile-item-arrow {
  transform: translateX(-3px);
  color: var(--accent-blue);
}

/* Quick Actions in Mobile Dropdown */
.admin-mobile-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
}
.mobile-quick-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border-radius: 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: var(--tr);
}
.mobile-quick-btn:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}
.mobile-quick-logout {
  color: var(--danger);
  border-color: rgba(244, 63, 94, 0.3);
  background: rgba(244, 63, 94, 0.08);
}
.mobile-quick-logout:hover {
  background: rgba(244, 63, 94, 0.18);
  border-color: var(--danger);
}

/* Mobile Dropdown Backdrop */
.admin-mobile-dropdown-backdrop {
  position: fixed;
  inset: 0;
  top: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10000;
  display: none;
}
.admin-mobile-dropdown-backdrop.active {
  display: block;
}

/* Lock body scroll when dropdown active */
body.admin-dropdown-active {
  overflow: hidden;
}

/* Admin Overlays & Modals High Stacking & Premium Solid Background */
body.admin-shell .overlay {
  z-index: 20000 !important;
  background: rgba(3, 7, 18, 0.85) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
}
body.admin-shell .modal {
  background: #0d1527 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 35px 80px -10px rgba(0, 0, 0, 0.88) !important;
}
body.admin-shell.light-mode .modal,
body.light-mode.admin-shell .modal {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 30px 60px -10px rgba(0, 0, 0, 0.18) !important;
}

/* High-Legibility, Spacious Inputs & Textareas in Admin Modals */
body.admin-shell .modal .admin-auth-input,
body.admin-shell .modal select.admin-auth-input,
body.admin-shell .modal textarea.admin-auth-input,
body.admin-shell .modal .admin-form-input,
body.admin-shell .modal select.admin-form-input,
body.admin-shell .modal textarea.admin-form-textarea {
  font-size: 1.05rem !important;
  line-height: 1.65 !important;
  color: #f8fafc !important;
  background: rgba(15, 23, 42, 0.9) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: 12px !important;
  padding: 0.85rem 1.15rem !important;
  min-height: 52px !important;
  box-sizing: border-box !important;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
  width: 100% !important;
  font-family: inherit !important;
}

body.admin-shell.light-mode .modal .admin-auth-input,
body.light-mode.admin-shell .modal .admin-auth-input,
body.admin-shell.light-mode .modal select.admin-auth-input,
body.light-mode.admin-shell .modal select.admin-auth-input,
body.admin-shell.light-mode .modal textarea.admin-auth-input,
body.light-mode.admin-shell .modal textarea.admin-auth-input,
body.admin-shell.light-mode .modal .admin-form-input,
body.light-mode.admin-shell .modal .admin-form-input,
body.admin-shell.light-mode .modal select.admin-form-input,
body.light-mode.admin-shell .modal select.admin-form-input,
body.admin-shell.light-mode .modal textarea.admin-form-textarea,
body.light-mode.admin-shell .modal textarea.admin-form-textarea {
  color: #0f172a !important;
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
}

body.admin-shell .modal .admin-auth-input:focus,
body.admin-shell .modal select.admin-auth-input:focus,
body.admin-shell .modal textarea.admin-auth-input:focus,
body.admin-shell .modal .admin-form-input:focus,
body.admin-shell .modal select.admin-form-input:focus,
body.admin-shell .modal textarea.admin-form-textarea:focus {
  border-color: #38bdf8 !important;
  background: rgba(15, 23, 42, 0.98) !important;
  box-shadow: 0 0 0 3.5px rgba(56, 189, 248, 0.25) !important;
  outline: none !important;
}

body.admin-shell.light-mode .modal .admin-auth-input:focus,
body.light-mode.admin-shell .modal .admin-auth-input:focus,
body.admin-shell.light-mode .modal select.admin-auth-input:focus,
body.light-mode.admin-shell .modal select.admin-auth-input:focus,
body.admin-shell.light-mode .modal textarea.admin-auth-input:focus,
body.light-mode.admin-shell .modal textarea.admin-auth-input:focus,
body.admin-shell.light-mode .modal .admin-form-input:focus,
body.light-mode.admin-shell .modal .admin-form-input:focus,
body.admin-shell.light-mode .modal select.admin-form-input:focus,
body.light-mode.admin-shell .modal select.admin-form-input:focus,
body.admin-shell.light-mode .modal textarea.admin-form-textarea:focus,
body.light-mode.admin-shell .modal textarea.admin-form-textarea:focus {
  background: #ffffff !important;
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3.5px rgba(2, 132, 199, 0.2) !important;
}

body.admin-shell .modal textarea.admin-auth-input,
body.admin-shell .modal textarea.admin-form-textarea {
  min-height: 125px !important;
  line-height: 1.75 !important;
  resize: vertical !important;
  white-space: pre-wrap !important;
  word-break: break-word !important;
}

body.admin-shell .modal .admin-form-label {
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  font-size: 0.96rem !important;
  font-weight: 700 !important;
  color: #e2e8f0 !important;
  margin-bottom: 0.55rem !important;
}
body.admin-shell.light-mode .modal .admin-form-label,
body.light-mode.admin-shell .modal .admin-form-label {
  color: #1e293b !important;
}

/* Desktop: hide mobile elements completely */
@media (min-width: 993px) {
  .admin-mobile-nav-toggle,
  .admin-mobile-header-dropdown,
  .admin-mobile-dropdown-backdrop {
    display: none !important;
  }
}

/* ========================================================================
   RESPONSIVE ENHANCEMENTS ACROSS ALL DEVICES (PHONES, TABLETS, DESKTOPS)
   ======================================================================== */
@media (max-width: 992px) {
  .admin-topbar-enterprise {
    padding: 0 1rem;
    height: 64px;
  }
  .admin-topbar-brand {
    gap: 0.65rem;
  }
  .admin-brand-title {
    font-size: 0.95rem;
  }
  .admin-mobile-nav-toggle {
    display: inline-flex !important;
  }
  .admin-sidebar-enterprise {
    display: none !important;
  }
  .admin-workspace {
    padding: 1.25rem 0.85rem 3.5rem !important;
    width: 100% !important;
    min-width: 100% !important;
  }
  .hide-mobile {
    display: none !important;
  }
  .admin-topbar-actions {
    gap: 0.4rem;
  }
  .admin-topbar-actions .icon-btn {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }
  .admin-exec-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.25rem 1rem;
    gap: 1rem;
  }
  .admin-exec-title {
    font-size: 1.25rem;
  }
  .admin-exec-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .admin-exec-actions .btn-primary-action {
    width: 100%;
    justify-content: center;
  }
  .enterprise-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
  }
}

@media (max-width: 640px) {
  .admin-topbar-enterprise {
    padding: 0 0.65rem;
    height: 60px;
  }
  .admin-mobile-header-dropdown {
    top: 60px;
    max-height: calc(100vh - 60px);
    max-height: calc(100dvh - 60px);
  }
  .admin-brand-tag {
    display: none;
  }
  .mobile-pill-text {
    max-width: 105px;
    font-size: 0.8rem;
  }
  .admin-mobile-nav-toggle {
    padding: 0.35rem 0.65rem;
  }
  .enterprise-kpi-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .enterprise-kpi-card {
    padding: 1.1rem;
  }
  .enterprise-kpi-val {
    font-size: 1.8rem;
  }
  .enterprise-data-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    gap: 0.75rem;
  }
  .enterprise-data-toolbar select,
  .enterprise-data-toolbar input {
    width: 100% !important;
    font-size: 16px !important; /* Prevents auto-zoom in Safari iOS */
  }
  .enterprise-data-toolbar button {
    width: 100% !important;
    justify-content: center;
  }
  .admin-modal-card,
  .modal-card {
    width: 95vw !important;
    max-height: 88vh;
    padding: 1.25rem !important;
  }
  .admin-modal-footer,
  .modal-actions {
    flex-direction: column-reverse;
    gap: 0.5rem;
  }
  .admin-modal-footer button,
  .modal-actions button {
    width: 100% !important;
  }
}

/* Horizontal Table Scrolling on Small Screens */
.admin-table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r-md);
  margin-bottom: 0.5rem;
}
.enterprise-data-table {
  min-width: 650px;
}

/* Touch targets guarantee >= 44px on mobile devices */
@media (max-width: 768px) {
  button, 
  .btn-primary-action, 
  .admin-table-btn, 
  .icon-btn,
  .nav-link,
  .mobile-nav-link,
  .opt-btn {
    min-height: 44px;
  }
  input, select, textarea {
    min-height: 44px;
  }
}

/* ── ADMIN AUTHENTICATION PORTAL (CYBER MODERN) ───────────── */
.admin-auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #060a14;
  background-image: 
    radial-gradient(circle at 50% 12%, rgba(56, 189, 248, 0.16) 0%, transparent 55%),
    radial-gradient(circle at 85% 85%, rgba(99, 102, 241, 0.12) 0%, transparent 45%),
    linear-gradient(rgba(56, 189, 248, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.04) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 36px 36px, 36px 36px;
  position: relative;
  overflow-x: hidden;
}

body.light-mode.admin-auth-page {
  background-color: #f1f5f9;
  background-image: 
    radial-gradient(circle at 50% 12%, rgba(14, 165, 233, 0.12) 0%, transparent 55%),
    radial-gradient(circle at 85% 85%, rgba(99, 102, 241, 0.08) 0%, transparent 45%),
    linear-gradient(rgba(14, 165, 233, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14, 165, 233, 0.05) 1px, transparent 1px);
}

.admin-auth-topbar {
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 10;
}
@media (max-width: 640px) {
  .admin-auth-topbar {
    padding: 1rem 1.25rem;
  }
}

.admin-auth-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  transition: var(--tr);
}
.admin-auth-back:hover {
  color: var(--accent-blue);
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.1);
  transform: translateX(3px);
}

.admin-auth-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-auth-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}
.pulse-dot-green {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: pulseGreen 2s infinite ease-in-out;
}
@keyframes pulseGreen {
  0%, 100% { transform: scale(0.9); opacity: 0.8; box-shadow: 0 0 4px #10b981; }
  50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 12px #10b981; }
}

.admin-auth-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem 3rem;
  position: relative;
  z-index: 5;
}

.admin-auth-container {
  width: 100%;
  max-width: 470px;
  margin: 0 auto;
}

.admin-auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.admin-logo-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.1rem;
  position: relative;
}
.admin-logo-wrapper::after {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 30px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.22) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

.admin-auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.32);
  padding: 0.35rem 0.95rem;
  border-radius: 9999px;
  margin-bottom: 0.85rem;
  letter-spacing: 0.3px;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.15);
}

.admin-auth-title {
  font-family: 'Cairo', var(--font);
  font-size: 1.85rem;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 0.45rem;
  letter-spacing: -0.3px;
  line-height: 1.3;
}

.admin-auth-subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

.admin-auth-card {
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 24px;
  padding: 2.25rem 2rem;
  box-shadow: 
    0 25px 60px -15px rgba(0, 0, 0, 0.75),
    0 0 30px rgba(56, 189, 248, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
  transition: var(--tr);
}
body.light-mode .admin-auth-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(14, 165, 233, 0.28);
  box-shadow: 
    0 25px 60px -15px rgba(15, 23, 42, 0.12),
    0 0 25px rgba(14, 165, 233, 0.1);
}

.admin-auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple), #f43f5e, var(--accent-blue));
  background-size: 300% 100%;
  animation: cyberBeam 6s linear infinite;
}
@keyframes cyberBeam {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.admin-form-group {
  margin-bottom: 1.4rem;
}

.admin-form-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.admin-form-label i {
  color: var(--accent-blue);
  font-size: 1rem;
}

.admin-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.admin-auth-input,
.auth-input {
  width: 100%;
  padding: 0.9rem 1.1rem;
  background: rgba(11, 15, 25, 0.7);
  border: 1.5px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.25s ease;
  box-sizing: border-box;
}
body.light-mode .admin-auth-input,
body.light-mode .auth-input {
  background: #f8fafc;
  border-color: rgba(14, 165, 233, 0.3);
}

.admin-auth-input:focus,
.auth-input:focus {
  outline: none;
  border-color: var(--accent-blue);
  background: rgba(17, 24, 39, 0.95);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.16), 0 0 20px rgba(56, 189, 248, 0.2);
}
body.light-mode .admin-auth-input:focus,
body.light-mode .auth-input:focus {
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.15), 0 0 15px rgba(14, 165, 233, 0.15);
}

.admin-pwd-toggle {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  transition: color 0.2s;
}
.admin-pwd-toggle:hover {
  color: var(--accent-blue);
}

.admin-submit-btn,
.admin-auth-card .btn-primary-action {
  width: 100%;
  padding: 0.95rem 1.25rem;
  background: linear-gradient(135deg, #0284c7, #38bdf8 55%, #6366f1);
  background-size: 200% 200%;
  color: #ffffff;
  border: none;
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  box-shadow: 0 8px 25px -4px rgba(2, 132, 199, 0.5), 0 0 15px rgba(56, 189, 248, 0.3);
  transition: all 0.3s ease;
  margin-top: 0.5rem;
}
.admin-submit-btn:hover,
.btn-primary-action:hover {
  background-position: right center;
  transform: translateY(-2px);
  box-shadow: 0 12px 30px -4px rgba(2, 132, 199, 0.65), 0 0 25px rgba(56, 189, 248, 0.45);
}
.admin-submit-btn:active,
.btn-primary-action:active {
  transform: translateY(0);
}
.admin-submit-btn:disabled,
.btn-primary-action:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.admin-alert-box {
  display: none;
  align-items: flex-start;
  gap: 0.75rem;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.35);
  border-radius: var(--r-md);
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.4rem;
  font-size: 0.88rem;
  color: #fb7185;
  line-height: 1.5;
  animation: fadeIn 0.3s ease;
}

.admin-security-note {
  margin-top: 1.75rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.admin-security-note i {
  font-size: 1.2rem;
  color: var(--accent-blue);
  flex-shrink: 0;
}

.admin-auth-footer {
  margin-top: 2rem;
  text-align: center;
}

@media (max-width: 480px) {
  .admin-auth-card {
    padding: 1.75rem 1.25rem;
    border-radius: 20px;
  }
  .admin-auth-title {
    font-size: 1.5rem;
  }
}

/* ========================================================================
   GLOBAL CROSS-BROWSER & MULTI-DEVICE RESPONSIVE SYSTEM
   (Mobiles 320px-480px, Tablets 481px-1024px, Laptops 1025px-1440px, Desktops >1440px)
   ======================================================================== */

/* 1. Safe Area Insets & Smooth Scrolling */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
  min-width: 320px;
  padding-bottom: env(safe-area-inset-bottom);
}

/* 2. Responsive Grids in Forms & Modals */
@media (max-width: 640px) {
  form div[style*="grid-template-columns:1fr 1fr"],
  form div[style*="grid-template-columns: 1fr 1fr"],
  form .admin-modal-grid-2 {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  .modal,
  .admin-modal-card {
    width: calc(100vw - 1.5rem) !important;
    max-width: 500px !important;
    margin: 1rem auto !important;
    padding: 1.25rem !important;
    border-radius: 18px !important;
  }
}

/* 3. Universal Table Responsive Container */
.table-responsive,
.admin-table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 0.5rem;
  position: relative;
}

/* Modern sleek custom scrollbar for tables */
.table-responsive::-webkit-scrollbar,
.admin-table-responsive::-webkit-scrollbar {
  height: 6px;
}
.table-responsive::-webkit-scrollbar-track,
.admin-table-responsive::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb,
.admin-table-responsive::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.25);
  border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb:hover,
.admin-table-responsive::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.5);
}

/* 4. Quiz Interface Mobile Optimization */
@media (max-width: 768px) {
  .quiz-topbar {
    padding: 0.65rem 0.85rem !important;
  }
  .quiz-topbar .qbar-brand {
    font-size: 0.9rem !important;
  }
  .quiz-card {
    padding: 1.25rem 1rem !important;
    border-radius: 16px !important;
  }
  .q-text {
    font-size: 1.05rem !important;
    line-height: 1.6 !important;
  }
  .opts-list {
    gap: 0.65rem !important;
  }
  .opt-btn {
    padding: 0.85rem 1rem !important;
    font-size: 0.92rem !important;
    min-height: 48px !important;
  }
  .quiz-footer {
    padding: 0.85rem 1rem !important;
    flex-direction: row;
    justify-content: space-between;
  }
  .quiz-footer button {
    padding: 0.65rem 1.15rem !important;
    min-height: 44px;
  }
}

/* 5. Results Page Mobile Optimization */
@media (max-width: 768px) {
  .res-gauge-wrap {
    margin: 1.5rem auto !important;
    transform: scale(0.9);
  }
  .res-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }
  .res-actions {
    flex-direction: column !important;
    width: 100% !important;
  }
  .res-actions button,
  .res-actions a {
    width: 100% !important;
    justify-content: center !important;
  }
  .review-item {
    padding: 1rem !important;
    border-radius: 14px !important;
  }
}

/* 6. Student Dashboard Mobile Optimization */
@media (max-width: 768px) {
  .dash-hero-banner {
    padding: 1.5rem 1.15rem !important;
    border-radius: 18px !important;
  }
  .dash-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }
  .subj-grid {
    grid-template-columns: 1fr !important;
  }
  .user-badge-info {
    display: none;
  }
}

/* 7. Homepage & Landing Mobile Optimization */
@media (max-width: 768px) {
  .landing-hero {
    padding: 3rem 1rem 2rem !important;
    text-align: center;
  }
  .landing-title {
    font-size: clamp(1.6rem, 6vw, 2.2rem) !important;
    line-height: 1.3 !important;
  }
  .landing-subtitle {
    font-size: 0.95rem !important;
  }
  .hero-cta-group {
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.75rem !important;
  }
  .hero-cta-group a,
  .hero-cta-group button {
    width: 100% !important;
    justify-content: center !important;
  }
  .features-grid {
    grid-template-columns: 1fr !important;
  }
  .stats-strip {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem !important;
    padding: 1.25rem !important;
  }
  .footer-corporate {
    padding: 2.5rem 1rem 1.5rem !important;
  }
  .footer-corporate-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
}

/* 8. Touch Screen Comfort (Mobile First) */
@media (hover: none) and (pointer: coarse) {
  .opt-btn:hover {
    transform: none !important;
  }
  .admin-table-btn:hover {
    transform: none !important;
  }
  .enterprise-kpi-card:hover {
    transform: none !important;
  }
}

/* ── CURRICULUM MATERIALS & PDF SYSTEM (STUDENT & ADMIN) ── */
.materials-tabs-wrapper {
  position: relative;
  width: 100%;
  margin-bottom: 1.5rem;
}
.materials-filter-tabs {
  display: flex;
  align-items: center;
  gap: .65rem;
  overflow-x: auto;
  flex-wrap: nowrap;
  padding: .35rem .25rem .75rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.3) transparent;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}
.materials-filter-tabs::-webkit-scrollbar {
  height: 4px;
}
.materials-filter-tabs::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.25);
  border-radius: 9999px;
}
.mat-filter-btn {
  padding: .55rem 1.25rem;
  border-radius: 9999px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--tr);
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.mat-filter-btn:hover {
  border-color: var(--accent-blue);
  color: var(--text-primary);
  transform: translateY(-2px);
}
.mat-filter-btn.active {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(56,189,248,.3);
}

.materials-carousel-wrapper {
  position: relative;
  width: 100%;
}
.materials-grid {
  display: flex;
  overflow-x: auto;
  gap: 1.5rem;
  padding: 0.5rem 0.25rem 1.35rem;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(239, 68, 68, 0.35) transparent;
}
.materials-grid::-webkit-scrollbar {
  height: 6px;
}
.materials-grid::-webkit-scrollbar-thumb {
  background: rgba(239, 68, 68, 0.35);
  border-radius: 9999px;
}
.materials-grid .mat-card {
  flex: 0 0 350px;
  max-width: 370px;
  scroll-snap-align: start;
}
@media (max-width: 640px) {
  .materials-grid .mat-card {
    flex: 0 0 300px;
    max-width: 310px;
  }
}

.mat-scroll-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  cursor: pointer;
  transition: var(--tr);
  box-shadow: var(--sh-sm);
}
.mat-scroll-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  transform: translateY(-2px);
}
.mat-card {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--r-xl);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: var(--tr);
  overflow: hidden;
  box-shadow: var(--sh-sm);
}
.mat-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--m-color, #ef4444), transparent);
  opacity: .9;
}
.mat-card:hover {
  transform: translateY(-6px);
  border-color: var(--m-color, #ef4444);
  box-shadow: var(--sh-lg), 0 0 25px rgba(239, 68, 68, 0.12);
}
.mat-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1rem;
}
.mat-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}
.mat-badge-subj {
  font-size: .75rem;
  font-weight: 800;
  padding: .25rem .7rem;
  border-radius: 9999px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.mat-card-title {
  font-family: 'Cairo', sans-serif;
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.4;
  margin-bottom: .45rem;
  color: var(--text-primary);
}
.mat-card-desc {
  font-size: .86rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 1.25rem;
  flex-grow: 1;
}
.mat-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .8rem;
  color: var(--text-muted);
  padding: .65rem 0;
  border-top: 1px solid var(--border-color);
  margin-bottom: 1.1rem;
}
.mat-meta-item {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.mat-card-actions {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: .65rem;
}
.mat-view-btn {
  padding: .75rem 1rem;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  color: #fff;
  border: none;
  font-family: var(--font);
  font-size: .9rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  transition: var(--tr);
}
.mat-view-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(56,189,248,.35);
}
.mat-download-btn {
  padding: .75rem 1rem;
  border-radius: var(--r-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: .9rem;
  font-weight: 700;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  transition: var(--tr);
}
.mat-download-btn:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: var(--bg-card);
  transform: translateY(-2px);
}

/* PDF Viewer Modal */
.modal.pdf-modal {
  max-width: 1050px;
  width: 94vw;
  height: 88vh;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.5rem;
}
.mat-modal-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--r-sm);
  background: rgba(239,68,68,.12);
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}
.pdf-viewer-body {
  flex-grow: 1;
  width: 100%;
  height: calc(100% - 60px);
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: #1e293b;
  margin-top: .5rem;
}
.pdf-viewer-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Empty or Loading State */
.materials-loading, .materials-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--text-muted);
}
.materials-empty i {
  font-size: 2.8rem;
  opacity: .5;
  display: block;
  margin-bottom: .75rem;
}




