/* ============================================================
   الوزن المثالي Training — Portal (الصفحة الترحيبية / بوابة المسارات)
   ============================================================ */

body.portal {
  background:
    radial-gradient(1100px 620px at 85% -8%, rgba(196,154,63,.16), transparent 60%),
    radial-gradient(900px 560px at 8% 8%, rgba(95,164,92,.12), transparent 55%),
    radial-gradient(800px 700px at 50% 120%, rgba(23,58,94,.10), transparent 60%),
    var(--cream);
  /* أُزيل min-height:100vh — كان يفرض فراغاً كريمياً حول الفوتر على الشاشات العريضة */
}

/* خلفية متحركة ناعمة */
.portal-orbs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(46px); opacity: .5; }
.orb.o1 { width: 340px; height: 340px; top: -90px; left: -80px; background: rgba(196,154,63,.28); animation: floaty 9s ease-in-out infinite; }
.orb.o2 { width: 300px; height: 300px; bottom: -110px; right: -70px; background: rgba(95,164,92,.24); animation: floaty 11s ease-in-out infinite reverse; }
.orb.o3 { width: 260px; height: 260px; top: 42%; right: 14%; background: rgba(23,58,94,.16); animation: floaty 13s ease-in-out infinite; }

.portal-wrap { position: relative; z-index: 1; }

/* ---------- الترويسة العلوية (لوجو + أدوات الموظف في سطر واحد متوازن) ---------- */
.portal-top {
  /* في تدفّق الصفحة (لا يغطّي البطل) — يُثبَّت عائمًا فقط بعد النزول قليلًا (reveal-on-scroll). طلب المؤسّس 2026-07-21. */
  position: relative; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; gap: 14px; flex-wrap: wrap;
  background: rgba(250,246,238,.85); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); border-radius: 0 0 16px 16px;
  box-shadow: 0 6px 20px rgba(92,72,28,.06);
}
/* يظهر مثبّتًا (عائمًا) بعد النزول ~٣-٥ أسطر فقط — يُضيفه/يُزيله سكربتُ التمرير في menu.js */
.portal-top.is-float {
  position: fixed; left: 0; right: 0; top: 0;
  padding-top: 8px; padding-bottom: 8px;
  box-shadow: 0 8px 24px rgba(92,72,28,.16);
  animation: portalDrop .28s var(--ease);
}
@keyframes portalDrop { from { transform: translateY(-100%); opacity: .35; } to { transform: translateY(0); opacity: 1; } }
.portal-top-spacer { height: 0; flex-basis: 100%; }
.portal-top .dnp-logo img { height: 50px; }

/* أدوات الموظف: مجموعة أزرار أنيقة بمحاذاة الطرف المقابل للّوجو */
.welcome-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; animation: fadeUp .5s var(--ease); }
.wb-greet {
  display: inline-flex; align-items: center; font-family: 'Cairo', sans-serif; font-weight: 700;
  font-size: .85rem; color: var(--ink-2); background: var(--paper); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 15px; box-shadow: var(--shadow-sm);
}
.wb-greet b { color: var(--brand-purple); }
.wb-sep { margin: 0 7px; color: var(--line); }
.wb-profile {
  display: inline-flex; align-items: center; gap: 6px; font-family: 'Cairo', sans-serif; font-weight: 700;
  font-size: .84rem; color: var(--ink-2); background: var(--paper); border: 1px solid var(--line);
  border-radius: 999px; padding: 9px 15px; box-shadow: var(--shadow-sm); text-decoration: none; transition: all .2s; cursor: pointer;
}
.wb-profile:hover { border-color: var(--gold); color: var(--gold-dark); transform: translateY(-2px); }
.wb-logout {
  display: inline-flex; align-items: center; gap: 6px; background: var(--cream-2); color: var(--ink-2); border: 1px solid transparent;
  border-radius: 999px; padding: 9px 16px; font-family: 'Cairo', sans-serif; font-weight: 700; font-size: .84rem; transition: all .2s;
}
.wb-logout:hover { background: var(--red-soft); color: var(--red); }

/* ---------- البطل (Hero) ---------- */
.hero { text-align: center; padding: 46px 0 30px; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 22px;
  padding: 8px 20px; border-radius: 999px; background: var(--paper);
  box-shadow: var(--shadow-sm); font-family: 'Cairo', sans-serif; font-weight: 700;
  font-size: .86rem; color: var(--gold-dark); border: 1px solid var(--line);
}
.hero .eyebrow .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(95,164,92,.22); }
.hero h1 { font-size: clamp(2.1rem, 6vw, 3.7rem); font-weight: 900; letter-spacing: -.5px; }
.hero h1 .ln2 { display: block; margin-top: 6px; }
.hero p.lead {
  max-width: 720px; margin: 20px auto 0; font-size: clamp(1rem, 2.4vw, 1.22rem);
  color: var(--ink-2); font-weight: 500;
}

/* شريط الإحصاءات */
.hero-stats { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 30px; }
.hstat {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 24px; box-shadow: var(--shadow-sm); min-width: 130px;
}
.hstat b { font-family: 'Cairo', sans-serif; font-size: 1.5rem; font-weight: 900; color: var(--gold-dark); display: block; }
.hstat span { font-size: .82rem; color: var(--muted); font-weight: 600; }

/* ---------- قسم المسارات ---------- */
.paths { padding: 40px 0 24px; }
.section-head { text-align: center; margin-bottom: 36px; }
.section-head h2 { font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 900; }
.section-head h2 .bar { display: inline-block; width: 54px; height: 5px; border-radius: 99px; background: var(--gold-grad); vertical-align: middle; margin: 0 14px; }
.section-head p { color: var(--ink-2); margin-top: 8px; font-weight: 500; }

.paths-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 26px;
}

/* ============ شريط قطاعات التدريب (4 تبويبات بجانب بعضها) ============ */
.sector-tabs {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  max-width: 1080px; margin: 0 auto 30px;
}
.sector-tab {
  display: flex; align-items: center; gap: 11px; text-align: right;
  padding: 13px 15px; border-radius: var(--r-lg);
  background: var(--paper); border: 1.5px solid var(--line); box-shadow: var(--shadow-sm);
  cursor: pointer; transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s;
}
.sector-tab:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--gold); }
.sector-tab .st-ic { font-size: 1.55rem; flex: none; }
.sector-tab .st-txt { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.sector-tab .st-txt b { font-family: 'Cairo', sans-serif; font-weight: 800; font-size: .92rem; color: var(--navy); white-space: nowrap; }
.sector-tab .st-txt i { font-style: normal; font-size: .76rem; color: var(--muted); font-weight: 600; margin-top: 2px; }
.sector-tab.on {
  background: var(--navy-grad); border-color: transparent; box-shadow: 0 14px 30px rgba(15,42,69,.28);
}
.sector-tab.on .st-txt b { color: #fff; }
.sector-tab.on .st-txt i { color: rgba(255,255,255,.85); }
html[data-theme="dark"] .sector-tab .st-txt b { color: var(--ink); }
html[data-theme="dark"] .sector-tab.on .st-txt b { color: #fff; }
/* الفلتر الفرعيّ لـ«التدريبات المتنوّعة» — رقائق تصنيف واضحة الضغط (2026-09-30) */
.misc-subfilter {
  max-width: 940px; margin-inline: auto;
  background: #fff; border: 1px solid #ece3cf; border-radius: 16px;
  padding: 12px 14px; box-shadow: 0 6px 18px rgba(40,50,80,.06);
}
.misc-subfilter .msf-label {
  display: block; width: 100%; text-align: center; margin-bottom: 9px;
  font-family: 'Cairo', sans-serif; font-weight: 800; font-size: .82rem; color: #8a6d2a;
}
.misc-chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none;
  font-family: 'Cairo', sans-serif; font-weight: 800; font-size: .86rem; color: #173A5E;
  background: #FBF7EE; border: 1.5px solid #E2C36A; border-radius: 999px;
  padding: 9px 16px; transition: transform .14s, box-shadow .14s, background .14s;
  white-space: nowrap; box-shadow: 0 2px 6px rgba(196,154,63,.14);
}
.misc-chip:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(196,154,63,.28); background: #fff; border-color: #C49A3F; }
.misc-chip:active { transform: translateY(0); }
.misc-chip b {
  font-weight: 800; font-size: .74rem; background: #C49A3F22; color: #8a6d2a;
  border-radius: 999px; padding: 1px 7px; margin-inline-start: 2px;
}
.misc-chip.on { background: linear-gradient(90deg,#E2C36A,#A87B28); color: #fff; border-color: #A87B28; box-shadow: 0 8px 22px rgba(196,154,63,.42); }
.misc-chip.on b { background: rgba(255,255,255,.28); color: #fff; }
html[data-theme="dark"] .misc-subfilter { background: rgba(255,255,255,.04); border-color: rgba(226,195,106,.25); }
html[data-theme="dark"] .misc-chip { color: #eee; background: rgba(226,195,106,.10); }
html[data-theme="dark"] .misc-chip.on { color: #fff; }
/* لوحيّ: 2×2 مع بقاء التبويبات بجانب بعضها */
@media (max-width: 820px) {
  .sector-tabs { grid-template-columns: repeat(2, 1fr); gap: 10px; max-width: 560px; }
}
@media (max-width: 460px) {
  .sector-tabs { gap: 8px; margin-bottom: 22px; }
  .sector-tab { padding: 11px 12px; gap: 9px; }
  .sector-tab .st-ic { font-size: 1.4rem; }
  .sector-tab .st-txt b { font-size: .84rem; }
}

/* أسماء المنتجات على بطاقة المسار */
.path-products { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 2px 0 0; }
.path-products .pp {
  font-size: .72rem; font-weight: 600; line-height: 1;
  background: var(--cream-2, #f3ecda); color: var(--navy);
  padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line);
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex-shrink: 0; /* لا تنكمشِ الشِّيبةُ عند حافّةِ البطاقة — تلتفُّ كاملةً لسطرٍ جديدٍ بدل أن تُقصّ (قرار المؤسّس 2026-07-28) */
}
.path-products .pp.more { background: linear-gradient(135deg, var(--gold), #E2C36A); color: #fff; border-color: transparent; }

/* تصحيح الوضع الليلي: --navy لا يتكيّف، فنستبدل لون النص بفاتح مقروء */
html[data-theme="dark"] .path-products .pp { color: var(--ink); background: var(--cream-3); border-color: var(--line); }
html[data-theme="dark"] .cat-head h3 { color: var(--ink); }
html[data-theme="dark"] .cat-head .cat-ic { background: var(--cream-3); }

/* ============ أقسام الفئات ============ */
.paths-cats { display: block; }
.cat-section { margin-bottom: 40px; opacity: 0; animation: fadeUp .7s var(--ease) forwards; }
.cat-head {
  display: flex; align-items: center; gap: 14px;
  margin: 0 2px 20px; padding-bottom: 12px;
  border-bottom: 2px solid var(--line); position: relative;
}
.cat-head::after {
  content: ""; position: absolute; bottom: -2px; right: 0; width: 90px; height: 2px;
  background: linear-gradient(90deg, var(--gold), #E2C36A); border-radius: 2px;
}
.cat-head .cat-ic {
  width: 46px; height: 46px; flex: none; display: grid; place-items: center;
  font-size: 1.5rem; border-radius: 14px;
  background: linear-gradient(135deg, var(--cream-2, #f3ecda), #fff);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.cat-head h3 { font-size: 1.3rem; color: var(--navy); margin: 0; font-weight: 800; }
.cat-head .cat-count {
  margin-inline-start: auto; font-size: .78rem; font-weight: 700; color: var(--gold-dark, #a87f2c);
  background: var(--cream-2, #f3ecda); padding: 5px 14px; border-radius: 999px; white-space: nowrap;
}
.cat-soon {
  grid-column: 1 / -1; text-align: center; padding: 34px 20px;
  border: 2px dashed var(--line); border-radius: var(--r-lg);
  color: var(--muted); background: linear-gradient(180deg, rgba(255,255,255,.5), transparent);
}
.cat-soon .cs-ic { font-size: 2.2rem; display: block; margin-bottom: 8px; opacity: .7; }
.cat-soon p { font-size: .95rem; }
.cat-soon b { color: var(--gold-dark, #a87f2c); }

/* بطاقة مسار (فلاش) */
.path-card {
  position: relative; background: var(--paper); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line);
  display: flex; flex-direction: column; transition: transform .35s var(--ease), box-shadow .35s var(--ease);
  opacity: 0; animation: fadeUp .7s var(--ease) forwards;
}
.path-card.active:hover { transform: translateY(-10px); box-shadow: var(--shadow-lg); }

.path-banner {
  position: relative; height: 168px; display: flex; align-items: center; justify-content: center;
  background: var(--navy-grad); overflow: hidden;
}
.path-banner.gold { background: var(--gold-grad); }
.path-banner.green { background: var(--green-grad); }
.path-banner::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.20), transparent 50%);
}
.path-banner .pb-icon { font-size: 3.4rem; filter: drop-shadow(0 6px 12px rgba(0,0,0,.25)); z-index: 1; animation: floaty 6s ease-in-out infinite; }
.path-banner .pb-tag {
  position: absolute; top: 14px; right: 14px; z-index: 4;   /* أعلى من شريحة القسم كي لا تُغطّيه على الجوال */
  padding: 5px 14px; border-radius: 999px; font-family: 'Cairo', sans-serif;
  font-weight: 800; font-size: .72rem; backdrop-filter: blur(6px); white-space: nowrap;
}
.pb-tag.live { background: rgba(255,255,255,.92); color: var(--green-dark); }
.pb-tag.soon { background: rgba(0,0,0,.28); color: #fff; }
/* ===== زرّ مشاركة التدريب (أعلى يسار البطاقة) ===== */
.path-banner .pb-share {
  position: absolute; top: 12px; left: 12px; z-index: 3;
  width: 34px; height: 34px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.92); color: var(--navy, #1E3A5F); font-size: .95rem; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(0,0,0,.22); backdrop-filter: blur(6px);
  transition: transform .15s var(--ease), background .15s var(--ease);
}
.path-banner .pb-share:hover { transform: scale(1.12); background: #fff; }
.path-banner .pb-share:active { transform: scale(.95); }
/* ===== رسالة عابرة (toast) ===== */
.dnp-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--navy, #1E3A5F); color: #fff; padding: 12px 22px; border-radius: 999px;
  font-family: 'Cairo', sans-serif; font-weight: 800; font-size: .9rem; z-index: 9999;
  box-shadow: 0 10px 30px rgba(0,0,0,.28); opacity: 0; pointer-events: none;
  transition: opacity .25s var(--ease), transform .25s var(--ease); max-width: 90vw; text-align: center;
}
.dnp-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* ===== بطاقةٌ أكملها المتدرّب: خافتةٌ + وسامُ الدرجة ===== */
.path-card.completed { opacity: .62; filter: saturate(.85); transition: opacity .25s var(--ease), filter .25s var(--ease); }
.path-card.completed:hover { opacity: 1; filter: none; }
.path-card.completed .path-banner::before {
  content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.14); z-index: 1;
}
.pb-done {
  position: absolute; top: 15px; left: 56px; z-index: 3; /* بجانب زرِّ المشاركةِ لا فوقَه (إصلاح التراكب) */
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 999px;
  background: linear-gradient(135deg, #fff, #fdf3d6); color: var(--gold-dark);
  border: 1.5px solid var(--gold); box-shadow: 0 4px 12px rgba(198,160,74,.35);
  font-family: 'Cairo', sans-serif; font-weight: 900; font-size: .74rem;
}
.pb-done b { font-size: .82rem; }
.path-meta .m-done {
  background: var(--green-soft); color: var(--green-dark);
  border: 1px solid rgba(46,139,87,.35); font-weight: 800;
}
html[data-theme="dark"] .path-card.completed { opacity: .55; }
html[data-theme="dark"] .pb-done { background: linear-gradient(135deg, #2a2418, #3a3120); color: #f0d488; }
/* فلاشة القسم (للجولات) — موازية لـ«متاح الآن» في الزاوية المقابلة */
.path-banner .pb-cat {
  position: absolute; top: 15px; left: 56px; z-index: 2; /* بجانب زرِّ المشاركةِ لا فوقَه */
  padding: 5px 13px; border-radius: 999px; font-family: 'Cairo', sans-serif;
  font-weight: 800; font-size: .72rem; color: #fff;
  box-shadow: 0 3px 10px rgba(0,0,0,.22); white-space: nowrap;
  max-width: calc(100% - 175px); overflow: hidden; text-overflow: ellipsis; /* لا يتمدّد فوق شارة «متاح الآن» على الجوال */
}
.path-banner .pb-logo { position: absolute; bottom: 12px; left: 14px; height: 26px; opacity: .92; z-index: 2; filter: brightness(0) invert(1); }

.path-body { padding: 22px 22px 24px; display: flex; flex-direction: column; flex: 1; text-align: center; align-items: center; gap: 10px; }
.path-body .pb-num { font-family: 'Cairo', sans-serif; font-weight: 800; font-size: .78rem; color: var(--gold-dark); margin: 0; letter-spacing: .3px; }
.path-body h3 { font-size: 1.28rem; font-weight: 800; margin: 0; unicode-bidi: isolate; }
.path-body p { color: var(--ink-2); font-size: .9rem; margin: 0; line-height: 1.6; unicode-bidi: isolate; }

.path-meta { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 4px 0 0; }
.path-meta .m { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; color: var(--ink-2); background: var(--cream-2); padding: 5px 12px; border-radius: 999px; }

.path-card .btn { width: 100%; align-self: stretch; margin-top: auto; } /* auto → كلُّ أزرار الـCTA على خطٍّ واحدٍ أسفل البطاقات (قرار المؤسّس 2026-07-28) */
.path-card.soon { opacity: .96; }
.path-card.soon .path-body h3, .path-card.soon .path-body p { color: var(--ink-2); }
/* زر «قريباً» متمايز عن الأزرار الفعّالة + تباين كافٍ في الوضعين */
.path-card.soon .btn { background: transparent; color: var(--ink-2); box-shadow: none; cursor: not-allowed; border: 1.5px dashed var(--line); font-weight: 800; }
html[data-theme="dark"] .path-card.soon .btn { background: rgba(255,255,255,.05); color: var(--ink-2); border-color: rgba(255,255,255,.2); }

/* تذييل */
.portal-foot { text-align: center; padding: 22px 0 32px; color: var(--muted); font-size: .84rem; font-weight: 500; position: relative; z-index: 1; }
.portal-foot .dnp-logo img { height: 30px; opacity: .8; }
.portal-foot .line { margin-top: 10px; }

@media (max-width: 600px) {
  .portal-top { justify-content: center; text-align: center; }
  .paths-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   📱 تحسينات الهاتف — Portal Mobile (إضافات فقط)
   ============================================================ */
@media (max-width: 600px) {
  /* ترويسة مدمجة ثابتة (Sticky) على الجوال أيضاً — صارت مُختصرة (ترحيب + ☰) */
  .portal-top { padding: 10px 14px; gap: 10px; }
  .portal-top .dnp-logo img { height: 44px; }

  /* أدوات الموظف: لفّ مركزي تحت اللوجو */
  .welcome-bar { gap: 8px; flex-wrap: wrap; justify-content: center; width: 100%; }
  .wb-greet { font-size: .85rem; }
  .wb-profile, .wb-logout { min-height: 42px; }

  /* البطل */
  .hero { padding: 20px 0 14px; }
  .hero .eyebrow { margin-bottom: 12px; font-size: .78rem; padding: 6px 14px; }
  .hero h1 { font-size: clamp(1.8rem, 6.4vw, 2.4rem); }
  .hero p.lead { margin-top: 12px; font-size: .98rem; }
  .paths { padding: 20px 0 54px; }

  /* الإحصاءات: لف أنيق ببطاقات متساوية */
  .hero-stats { gap: 10px; margin-top: 22px; }
  .hstat { flex: 1 1 calc(50% - 10px); min-width: 0; padding: 14px 14px; }
  .hstat b { font-size: 1.3rem; }

  /* رأس القسم */
  .section-head { margin-bottom: 26px; }
  .section-head h2 .bar { width: 36px; margin: 0 10px; }

  /* بطاقات المسارات: لمس أكبر */
  .paths { padding: 32px 0 54px; }
  .paths-grid { gap: 18px; }
  .path-banner { height: 150px; }
  .path-body { padding: 20px 20px 22px; }
  .path-meta .m { min-height: 34px; }
  .path-card .btn { min-height: 50px; }
}

/* عمودان للإحصاءات تبقى متناسقة حتى أصغر الشاشات */
@media (max-width: 400px) {
  .hstat { padding: 12px 10px; }
  .hstat b { font-size: 1.2rem; }
  .hstat span { font-size: .76rem; }
}
