/* ==========================================================================
   بوابة مشاريع التخرج - تصميم رمادي راقي متوافق مع وضعي الفاتح والداكن
   Slate Gray & Tech Blue System - Light/Dark Theme & Mobile Responsive
   ========================================================================== */

/* ==========================================================================
   نظام المتغيرات (Variables - الافتراضي: الوضع الفاتح Light Mode)
   ========================================================================== */
:root {
  --font-family: 'Cairo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;

  /* درجات الرمادي للوضع الفاتح (Light Slate) */
  --bg-main: #f8fafc;
  /* slate-50: رمادي ناصع مريح للعين */
  --bg-card: #ffffff;
  /* خلفية الكروت: أبيض نقي */
  --bg-card-subtle: #f1f5f9;
  /* ترويسات الكروت: slate-100 */
  --bg-input: #ffffff;
  /* خلفية حقل الإدخال */
  --bg-hover: #f1f5f9;
  /* خلفية التمرير التفاعلي */

  /* زر الاستعلام الأساسي للوضع الفاتح (Light Gray Button) */
  --btn-search-bg: #e2e8f0;
  /* رمادي فاتح مريح يتناسب مع الوضع الفاتح */
  --btn-search-hover: #cbd5e1;
  /* أغمق عند التمرير */
  --btn-search-border: #cbd5e1;
  /* حد رمادي هادئ */
  --btn-search-text: #0f172a;
  /* نص رمادي داكن واضح ومقروء */
  --btn-search-icon: #2563eb;
  /* أيقونة زرقاء ناصعة */

  /* لمسات اللون الأزرق المدمج (Tech Blue Accents) */
  --blue-accent: #2563eb;
  /* أزرق حيوي ونقي */
  --blue-soft: #eff6ff;
  /* خلفية زرقاء ناعمة جداً */
  --blue-border: #bfdbfe;
  /* حدود زرقاء ناعمة */
  --blue-text: #2563eb;
  /* أزرق ساطع للأيقونات */

  /* النصوص بتدرجات الرمادي */
  --text-primary: #0f172a;
  /* slate-900: أسود رمادي صريح ومقروء */
  --text-muted: #475569;
  /* slate-600: رمادي للعناوين الفرعية */
  --text-dim: #64748b;
  /* slate-500: رمادي للملاحظات */

  /* الحدود والفواصل والظلال */
  --border-color: #e2e8f0;
  /* slate-200: حد رمادي نظيف */
  --border-light: #cbd5e1;
  --border-focus: #3b82f6;

  /* الألوان الوظيفية */
  --success: #059669;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;

  /* نسبة الانحناء الخفيفة والناعمة (Soft Rounded Corners) */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --transition: all 0.16s ease-in-out;
  --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.03);

  /* التمرير */
  scrollbar-color: #cbd5e1 #f8fafc;
  scrollbar-width: thin;
}

/* ==========================================================================
   الوضع الداكن التلقائي حسب إعداد جهاز المستخدم (System Dark Preference)
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg-main: #0f172a;
    /* slate-900: رمادي داكن هادئ ومريح */
    --bg-card: #1e293b;
    /* slate-800: كروت رمادية بتباين متناسق */
    --bg-card-subtle: #162032;
    /* خلفية الترويسات داخل الكروت */
    --bg-input: #0b1324;
    /* خلفية حقل الإدخال */
    --bg-hover: #273549;
    /* خلفية التمرير التفاعلي */

    /* زر الاستعلام الأساسي للوضع الداكن (Dark Slate Button) */
    --btn-search-bg: #334155;
    /* رمادي داكن مريح يتناسب مع الوضع الداكن */
    --btn-search-hover: #475569;
    --btn-search-border: #475569;
    --btn-search-text: #f1f5f9;
    /* نص فاتح مقروء */
    --btn-search-icon: #60a5fa;
    /* أيقونة زرقاء فاتحة */

    --blue-accent: #3b82f6;
    /* أزرق تقني نقي */
    --blue-soft: rgba(59, 130, 246, 0.12);
    --blue-border: rgba(59, 130, 246, 0.35);
    --blue-text: #60a5fa;

    --text-primary: #f1f5f9;
    /* slate-100: ناصع مريح للعين */
    --text-muted: #94a3b8;
    /* slate-400 */
    --text-dim: #64748b;
    /* slate-500 */

    --border-color: #334155;
    /* slate-700 */
    --border-light: rgba(148, 163, 184, 0.18);
    --border-focus: #3b82f6;

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);

    --card-shadow: 0 2px 6px -1px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.03);
    scrollbar-color: #334155 #0f172a;
  }
}

/* ==========================================================================
   التبديل اليدوي الصريح للوضع الداكن (Explicit Dark Override)
   ========================================================================== */
[data-theme="dark"] {
  color-scheme: dark;
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-card-subtle: #162032;
  --bg-input: #0b1324;
  --bg-hover: #273549;

  /* زر الاستعلام الأساسي للوضع الداكن الصريح */
  --btn-search-bg: #334155;
  --btn-search-hover: #475569;
  --btn-search-border: #475569;
  --btn-search-text: #f1f5f9;
  --btn-search-icon: #60a5fa;

  --blue-accent: #3b82f6;
  --blue-soft: rgba(59, 130, 246, 0.12);
  --blue-border: rgba(59, 130, 246, 0.35);
  --blue-text: #60a5fa;

  --text-primary: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --border-color: #334155;
  --border-light: rgba(148, 163, 184, 0.18);
  --border-focus: #3b82f6;

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);

  --card-shadow: 0 2px 6px -1px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  scrollbar-color: #334155 #0f172a;
}

/* ==========================================================================
   التبديل اليدوي الصريح للوضع الفاتح (Explicit Light Override)
   ========================================================================== */
[data-theme="light"] {
  color-scheme: light;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-input: #ffffff;
  --bg-hover: #f1f5f9;

  /* زر الاستعلام الأساسي للوضع الفاتح الصريح */
  --btn-search-bg: #e2e8f0;
  --btn-search-hover: #cbd5e1;
  --btn-search-border: #cbd5e1;
  --btn-search-text: #0f172a;
  --btn-search-icon: #2563eb;

  --blue-accent: #2563eb;
  --blue-soft: #eff6ff;
  --blue-border: #bfdbfe;
  --blue-text: #2563eb;

  --text-primary: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  --border-color: #e2e8f0;
  --border-light: #cbd5e1;
  --border-focus: #3b82f6;

  --success: #059669;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;

  --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.03);
  scrollbar-color: #cbd5e1 #f8fafc;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* شريط التمرير */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-xs);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-primary);
  direction: rtl;
  text-align: right;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* الحاوية الرئيسية */
.container {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ==========================================================================
   الهيدر (Header)
   ========================================================================== */
.app-header {
  background-color: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 50;
  transition: var(--transition);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon-wrapper {
  width: 36px;
  height: 36px;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--blue-text);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-icon-wrapper svg {
  width: 19px;
  height: 19px;
}

.brand-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.brand-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 400;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* زر تبديل المظهر (Theme Toggle Button) */
.theme-toggle-btn {
  height: 32px;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-focus);
}

.theme-icon {
  width: 14px;
  height: 14px;
  color: var(--blue-text);
}

/* إظهار الأيقونة المناسبة حسب الوضع التلقائي أو اليدوي */
.theme-toggle-btn .sun-icon {
  display: none;
}

.theme-toggle-btn .moon-icon {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle-btn .sun-icon {
    display: block;
  }

  :root:not([data-theme="light"]) .theme-toggle-btn .moon-icon {
    display: none;
  }
}

[data-theme="dark"] .theme-toggle-btn .sun-icon {
  display: block !important;
}

[data-theme="dark"] .theme-toggle-btn .moon-icon {
  display: none !important;
}

[data-theme="light"] .theme-toggle-btn .sun-icon {
  display: none !important;
}

[data-theme="light"] .theme-toggle-btn .moon-icon {
  display: block !important;
}

.header-tag {
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.header-tag svg {
  width: 12px;
  height: 12px;
  color: var(--blue-text);
}

/* ==========================================================================
   المحتوى الرئيسي (Main Content)
   ========================================================================== */
.main-content {
  flex: 1;
  padding: 24px 0 36px;
}

/* ==========================================================================
   البطاقات والكروت بانحناء خفيف ناعم (Soft Rounded Cards)
   ========================================================================== */
.search-card,
.results-header-card,
.team-table-card,
.super-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  box-shadow: var(--card-shadow);
  transition: var(--transition);
}

/* كارت البحث */
.search-card {
  max-width: 520px;
  margin: 0 auto 22px;
  padding: 22px 24px;
  transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-intro {
  margin-bottom: 16px;
  text-align: right;
  max-height: 120px;
  opacity: 1;
  overflow: hidden;
  transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-intro h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.search-intro p {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.search-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-inputs-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  transition: all 0.25s ease;
}

/* حقل الإدخال */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-icon {
  position: absolute;
  right: 12px;
  color: var(--text-dim);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-icon svg {
  width: 16px;
  height: 16px;
}

.search-input {
  width: 100%;
  height: 40px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 38px 8px 12px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}

.search-input::placeholder {
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: normal;
  color: var(--text-dim);
}

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.22);
}

/* زر الاستعلام */
.search-actions {
  display: flex;
  align-items: center;
  width: 100%;
}

.btn-search {
  width: 100%;
  height: 40px;
  background-color: var(--btn-search-bg);
  color: var(--btn-search-text);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0 18px;
  border: 1px solid var(--btn-search-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  white-space: nowrap;
}

.btn-search:hover:not(:disabled) {
  background-color: var(--btn-search-hover);
  color: var(--btn-search-text);
}

.btn-search:active:not(:disabled) {
  transform: scale(0.99);
}

.btn-search:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-search svg {
  width: 15px;
  height: 15px;
  color: var(--btn-search-icon);
}

/* ==========================================================================
   حالة الانكماش بعد الضغط على البحث (Compact State - Inline Row)
   ========================================================================== */
.search-card.compact {
  padding: 12px 16px;
  margin-bottom: 16px;
  max-width: 580px;
}

.search-card.compact .search-intro {
  max-height: 0;
  margin-bottom: 0;
  opacity: 0;
  pointer-events: none;
}

.search-card.compact .search-inputs-row {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.search-card.compact .input-group {
  flex: 1;
  min-width: 0;
}

.search-card.compact .search-actions {
  width: auto;
  flex-shrink: 0;
}

.search-card.compact .btn-search {
  width: auto;
  height: 40px;
  padding: 0 18px;
}

.search-card.compact .search-meta {
  display: none;
}

.search-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
  padding: 0 2px;
}

.char-counter {
  font-weight: 600;
  font-family: monospace;
  color: var(--text-dim);
  font-size: 0.75rem;
}

.char-counter.valid {
  color: var(--blue-text);
}

/* أيقونة التحميل */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   التنبيهات (Alerts)
   ========================================================================== */
.alert-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 520px;
  margin: 0 auto 16px;
  font-size: 0.82rem;
  line-height: 1.45;
  animation: fadeIn 0.18s ease-out;
}

.alert-box.info {
  border-color: var(--blue-border);
  background-color: var(--blue-soft);
  color: var(--blue-text);
}

.alert-box.info .alert-icon svg {
  color: var(--blue-text);
}

.alert-box.warning {
  border-color: rgba(217, 119, 6, 0.35);
  background-color: var(--warning-bg);
  color: var(--warning);
}

.alert-box.warning .alert-icon svg {
  color: var(--warning);
}

.alert-box.danger {
  border-color: rgba(220, 38, 38, 0.35);
  background-color: var(--danger-bg);
  color: var(--danger);
}

.alert-box.danger .alert-icon svg {
  color: var(--danger);
}

.alert-icon {
  flex-shrink: 0;
  display: flex;
  margin-top: 2px;
}

.alert-icon svg {
  width: 16px;
  height: 16px;
}

.alert-content p {
  font-size: 0.82rem;
}

/* ==========================================================================
   حاوية النتائج (Results Container)
   ========================================================================== */
.results-container {
  display: none;
  animation: fadeIn 0.22s ease-out;
}

/* 1. بطاقة ترحيب وبيانات الطالب المستعلم */
.student-banner-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: var(--card-shadow);
  border-right: 4px solid var(--blue-accent);
}

.student-banner-inner {
  display: flex;
  align-items: center;
  gap: 14px;
}

.student-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background-color: var(--blue-soft);
  color: var(--blue-text);
  border: 1px solid var(--blue-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.student-avatar svg {
  width: 22px;
  height: 22px;
}

.student-banner-info {
  flex: 1;
  min-width: 0;
}

.student-banner-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.student-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.3;
}

.student-tags-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.72rem;
  font-weight: 500;
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.meta-tag svg {
  width: 12px;
  height: 12px;
}

.meta-tag.role {
  background-color: var(--warning-bg);
  border-color: rgba(217, 119, 6, 0.35);
  color: var(--warning);
}

.meta-tag.serial {
  background-color: var(--blue-soft);
  border-color: var(--blue-border);
  color: var(--blue-text);
}

/* 2. شبكة كروت الأرقام البارزة (رقم الفريق ورقم المشروع) */
.key-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-light);
}

.stat-card.project-card {
  border-top: 3px solid var(--primary-gray-border);
}

.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-icon-wrapper {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-wrapper.team {
  background-color: var(--blue-soft);
  color: var(--blue-text);
  border: 1px solid var(--blue-border);
}

.stat-icon-wrapper.project {
  background-color: var(--bg-card-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.stat-icon-wrapper svg {
  width: 16px;
  height: 16px;
}

.stat-number-box {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 4px 0 6px;
}

.stat-num-prefix {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dim);
}

.stat-big-number {
  font-size: 2.3rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.stat-card.team-card .stat-big-number {
  color: var(--blue-text);
}

.stat-card-bottom {
  font-size: 0.74rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
  margin-top: 6px;
  font-weight: 500;
}

/* 3. كارت عنوان المشروع (نظيف ومباشر بدون تكرار أو حشو) */
.project-title-card,
.results-header-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: var(--card-shadow);
}

.project-title-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.project-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
}

/* الشارات بانحناء ناعم */
.team-badge,
.field-badge,
.badge-role,
.badge-you {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: var(--radius-xs);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: var(--transition);
}

.team-badge {
  background-color: var(--blue-soft);
  color: var(--blue-text);
  border: 1px solid var(--blue-border);
  font-size: 0.72rem;
  padding: 4px 9px;
}

.team-badge svg {
  width: 12px;
  height: 12px;
}

.field-badge {
  background-color: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 4px 9px;
}

.project-title {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 4px;
}

.project-meta-line {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: monospace;
}

/* شبكة هيئة الإشراف */
.supervisors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.super-card {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
}

.super-card:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-light);
}

.super-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-xs);
  background-color: var(--bg-card-subtle);
  color: var(--blue-text);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.super-icon svg {
  width: 16px;
  height: 16px;
}

.super-card.assistant .super-icon {
  color: var(--success);
}

.super-card.it .super-icon {
  color: #8b5cf6;
}

.super-info {
  flex: 1;
  min-width: 0;
}

.super-label {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.super-value {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  word-break: break-word;
}

.super-value.empty {
  color: var(--text-dim);
  font-weight: 400;
}

/* ==========================================================================
   كارت جدول أعضاء الفريق (Team Table Card)
   ========================================================================== */
.team-table-card {
  overflow: hidden;
  border-radius: var(--radius-md);
}

.card-topbar {
  padding: 12px 16px;
  background-color: var(--bg-card-subtle);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.card-topbar h2 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-topbar h2 svg {
  width: 15px;
  height: 15px;
  color: var(--blue-text);
}

.members-counter {
  font-size: 0.68rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-weight: 500;
}

.actions-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* أزرار الإجراءات الثانوية */
.btn-secondary {
  height: 32px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0 11px;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
}

.btn-secondary:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-light);
}

.btn-secondary svg {
  width: 13px;
  height: 13px;
  color: var(--text-muted);
}

/* الجدول */
.table-wrapper {
  overflow-x: auto;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

.roster-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.82rem;
}

.roster-table th {
  background-color: var(--bg-card-subtle);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.74rem;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.roster-table th.col-serial {
  width: 40px;
  text-align: center;
}

.roster-table th.col-code {
  width: 90px;
}

.roster-table th.col-role {
  width: 100px;
}

.roster-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

.roster-table td:first-child {
  text-align: center;
  color: var(--text-dim);
  font-family: monospace;
  font-size: 0.76rem;
}

.roster-table tr:last-child td {
  border-bottom: none;
}

.roster-table tr:hover td {
  background-color: var(--bg-hover);
}

/* تمييز صف الطالب المستعلم عنه */
.roster-table tr.highlight-student {
  background-color: var(--blue-soft) !important;
}

.roster-table tr.highlight-student td {
  font-weight: 600;
  color: var(--blue-text);
  border-top: 1px solid var(--blue-border);
  border-bottom: 1px solid var(--blue-border);
}

.roster-table tr.highlight-student td:first-child {
  border-right: 3px solid var(--blue-accent);
}

/* الشارات داخل الجدول */
.badge-role {
  font-size: 0.68rem;
  padding: 2px 7px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card-subtle);
  color: var(--text-dim);
}

.badge-role.leader {
  border-color: rgba(217, 119, 6, 0.4);
  background-color: var(--warning-bg);
  color: var(--warning);
}

.badge-role.leader svg {
  width: 10px;
  height: 10px;
}

.badge-you {
  background-color: var(--primary-gray);
  border: 1px solid var(--primary-gray-border);
  color: #ffffff;
  font-size: 0.66rem;
  font-weight: 600;
  padding: 2px 6px;
}

.badge-you svg {
  width: 9px;
  height: 9px;
}

/* ==========================================================================
   الفوتر
   ========================================================================== */
.app-footer {
  border-top: 1px solid var(--border-color);
  padding: 14px 0;
  margin-top: auto;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-dim);
  background-color: var(--bg-card);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(2px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   الطباعة (Print)
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .app-header,
  .search-card,
  .actions-group,
  .app-footer,
  .alert-box {
    display: none !important;
  }

  .results-container {
    display: block !important;
  }

  .results-header-card,
  .team-table-card,
  .super-card {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
    color: #000000 !important;
    page-break-inside: avoid;
  }

  .project-title,
  .super-value,
  .card-topbar h2,
  .roster-table td {
    color: #000000 !important;
  }

  .roster-table th {
    background: #f1f5f9 !important;
    color: #000000 !important;
    border-bottom: 2px solid #000000 !important;
  }
}

/* ==========================================================================
   التجاوب مع شاشات الهواتف المحمولة وتصغير العناصر
   ========================================================================== */
@media (max-width: 768px) {
  .container {
    padding: 0 12px;
  }

  .main-content {
    padding: 16px 0 28px;
  }

  .app-header {
    padding: 10px 0;
  }

  .brand-icon-wrapper {
    width: 32px;
    height: 32px;
  }

  .brand-icon-wrapper svg {
    width: 17px;
    height: 17px;
  }

  .brand-title {
    font-size: 0.9rem;
  }

  .brand-subtitle {
    font-size: 0.68rem;
  }

  .theme-toggle-btn {
    height: 28px;
    padding: 0 8px;
    font-size: 0.7rem;
  }

  .header-tag {
    font-size: 0.66rem;
    padding: 3px 8px;
  }

  .search-card {
    padding: 16px 14px;
    margin-bottom: 16px;
    border-radius: 10px;
  }

  .search-intro {
    margin-bottom: 12px;
  }

  .search-intro h2 {
    font-size: 1rem;
  }

  .search-intro p {
    font-size: 0.75rem;
  }

  .search-input {
    height: 38px;
    font-size: 0.92rem;
    padding: 6px 34px 6px 10px;
    border-radius: 7px;
  }

  .btn-search {
    height: 36px;
    font-size: 0.85rem;
    border-radius: 7px;
  }

  .search-card.compact {
    padding: 10px 12px;
    margin-bottom: 12px;
  }

  .search-card.compact .search-inputs-row {
    flex-direction: row;
    gap: 6px;
  }

  .search-card.compact .search-input {
    height: 38px;
    padding: 6px 32px 6px 8px;
  }

  .search-card.compact .btn-search {
    height: 38px;
    padding: 0 14px;
    font-size: 0.82rem;
  }

  .student-banner-card {
    padding: 12px 14px;
    margin-bottom: 10px;
    border-radius: 10px;
  }

  .student-avatar {
    width: 36px;
    height: 36px;
  }

  .student-avatar svg {
    width: 18px;
    height: 18px;
  }

  .student-name {
    font-size: 1.02rem;
    margin-bottom: 4px;
  }

  .meta-tag {
    font-size: 0.68rem;
    padding: 2px 7px;
  }

  .key-stats-grid {
    gap: 8px;
    margin-bottom: 10px;
  }

  .stat-card {
    padding: 12px 14px;
    border-radius: 10px;
  }

  .stat-label {
    font-size: 0.72rem;
  }

  .stat-icon-wrapper {
    width: 28px;
    height: 28px;
  }

  .stat-icon-wrapper svg {
    width: 14px;
    height: 14px;
  }

  .stat-big-number {
    font-size: 1.85rem;
  }

  .stat-num-prefix {
    font-size: 0.8rem;
  }

  .stat-card-bottom {
    font-size: 0.68rem;
    padding-top: 6px;
    margin-top: 6px;
  }

  .project-title-card,
  .results-header-card {
    padding: 12px 14px;
    margin-bottom: 10px;
    border-radius: 10px;
  }

  .project-title {
    font-size: 1rem;
  }

  .supervisors-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 10px;
  }

  .super-card {
    padding: 10px 12px;
    border-radius: 8px;
  }

  .super-icon {
    width: 30px;
    height: 30px;
  }

  .super-icon svg {
    width: 15px;
    height: 15px;
  }

  .super-label {
    font-size: 0.65rem;
  }

  .super-value {
    font-size: 0.82rem;
  }

  .team-table-card {
    border-radius: 10px;
  }

  .card-topbar {
    padding: 10px 12px;
  }

  .card-topbar h2 {
    font-size: 0.86rem;
  }

  .btn-secondary {
    height: 28px;
    padding: 0 9px;
    font-size: 0.72rem;
    border-radius: 7px;
  }

  .roster-table th,
  .roster-table td {
    padding: 7px 9px;
    font-size: 0.76rem;
  }

  .roster-table th.col-serial {
    width: 34px;
  }

  .roster-table th.col-code {
    width: 78px;
  }

  .roster-table th.col-role {
    width: 90px;
  }
}

@media (max-width: 480px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 10px;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .key-stats-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .stat-card {
    padding: 12px 14px;
  }

  .card-topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .actions-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .btn-secondary {
    justify-content: center;
  }

  .roster-table th,
  .roster-table td {
    padding: 6px 6px;
    font-size: 0.73rem;
  }

  .roster-table th.col-code {
    width: 72px;
  }

  .roster-table th.col-role {
    width: 82px;
  }
}