/**
 * ثيم موحد للمدرسة — شكل احترافي خرافي
 * يُستخدم في: لوحة المعلم، لوحة الطالب، صفحات الدخول، الامتحانات
 */
:root {
  --school-primary: #c41e3a;
  --school-primary-light: #e11d48;
  --school-primary-dark: #9b1630;
  --school-gold: #d4a84b;
  --school-gold-light: #e8c56a;
  --school-ink: #0f172a;
  --school-ink-2: #1e293b;
  --school-muted: #64748b;
  --school-surface: #ffffff;
  --school-surface-2: #f8fafc;
  --school-surface-3: #f1f5f9;
  --school-border: #e2e8f0;
  --school-success: #059669;
  --school-warning: #d97706;
  --school-danger: #dc2626;
  --school-info: #0284c7;

  --school-gradient: linear-gradient(135deg, #c41e3a 0%, #9b1630 100%);
  --school-gradient-soft: linear-gradient(160deg, #fef2f2 0%, #fff7ed 50%, #f8fafc 100%);
  --school-shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --school-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --school-shadow-lg: 0 16px 48px rgba(15, 23, 42, 0.12);
  --school-radius: 14px;
  --school-radius-lg: 20px;
  --school-radius-xl: 26px;
  --school-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }
body.theme-school {
  font-family: 'Cairo', system-ui, sans-serif;
  background: var(--school-gradient-soft);
  color: var(--school-ink);
  margin: 0;
  min-height: 100vh;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ═══ لوحة / صفحة داخلية ═══ */
.theme-school .panel-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}
.theme-school .panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--school-border);
}
.theme-school .panel-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--school-ink);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.theme-school .panel-title i { color: var(--school-primary); }
.theme-school .panel-subtitle {
  color: var(--school-muted);
  font-size: 0.95rem;
  margin: 0.25rem 0 0;
}

/* ═══ كروت الخدمات (شكل خرافي) ═══ */
.theme-school .service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.theme-school .service-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--school-surface);
  border-radius: var(--school-radius-lg);
  padding: 1.5rem 1.35rem;
  border: 1px solid var(--school-border);
  box-shadow: var(--school-shadow-sm);
  transition: transform var(--school-transition), box-shadow var(--school-transition), border-color var(--school-transition);
  position: relative;
  overflow: hidden;
}
.theme-school .service-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: var(--school-gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--school-transition);
}
.theme-school .service-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--school-shadow-lg);
  border-color: rgba(196, 30, 58, 0.2);
}
.theme-school .service-card:hover::before { transform: scaleX(1); }
.theme-school .service-card .card-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--school-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 1rem;
  box-shadow: 0 8px 20px rgba(196, 30, 58, 0.25);
  transition: transform var(--school-transition);
}
.theme-school .service-card:hover .card-icon { transform: scale(1.08) rotate(-3deg); }
.theme-school .service-card .card-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--school-ink);
  margin: 0 0 0.35rem;
}
.theme-school .service-card .card-desc {
  font-size: 0.9rem;
  color: var(--school-muted);
  margin: 0;
  line-height: 1.6;
}

/* ═══ إحصائيات مصغرة ═══ */
.theme-school .stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.theme-school .stat-mini {
  background: var(--school-surface);
  border-radius: var(--school-radius);
  padding: 1rem;
  text-align: center;
  border: 1px solid var(--school-border);
  box-shadow: var(--school-shadow-sm);
  transition: transform var(--school-transition);
}
.theme-school .stat-mini:hover { transform: translateY(-3px); }
.theme-school .stat-mini .num {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--school-primary);
  display: block;
  line-height: 1.2;
}
.theme-school .stat-mini .label { font-size: 0.8rem; color: var(--school-muted); font-weight: 700; }

/* ═══ أزرار ═══ */
.theme-school .btn-school {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.35rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.theme-school .btn-school:hover { transform: translateY(-2px); }
.theme-school .btn-school-primary {
  background: var(--school-gradient);
  color: #fff;
  box-shadow: 0 6px 20px rgba(196, 30, 58, 0.3);
}
.theme-school .btn-school-primary:hover { box-shadow: 0 10px 28px rgba(196, 30, 58, 0.4); }
.theme-school .btn-school-outline {
  background: transparent;
  color: var(--school-ink);
  border: 2px solid var(--school-border);
}
.theme-school .btn-school-outline:hover { border-color: var(--school-primary); color: var(--school-primary); }
.theme-school .btn-school-ghost {
  background: var(--school-surface-2);
  color: var(--school-muted);
}
.theme-school .btn-school-ghost:hover { background: var(--school-surface-3); color: var(--school-ink); }

/* ═══ كروت محتوى (بيانات، ملخص) ═══ */
.theme-school .content-card {
  background: var(--school-surface);
  border-radius: var(--school-radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--school-border);
  box-shadow: var(--school-shadow-sm);
}
.theme-school .content-card h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--school-ink);
  margin: 0 0 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--school-border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.theme-school .content-card h3 i { color: var(--school-primary); }

/* ═══ شبكة روابط سريعة ═══ */
.theme-school .quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}
.theme-school .quick-links a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  background: var(--school-surface-2);
  border: 1px solid var(--school-border);
  border-radius: 12px;
  color: var(--school-ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all var(--school-transition);
}
.theme-school .quick-links a:hover {
  border-color: var(--school-primary);
  background: #fef2f2;
  color: var(--school-primary);
}

/* ═══ تسجيل خروج ═══ */
.theme-school .logout-area {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--school-border);
  text-align: center;
}
.theme-school .logout-area a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  background: var(--school-surface-2);
  color: var(--school-muted);
  text-decoration: none;
  border-radius: 12px;
  font-weight: 700;
  transition: background 0.2s, color 0.2s;
}
.theme-school .logout-area a:hover { background: #fee2e2; color: var(--school-danger); }

/* ═══ شريط علوي (للوحة) ═══ */
.theme-school .top-bar {
  background: var(--school-surface);
  border-bottom: 1px solid var(--school-border);
  padding: 0.85rem 1rem;
  margin: -1.5rem -1rem 1.5rem -1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  box-shadow: var(--school-shadow-sm);
}
.theme-school .top-bar .brand {
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--school-ink);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  color: inherit;
}
.theme-school .top-bar .brand i { color: var(--school-primary); }
.theme-school .top-bar .user-name { font-weight: 700; color: var(--school-muted); font-size: 0.9rem; }

/* ═══ امتحان أونلاين — بطاقة امتحان ═══ */
.theme-school .exam-card {
  background: var(--school-surface);
  border-radius: var(--school-radius-lg);
  padding: 1.35rem;
  border: 1px solid var(--school-border);
  box-shadow: var(--school-shadow-sm);
  margin-bottom: 1rem;
  transition: all var(--school-transition);
}
.theme-school .exam-card:hover { box-shadow: var(--school-shadow); border-color: rgba(196, 30, 58, 0.2); }
.theme-school .exam-card .exam-title { font-size: 1.15rem; font-weight: 800; margin: 0 0 0.5rem; color: var(--school-ink); }
.theme-school .exam-card .exam-meta { font-size: 0.85rem; color: var(--school-muted); margin: 0; }
.theme-school .exam-card .exam-badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 0.5rem;
}
.theme-school .exam-card .exam-badge.available { background: #d1fae5; color: var(--school-success); }
.theme-school .exam-card .exam-badge.done { background: var(--school-surface-3); color: var(--school-muted); }
.theme-school .exam-card .exam-badge.expired { background: #fee2e2; color: var(--school-danger); }

/* ═══ نموذج أسئلة الامتحان ═══ */
.theme-school .question-block {
  background: var(--school-surface);
  border-radius: var(--school-radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--school-border);
  box-shadow: var(--school-shadow-sm);
}
.theme-school .question-block .q-text { font-weight: 700; font-size: 1.05rem; margin-bottom: 0.75rem; color: var(--school-ink); }
.theme-school .question-block .q-options { margin: 0; padding: 0; list-style: none; }
.theme-school .question-block .q-options li {
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  border: 2px solid var(--school-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.theme-school .question-block .q-options li:hover { border-color: var(--school-primary-light); background: #fef2f2; }
.theme-school .question-block .q-options li.selected { border-color: var(--school-primary); background: #fef2f2; }

/* ═══ تنبيهات ═══ */
.theme-school .alert-school {
  padding: 1rem 1.25rem;
  border-radius: var(--school-radius);
  margin-bottom: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.theme-school .alert-school.success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.theme-school .alert-school.warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.theme-school .alert-school.danger { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.theme-school .alert-school.info { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }

/* ═══ رابط العودة ═══ */
.theme-school .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
  color: var(--school-primary);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  transition: color 0.2s, transform 0.15s;
}
.theme-school .back-link:hover { color: var(--school-primary-dark); }

/* ═══ قائمة عناصر (واجبات، مرفقات، سجلات) ═══ */
.theme-school .list-items { list-style: none; margin: 0; padding: 0; }
.theme-school .list-item {
  border-bottom: 1px solid var(--school-border);
  padding: 1rem 0;
  transition: background 0.2s;
}
.theme-school .list-item:last-child { border-bottom: none; }
.theme-school .list-item:hover { background: var(--school-surface-2); }
.theme-school .list-item .item-title { font-weight: 800; font-size: 1.05rem; color: var(--school-ink); margin: 0 0 0.25rem; }
.theme-school .list-item .item-meta { font-size: 0.9rem; color: var(--school-muted); margin: 0; }
.theme-school .list-item .item-desc { margin: 0.5rem 0 0; font-size: 0.95rem; line-height: 1.6; color: var(--school-ink-2); }
.theme-school .list-item .item-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  background: #d1fae5;
  color: var(--school-success);
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  transition: background 0.2s, transform 0.15s;
}
.theme-school .list-item .item-link:hover { background: #a7f3d0; }
.theme-school .list-item .item-badge { display: inline-block; padding: 0.25rem 0.65rem; border-radius: 999px; font-size: 0.8rem; font-weight: 700; margin-top: 0.35rem; }
.theme-school .list-item .item-badge.success { background: #d1fae5; color: #065f46; }
.theme-school .list-item .item-badge.warning { background: #fef3c7; color: #92400e; }
.theme-school .list-item .item-badge.danger { background: #fee2e2; color: #b91c1c; }

/* ═══ جدول منسق ═══ */
.theme-school .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--school-radius); }
.theme-school .table-school { width: 100%; border-collapse: collapse; min-width: 320px; font-size: 0.95rem; }
.theme-school .table-school th,
.theme-school .table-school td { padding: 0.85rem 1rem; text-align: right; border-bottom: 1px solid var(--school-border); }
.theme-school .table-school th { background: var(--school-surface-2); font-weight: 800; color: var(--school-ink); }
.theme-school .table-school tr:hover td { background: var(--school-surface-2); }
.theme-school .table-school .badge-school {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}
.theme-school .table-school .badge-school.present { background: #d1fae5; color: #166534; }
.theme-school .table-school .badge-school.absent { background: #fee2e2; color: #991b1b; }
.theme-school .table-school .badge-school.late { background: #fef3c7; color: #92400e; }
.theme-school .table-school .badge-school.excused,
.theme-school .table-school .badge-school.apologized { background: #e0e7ff; color: #3730a3; }

/* ═══ نماذج (form) ═══ */
.theme-school .form-group { margin-bottom: 1.1rem; }
.theme-school .form-group label { display: block; font-weight: 700; margin-bottom: 0.4rem; color: var(--school-ink); font-size: 0.95rem; }
.theme-school .form-group input,
.theme-school .form-group select,
.theme-school .form-group textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--school-border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s;
}
.theme-school .form-group input:focus,
.theme-school .form-group textarea:focus,
.theme-school .form-group select:focus {
  outline: none;
  border-color: var(--school-primary);
}

/* ═══ صفحة دخول (طالب / معلم) ═══ */
.theme-school.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 45%, #334155 100%);
}
.theme-school.login-page .login-box {
  width: 100%;
  max-width: 420px;
  background: var(--school-surface);
  border-radius: var(--school-radius-xl);
  padding: 2rem 1.75rem;
  box-shadow: var(--school-shadow-lg);
  border: 1px solid var(--school-border);
}
.theme-school.login-page .login-box .login-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  background: var(--school-gradient);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: #fff;
  box-shadow: 0 10px 24px rgba(196, 30, 58, 0.3);
}
.theme-school.login-page .login-box h1 { text-align: center; font-size: 1.45rem; font-weight: 800; margin: 0 0 0.35rem; color: var(--school-ink); }
.theme-school.login-page .login-box .login-sub { text-align: center; font-size: 0.95rem; color: var(--school-muted); margin: 0 0 1.5rem; }
.theme-school.login-page .login-box .err {
  background: #fef2f2;
  color: var(--school-danger);
  padding: 0.85rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  text-align: center;
  border: 1px solid #fecaca;
}
.theme-school.login-page .login-box .btn-login {
  width: 100%;
  padding: 1rem;
  margin-top: 1.25rem;
  background: var(--school-gradient);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s, box-shadow 0.2s;
}
.theme-school.login-page .login-box .btn-login:hover { box-shadow: 0 8px 24px rgba(196, 30, 58, 0.35); transform: translateY(-2px); }
.theme-school.login-page .login-box .login-footer { text-align: center; margin-top: 1.25rem; font-size: 0.9rem; color: var(--school-muted); }
.theme-school.login-page .login-box .login-footer a { color: var(--school-primary); text-decoration: none; font-weight: 700; }

@media (max-width: 600px) {
  .theme-school .panel-wrap { padding: 1rem 0.75rem 1.5rem; }
  .theme-school .panel-title { font-size: 1.35rem; }
  .theme-school .service-grid { grid-template-columns: 1fr; }
  .theme-school .stats-row { grid-template-columns: repeat(2, 1fr); }
  .theme-school .quick-links { grid-template-columns: 1fr; }
}
