/* ==========================================================================
   مكوّنات واجهة المستخدم — أزرار، وسوم، نوافذ، أدراج، نماذج، حالات
   كل القياسات من css/tokens.css. الحد الأدنى للمس 44×44 بكسل.
   ========================================================================== */

/* ==========================================================================
   1) الأزرار
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-inline);
  min-height: var(--control-h);
  padding: var(--space-2) var(--space-5);
  font-family: var(--font-arabic);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: var(--t-interactive);
}

.btn :is(i, svg) { width: 18px; height: 18px; flex-shrink: 0; }
.btn-block { width: 100%; }

/* ردّ فعل الضغط لازم يبقى أسرع من انتقال الـ hover: الإصبع لسه على
   الشاشة، فأي تأخير هنا بيتقري "الزرّ ما حسّش بيا". */
.btn:active {
  transform: scale(0.97);
  transition-duration: var(--dur-instant);
}

.btn-primary {
  background: var(--fill-primary);
  color: #ffffff;
  box-shadow: var(--elev-2), var(--edge-light);
}

/* تغيّر اللون مسموح على كل الأجهزة — هو ردّ فعل مفيد حتى على اللمس */
.btn-primary:hover { background: var(--fill-primary-hover); color: #ffffff; }

/* الرفع والظل للماوس فقط: على اللمس بيفضلوا عالقين بعد اللمسة */
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover {
    box-shadow: var(--elev-3), var(--edge-light);
    transform: translateY(var(--lift));
  }
}

.btn-accent {
  background: var(--color-accent);
  color: var(--text-inverse);
  border-color: rgba(245, 158, 11, 0.4);
}

.btn-accent:hover { background: #d97706; color: #ffffff; }
[data-theme="light"] .btn-accent { background: #8A5310; color: #ffffff; border-color: transparent; }
[data-theme="light"] .btn-accent:hover { background: #6F420C; }

/* زر التحذير — نفس منطق accent بدلالة مختلفة */
.btn-warning { background: var(--color-accent); color: var(--text-inverse); border-color: rgba(245, 158, 11, 0.45); }
.btn-warning:hover { background: #d97706; color: #ffffff; }
[data-theme="light"] .btn-warning { background: #8A5310; color: #ffffff; }

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-outline:hover { background: var(--bg-hover); border-color: var(--on-surface-primary); color: var(--on-surface-primary); }

.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

/* الإجراءات الهدّامة تحمل لونها الدلالي وتُفصل بصريًا عن الإجراء الأساسي */
.btn-danger { background: var(--fill-danger); color: #ffffff; }
.btn-danger:hover { filter: brightness(1.1); color: #ffffff; }

.btn-whatsapp { background: #15803d; color: #ffffff; }
.btn-whatsapp:hover { background: #166534; color: #ffffff; }

.btn-facebook { background: #1651a8; color: #ffffff; }
.btn-facebook:hover { background: #123f83; color: #ffffff; }

.btn-pinterest { background: #b3001b; color: #ffffff; }
.btn-pinterest:hover { background: #8c0015; color: #ffffff; }

/* المقاسات — الأصغر يوسَّع بمنطقة لمس إضافية بدل تكبير شكله */
.btn-lg { min-height: var(--control-h-lg); padding: var(--space-3) var(--space-7); font-size: var(--text-lg); }
.btn-sm { min-height: var(--control-h-sm); padding: var(--space-2) var(--space-4); font-size: var(--text-sm); }
.btn-sm :is(i, svg) { width: 16px; height: 16px; }

.btn-xs {
  min-height: 32px;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
  position: relative;
}

.btn-xs :is(i, svg) { width: 14px; height: 14px; }

/* توسيع منطقة اللمس للأزرار الصغيرة دون تغيير شكلها (Apple HIG) */
.btn-xs::after { content: ""; position: absolute; inset: -6px 0; }

.btn-icon-xs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: var(--t-interactive);
  position: relative;
}

.btn-icon-xs::after { content: ""; position: absolute; inset: -5px; }
.btn-icon-xs:hover { background: var(--fill-primary); color: #ffffff; border-color: var(--fill-primary); }
.btn-icon-xs :is(i, svg) { width: 16px; height: 16px; }

/* ==========================================================================
   أشرطة الفلاتر وأزرار التصفية الموحدة (Filter Bars & Pill Buttons)
   ========================================================================== */
.curriculum-controls-bar,
.insp-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-5);
  margin-bottom: var(--space-6);
  box-shadow: var(--elev-1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color var(--t-interactive);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* زر الفلترة على شكل كبسولة أنيقة (Pill Button) */
.filter-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-arabic);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  border-radius: var(--radius-full);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.filter-pill-btn :is(i, svg) {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.filter-pill-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--color-primary);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.15);
}

.filter-pill-btn:hover :is(i, svg) {
  transform: scale(1.1);
}

.filter-pill-btn:active {
  transform: scale(0.97);
}

.filter-pill-btn.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  font-weight: var(--weight-bold);
}

.filter-pill-btn.active :is(i, svg) {
  color: #ffffff !important;
}

/* دعم النمط النهاري (Light Mode) */
[data-theme="light"] .curriculum-controls-bar,
[data-theme="light"] .insp-controls-bar {
  background: #ffffff;
  border-color: rgba(92, 58, 33, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .filter-pill-btn {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #475569;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .filter-pill-btn:hover {
  background: #f1f5f9;
  border-color: #0284c7;
  color: #0f172a;
}

[data-theme="light"] .filter-pill-btn.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff !important;
  border-color: #0284c7 !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

/* حقل البحث داخل شريط الفلاتر */
.search-courses-input-wrapper,
.insp-search-wrapper {
  position: relative;
  min-width: 260px;
  flex: 1 1 260px;
  max-width: 380px;
}

.search-courses-input,
.insp-search-input {
  width: 100%;
  min-height: 38px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 6px 16px 6px 38px;
  color: var(--text-primary);
  font-family: var(--font-arabic);
  font-size: var(--text-sm);
  outline: none;
  transition: var(--t-interactive);
}

.search-courses-input:focus,
.insp-search-input:focus {
  border-color: var(--color-primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2);
}

.search-courses-icon,
.insp-search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

/* ==========================================================================
   2) الوسوم والشارات
   ========================================================================== */
.badge-upd-core { background: rgba(2, 132, 199, 0.15); color: var(--on-surface-primary); border: 1px solid rgba(56, 189, 248, 0.3); }
.badge-upd-elective { background: rgba(245, 158, 11, 0.15); color: var(--on-surface-accent); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-science { background: rgba(139, 92, 246, 0.15); color: var(--on-surface-info); border: 1px solid rgba(139, 92, 246, 0.3); }
.badge-faculty { background: rgba(100, 116, 139, 0.2); color: var(--text-secondary); border: 1px solid rgba(148, 163, 184, 0.3); }
.badge-uni { background: rgba(16, 185, 129, 0.15); color: var(--on-surface-success); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-accent { background: rgba(245, 158, 11, 0.2); color: var(--on-surface-accent); }
.badge-success { background: rgba(16, 185, 129, 0.2); color: var(--on-surface-success); }
.badge-outline { border: 1px solid var(--border-strong); color: var(--text-secondary); }

[data-theme="light"] .badge-upd-core { background: rgba(92, 58, 33, 0.10); border-color: rgba(92, 58, 33, 0.26); }
[data-theme="light"] .badge-upd-elective { background: rgba(184, 115, 38, 0.12); border-color: rgba(184, 115, 38, 0.30); }
[data-theme="light"] .badge-science { background: rgba(107, 78, 113, 0.12); border-color: rgba(107, 78, 113, 0.28); }
[data-theme="light"] .badge-uni { background: rgba(45, 122, 56, 0.12); border-color: rgba(45, 122, 56, 0.28); }
[data-theme="light"] .badge-faculty { background: rgba(92, 58, 33, 0.08); border-color: rgba(92, 58, 33, 0.2); }

/* شارات الصلاحية */
.user-role-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
}

.badge-head { background: rgba(245, 158, 11, 0.18); color: var(--on-surface-accent); border: 1px solid rgba(245, 158, 11, 0.4); }
.badge-prof { background: rgba(139, 92, 246, 0.18); color: var(--on-surface-info); border: 1px solid rgba(139, 92, 246, 0.4); }
.badge-ta { background: rgba(14, 165, 233, 0.18); color: var(--on-surface-primary); border: 1px solid rgba(14, 165, 233, 0.4); }
.badge-rep { background: rgba(16, 185, 129, 0.18); color: var(--on-surface-success); border: 1px solid rgba(16, 185, 129, 0.4); }
.badge-student { background: rgba(100, 116, 139, 0.2); color: var(--text-muted); border: 1px solid var(--border-subtle); }
.badge-admin { background: rgba(244, 63, 94, 0.18); color: var(--on-surface-danger); border: 1px solid rgba(244, 63, 94, 0.4); }
.badge-anon { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); border: 1px dashed var(--border-strong); }

/* ==========================================================================
   3) شريط وصف الصلاحية
   ========================================================================== */
.role-description-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-inline-start: 3px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-5);
  margin-bottom: var(--space-6);
}

.role-description-banner[hidden] {
  display: none !important;
}

.role-desc-inner { display: flex; align-items: flex-start; gap: var(--space-3); color: var(--text-secondary); font-size: var(--text-sm); }
.role-desc-inner :is(i, svg) { width: 20px; height: 20px; color: var(--on-surface-primary); flex-shrink: 0; margin-top: 2px; }
.role-desc-inner p { margin: var(--space-1) 0 0; }
.role-desc-inner strong { color: var(--text-primary); }

/* ==========================================================================
   4) النوافذ المنبثقة والأدراج
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(4, 7, 16, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  overscroll-behavior: contain;
}

.modal-backdrop.active { display: flex; animation: fadeIn var(--dur-base) var(--ease-out); }

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--elev-5);
  max-width: 680px;
  width: 100%;
  max-height: min(90dvh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn var(--dur-slow) var(--ease-out);
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-dialog.modal-lg { max-width: 960px; }

.modal-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-shrink: 0;
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-black);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
}

.modal-title :is(i, svg) { width: 20px; height: 20px; color: var(--on-surface-primary); flex-shrink: 0; }

.modal-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--icon-btn);
  height: var(--icon-btn);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  flex-shrink: 0;
  transition: var(--t-colors);
}

.modal-close-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-close-btn :is(i, svg) { width: 19px; height: 19px; }

.modal-body { padding: var(--space-6); overflow-y: auto; overscroll-behavior: contain; }

.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--gap-control);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.auth-footer-center { justify-content: center; }

@media (max-width: 560px) {
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal-dialog { max-width: none; max-height: 92dvh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-footer { justify-content: stretch; }
  .modal-footer .btn { flex: 1 1 auto; }
}

/* الدرج الجانبي (تفاصيل المقرر) */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(4, 7, 16, 0.72);
  backdrop-filter: blur(6px);
  display: none;
  justify-content: flex-start;
}

.drawer-backdrop.active { display: flex; }

.drawer-container {
  background: var(--bg-surface);
  width: 100%;
  max-width: 620px;
  height: 100%;
  border-inline-start: 1px solid var(--border-strong);
  box-shadow: var(--elev-5);
  display: flex;
  flex-direction: column;
  animation: slideDrawer var(--dur-slow) var(--ease-out);
  overflow: hidden;
}

@keyframes slideDrawer { from { transform: translateX(100%); } to { transform: translateX(0); } }

.drawer-top-bar {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-shrink: 0;
}

.drawer-scroll-area { padding: var(--space-6); overflow-y: auto; flex: 1; }

/* ==========================================================================
   5) النماذج
   ========================================================================== */
.form-group { margin-bottom: var(--space-5); }

.form-group > label,
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.form-group > label :is(i, svg) { width: 15px; height: 15px; vertical-align: -2px; margin-inline-end: var(--space-1); }

.req { color: var(--on-surface-danger); margin-inline-start: 2px; }

.form-control {
  width: 100%;
  min-height: var(--control-h);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-arabic);
  font-size: var(--text-base);
  transition: var(--t-colors), box-shadow var(--dur-fast) var(--ease-out);
}

.form-control::placeholder { color: var(--text-muted); opacity: 1; }
.form-control:hover { border-color: var(--border-accent); }

.form-control:focus-visible {
  border-color: var(--focus-ring-color);
  box-shadow: var(--focus-ring-shadow);
}

/* حالة الخطأ: لون + أيقونة + نص — ليست اللون وحده */
.form-control[aria-invalid="true"] { border-color: var(--on-surface-danger); }

.field-hint {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
  line-height: var(--leading-snug);
}

.field-error {
  display: flex;
  align-items: flex-start;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--on-surface-danger);
  margin-top: var(--space-1);
}

.field-error :is(i, svg) { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; }

/* ملخّص الأخطاء أعلى النموذج — يستقبل التركيز بعد فشل الإرسال */
.form-error-summary {
  background: rgba(244, 63, 94, 0.10);
  border: 1px solid var(--on-surface-danger);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-5);
  color: var(--text-primary);
  font-size: var(--text-sm);
}

.form-error-summary strong { display: flex; align-items: center; gap: var(--space-2); color: var(--on-surface-danger); margin-bottom: var(--space-2); }
.form-error-summary strong :is(i, svg) { width: 17px; height: 17px; }
.form-error-summary ul { margin: 0; padding-inline-start: var(--space-5); display: flex; flex-direction: column; gap: var(--space-1); }
.form-error-summary a { color: var(--on-surface-danger); font-weight: var(--weight-semibold); }

/* مجموعة حقول */
.auth-fieldset { border: 0; margin: 0 0 var(--space-6); padding: 0; }
.auth-fieldset:last-of-type { margin-bottom: var(--space-4); }

.form-section-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-black);
  color: var(--text-primary);
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-4);
  border-bottom: 1px dashed var(--border-subtle);
  width: 100%;
}

.form-section-label :is(i, svg) { width: 16px; height: 16px; color: var(--on-surface-primary); }

/* حقل كلمة المرور مع زر الإظهار */
.password-field { position: relative; display: flex; }
.password-field .form-control { padding-inline-end: calc(var(--icon-btn) + var(--space-1)); }

.password-toggle {
  position: absolute;
  inset-inline-end: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: var(--icon-btn);
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: var(--t-colors);
}

.password-toggle:hover { color: var(--on-surface-primary); background: var(--bg-hover); }
.password-toggle :is(i, svg) { width: 18px; height: 18px; }

/* ==========================================================================
   6) نافذة البحث الشامل
   ========================================================================== */
.search-modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  overflow: hidden;
  box-shadow: var(--elev-5);
  display: flex;
  flex-direction: column;
  max-height: min(80dvh, 640px);
  animation: modalIn var(--dur-base) var(--ease-out);
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.search-modal-icon { width: 20px; height: 20px; color: var(--on-surface-primary); flex-shrink: 0; }

.search-input-field {
  flex: 1;
  min-width: 0;
  min-height: var(--control-h);
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-arabic);
  font-size: var(--text-lg);
  color: var(--text-primary);
}

.search-input-field::placeholder { color: var(--text-muted); font-size: var(--text-base); }

.search-results-list { overflow-y: auto; padding: var(--space-2); flex: 1; }

.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  text-align: start;
  min-height: var(--tap-min);
  padding: var(--space-2) var(--space-3);
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-md);
  color: inherit;
  text-decoration: none;
  transition: var(--t-colors);
}

.search-result-item:hover,
.search-result-item[aria-selected="true"] {
  background: var(--bg-hover);
  border-color: var(--border-accent);
}

.search-type {
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-xs);
  white-space: nowrap;
  flex-shrink: 0;
}

.search-item-info { min-width: 0; flex: 1; }
.search-item-info strong { display: block; color: var(--text-primary); font-size: var(--text-base); }
.search-item-info small { display: block; color: var(--text-muted); font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.search-hint, .search-empty { text-align: center; padding: var(--space-8) var(--space-5); color: var(--text-muted); font-size: var(--text-base); margin: 0; }
.search-empty strong { color: var(--text-primary); }

.search-modal-foot {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-2xs);
  color: var(--text-muted);
  flex-shrink: 0;
}

@media (max-width: 560px) { .search-modal-foot { display: none; } }

/* ==========================================================================
   7) عناوين الأقسام (النمط القديم — مستخدمة داخل الصفحات)
   ========================================================================== */
.section-title-group { margin-bottom: var(--space-7); }

.section-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-black);
  color: var(--on-surface-primary);
  margin-bottom: var(--space-2);
}

.section-main-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-black);
  color: var(--text-primary);
  line-height: var(--leading-tight);
  text-wrap: balance;
}

.section-lead-text {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
  max-width: var(--measure);
}

/* ==========================================================================
   جرس الإشعارات (في الهيدر، على كل الصفحات)
   ========================================================================== */

.notif-wrap { position: relative; display: inline-flex; }

.notif-bell-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: var(--icon-btn);
  height: var(--icon-btn);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--overlay-1);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.notif-bell-btn:hover { background: var(--overlay-2); color: var(--text-primary); transform: translateY(var(--lift)); }
.notif-bell-btn:focus-visible { outline: none; box-shadow: var(--focus-ring-shadow); }
.notif-bell-btn .lucide { width: 20px; height: 20px; }

.notif-badge {
  position: absolute;
  inset-block-start: 2px;
  inset-inline-end: 2px;
  min-width: 18px;
  height: 18px;
  padding-inline: 5px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  background: var(--fill-danger);
  color: #fff;
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
  line-height: 1;
  box-shadow: 0 0 0 2px var(--bg-header-bar);
}

.notif-panel {
  position: absolute;
  inset-block-start: calc(100% + var(--space-2));
  inset-inline-end: 0;
  width: min(380px, calc(100vw - var(--space-6)));
  max-height: min(70vh, 520px);
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--elev-4), var(--edge-light);
  z-index: var(--z-drawer);
  overflow: hidden;
}

.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-control);
  padding: var(--space-4) var(--space-5);
  border-block-end: 1px solid var(--border-subtle);
}
.notif-head h2 {
  margin: 0;
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
}
.notif-head-link {
  font-size: var(--text-sm);
  color: var(--on-surface-primary);
  text-decoration: none;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding-inline: var(--space-2);
  border-radius: var(--radius-sm);
}
.notif-head-link:hover { text-decoration: underline; }

.notif-list { overflow-y: auto; overscroll-behavior: contain; }

.notif-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: var(--gap-inline);
  align-items: start;
  padding: var(--space-3) var(--space-5);
  border-block-end: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  text-decoration: none;
  min-height: var(--tap-min);
}
a.notif-item:hover { background: var(--bg-hover); color: var(--text-primary); }
a.notif-item:focus-visible { outline: none; box-shadow: var(--focus-ring-shadow); }

.notif-item.is-unread { background: var(--overlay-1); }
.notif-item.is-unread .notif-text { color: var(--text-primary); font-weight: var(--weight-medium); }

.notif-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-glow);
  color: var(--on-surface-primary);
}
.notif-icon .lucide { width: 16px; height: 16px; }

.notif-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-text { font-size: var(--text-base); line-height: var(--leading-snug); }
.notif-text strong { color: var(--text-primary); font-weight: var(--weight-semibold); }
.notif-time { font-size: var(--text-xs); color: var(--text-muted); }

.notif-empty {
  margin: 0;
  padding: var(--space-8) var(--space-5);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
}

/* ==========================================================================
   شريحة حالة الخادم في الهيدر
   (الزرار بيتحقن من layout.js وكان طالع بستايل المتصفح الافتراضي —
    الستايل هنا بيخلّيه جزء من الهوية وبيوصّله للحد الأدنى للمس)
   ========================================================================== */

.server-status-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-inline);
  min-height: var(--control-h-sm);
  padding-inline: var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--overlay-1);
  color: var(--text-secondary);
  font: inherit;
  font-size: var(--text-xs);
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
.server-status-chip:hover { background: var(--overlay-2); color: var(--text-primary); }
.server-status-chip:focus-visible { outline: none; box-shadow: var(--focus-ring-shadow); }

.status-indicator-dot {
  width: 8px; height: 8px;
  flex: 0 0 8px;
  border-radius: var(--radius-full);
  background: var(--text-muted);
}
.status-indicator-dot.large { width: 12px; height: 12px; flex-basis: 12px; }
.server-status-chip.online  .status-indicator-dot { background: var(--color-emerald); box-shadow: 0 0 0 2px var(--color-emerald-glow); }
.server-status-chip.offline .status-indicator-dot { background: var(--color-rose); }

/* على الشاشات الضيقة النص بيتشال والنقطة بتفضل — الحالة لسه واضحة
   من اللون + الـ title، والهيدر ما بيزدحمش */
@media (max-width: 720px) {
  .server-status-chip .status-indicator-text { display: none; }
  .server-status-chip { padding-inline: var(--space-2); }
}
