/* ==========================================
   PrepLearn Platform — Core StyleSheet
   Arabic RTL • Mobile First • Clean UI
   ========================================== */

/* 1. المتغيرات والوضع الافتراضي (الدارك مود الأصلي) */
:root {
  --bg0: #050B1A;
  --bg1: #061229;
  --text: #E8F1FF;
  --muted: #B7C7E6;

  --emerald: #19C37D;
  --emerald2: #22D3A6;
  --sky: #60A5FA;

  --shadow: 0 18px 50px rgba(0, 0, 0, .35);
  --radius: 18px;
  --stroke: rgba(255, 255, 255, .12);
}

/* 2. الإعدادات العامة للمتصفح */
* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  max-width: 100%;
  overflow-x: hidden; /* منع خروج أي عنصر عن حدود الشاشة */
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;
  background: 
    radial-gradient(900px 450px at 20% 5%, rgba(25, 195, 125, .22), transparent 55%),
    radial-gradient(780px 420px at 80% 15%, rgba(96, 165, 250, .18), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  color: var(--text);
  direction: rtl;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* الحاوية الأساسية للمحتوى */
.container {
  width: min(1100px, 92vw);
  margin-inline: auto;
  padding-inline: 10px; /* مسافة أمان لمنع الالتصاق بحواف الموبايل */
  box-sizing: border-box;
}

/* رابط تخطي المحتوى للوصول السريع (Accessibility) */
.skip-link {
  position: absolute;
  inset-inline: 12px;
  top: 10px;
  padding: 10px 14px;
  background: rgba(25, 195, 125, .18);
  border: 1px solid rgba(25, 195, 125, .35);
  border-radius: 12px;
  transform: translateY(-140%);
  transition: transform .2s ease;
  z-index: 9999;
}

.skip-link:focus {
  transform: translateY(0);
  outline: none;
}

/* ==========================================
   3. الـ Header والـ Navigation
   ========================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  background: rgba(5, 11, 26, .65);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: .2px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(25, 195, 125, .14);
  border: 1px solid rgba(25, 195, 125, .35);
  color: var(--emerald2);
  font-size: 18px;
}

.brand-name {
  font-size: 18px;
}

.nav-links {
  display: none;
  gap: 18px;
  align-items: center;
  color: var(--muted);
}

.nav-link {
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .10);
  color: var(--text);
}

.nav-cta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ==========================================
   4. الأزرار (Buttons)
   ========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .14);
  padding: 12px 16px;
  font-weight: 800;
  transition: transform .15s ease, background .2s ease, border-color .2s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
  white-space: nowrap;
}

.btn--small { padding: 10px 14px; border-radius: 12px; font-size: 14px; }
.btn--large { padding: 14px 18px; border-radius: 16px; font-size: 16px; }

.btn--primary {
  background: linear-gradient(135deg, rgba(25, 195, 125, .95), rgba(34, 211, 166, .78));
  border-color: rgba(25, 195, 125, .55);
  color: #04130B;
}

.btn--primary:hover {
  transform: translateY(-1px);
}

.btn--ghost {
  background: rgba(255, 255, 255, .04);
  border-color: rgba(255, 255, 255, .16);
  color: var(--text);
  box-shadow: none;
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, .07);
  transform: translateY(-1px);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, .07);
}

/* ==========================================
   5. قسم الهيرو الرئيسي (Hero Section)
   ========================================== */
.hero {
  padding: 28px 0 6px;
}

.hero-grid {
  display: grid;
  gap: 26px;
  align-items: center;
}

.hero-content {
  order: 2;
}

.eyebrow {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.eyebrow-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: var(--emerald);
  box-shadow: 0 0 0 4px rgba(25, 195, 125, .18);
}

.hero-title {
  margin: 0;
  font-size: clamp(26px, 5.2vw, 44px);
  line-height: 1.18;
  letter-spacing: -.3px;
}

.hero-subtitle {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.hero-actions {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

.hero-checks {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero-checks li {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-weight: 650;
}

.check {
  width: 28px;
  height: 28px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: rgba(25, 195, 125, .14);
  border: 1px solid rgba(25, 195, 125, .35);
  color: var(--emerald2);
  font-size: 14px;
}

.hero-visual {
  order: 1;
}

.visual-card {
  position: relative;
  border-radius: 26px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .10);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.visual-bg {
  position: absolute;
  inset: -2px;
  background: 
    radial-gradient(500px 220px at 15% 20%, rgba(25, 195, 125, .28), transparent 60%),
    radial-gradient(420px 220px at 85% 10%, rgba(96, 165, 250, .22), transparent 58%);
  filter: blur(10px);
  opacity: .8;
}

.vector {
  width: 100%;
  height: auto;
  display: block;
  padding: 18px;
  position: relative;
}

.visual-badges {
  position: absolute;
  inset-inline-start: 16px;
  inset-block-end: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.badge {
  font-size: 13px;
  font-weight: 800;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .18);
  border: 1px solid rgba(255, 255, 255, .14);
  color: #D9EAFF;
  backdrop-filter: blur(8px);
}

/* ==========================================
   6. السكاشن والكروت المتنوعة (Sections & Cards)
   ========================================== */
.section {
  padding: 54px 0;
}

.section--muted {
  padding: 38px 0 64px;
  border-top: 1px solid rgba(255, 255, 255, .06);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  background: rgba(255, 255, 255, .02);
}

.section-header {
  margin-bottom: 18px;
}

.section-title {
  margin: 0;
  font-size: 26px;
}

.section-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.8;
}

.cards {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

.card {
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: var(--radius);
  padding: 18px;
}

.card-icon { font-size: 22px; margin-bottom: 10px; }
.card-title { margin: 0; font-size: 18px; }
.card-text { margin: 10px 0 0; color: var(--muted); line-height: 1.9; }

/* كارت الفلاتر (Directory Filters) */
.filters-card {
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: var(--radius);
  padding: 18px;
}

.filters-grid {
  display: grid;
  gap: 14px;
}

.filters-grid .field--cta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.label {
  color: #D9EAFF;
  font-weight: 800;
  display: flex;
  gap: 10px;
  align-items: center;
}

.control {
  width: 100%;
  border-radius: 14px;
  padding: 12px 12px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(0, 0, 0, .15);
  color: var(--text);
  outline: none;
}

.control:focus {
  border-color: rgba(25, 195, 125, .6);
  box-shadow: 0 0 0 4px rgba(25, 195, 125, .15);
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

/* آراء الطلاب (Testimonials) */
.testimonials-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

.testimonial {
  padding: 18px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .10);
}

.t-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: rgba(25, 195, 125, .14);
  border: 1px solid rgba(25, 195, 125, .35);
  display: grid;
  place-items: center;
  font-weight: 900;
  color: var(--emerald2);
}

.t-name { font-weight: 900; }
.t-stars { color: #FBBF24; font-size: 14px; margin-top: 4px; }
.t-text { margin: 0; color: var(--muted); line-height: 1.9; }

/* الأسئلة الشائعة (FAQ Accordion) */
.accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.acc-item {
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .10);
  overflow: hidden;
}

.acc-btn {
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--text);
  text-align: right;
  padding: 16px 14px;
  font-weight: 900;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.acc-btn i {
  color: var(--emerald2);
  transition: transform .2s ease;
}

.acc-panel {
  max-height: 0px;
  overflow: hidden;
  transition: max-height .25s ease;
  padding: 0 14px;
}

.acc-panel p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.9;
}

/* كروت المدرسين (Teachers Grid) */
.teachers-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

.teacher-card {
  padding: 18px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .10);
}

.teacher-top {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.teacher-avatar {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: rgba(25, 195, 125, .14);
  border: 1px solid rgba(25, 195, 125, .35);
  display: grid;
  place-items: center;
  font-weight: 900;
  color: var(--emerald2);
}

.teacher-meta { display: flex; flex-direction: column; gap: 6px; }
.teacher-name { font-weight: 950; font-size: 18px; }
.teacher-langs { color: var(--muted); font-weight: 700; }

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

.stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(0, 0, 0, .15);
  border: 1px solid rgba(255, 255, 255, .08);
}

.stat-label {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}

.stat-value { color: var(--text); font-weight: 950; font-size: 14px; }
.teacher-bio { margin: 0 0 12px; color: var(--muted); line-height: 1.9; }
.teacher-actions { display: flex; }

/* الحصص المباشرة (Live Classes) */
.live-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

.live-card {
  padding: 18px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .10);
}

.live-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.live-prof { display: flex; flex-direction: column; gap: 6px; }
.live-teacher { font-weight: 950; font-size: 18px; }
.live-sub { color: var(--muted); font-weight: 800; }

.live-time { text-align: right; }
.live-date { font-weight: 950; }
.live-clock { color: var(--muted); font-weight: 800; margin-top: 6px; }

.btn--live {
  background: linear-gradient(135deg, rgba(59, 130, 246, .95), rgba(96, 165, 250, .75));
  border-color: rgba(59, 130, 246, .55);
  color: #04130B;
}

.btn--live:hover { transform: translateY(-1px); }
.live-actions { margin-top: 14px; }

/* ==========================================
   7. الدفع وبوابات الحجز (Booking & Paymob)
   ========================================== */
.booking {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: flex-start;
}

.booking-title { margin: 0; font-size: 24px; }
.booking-text { margin: 10px 0 0; color: var(--muted); line-height: 1.8; }

.paymob-strip {
  margin-top: 18px;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(255, 255, 255, .04);
  padding: 16px;
}

.paymob-title {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 900;
  margin-bottom: 12px;
}

.paymob-icons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.paymob-icon {
  flex: 1 1 170px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  padding: 12px 10px;
  border-radius: 16px;
  background: rgba(0, 0, 0, .15);
  border: 1px solid rgba(255, 255, 255, .12);
  color: var(--muted);
  font-weight: 900;
}

.paymob-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

/* ==========================================
   8. النوافذ المنبثقة (Modals & Forms)
   ========================================== */
/* الخلفية المعتمة للنافذة */
.modal-overlay {
  position: fixed;
  inset: 0; /* تغطي كامل الشاشة */
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85); /* تعتيم أقوى */
  backdrop-filter: blur(8px); /* تأثير ضبابي للخلفية */
  z-index: 999999 !important; /* رقم ضخم لضمان الظهور فوق الـ Header */
  display: none; /* مخفي افتراضياً */
  align-items: center; /* توسيط عمودي */
  justify-content: center; /* توسيط أفقي */
  padding: 20px;
  box-sizing: border-box;
}

/* عندما تكون النافذة مفتوحة */
.modal-overlay.is-open {
  display: flex !important; /* نستخدم Flex للتوسيط المثالي */
}

/* جسم النافذة المنبثقة */
.modal {
  position: relative;
  width: min(500px, 100%); /* عرض مرن للموبايل */
  background: #061229; /* لون الخلفية الداكن الخاص بك */
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  animation: modalFadeIn 0.3s ease-out; /* حركة دخول ناعمة */
}

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

/* منع تمرير الصفحة خلف النافذة */
body.modal-open {
  overflow: hidden !important;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 16px 0;
}

.modal-title { margin: 0; font-size: 22px; }
.modal-subtitle { margin: 8px 0 14px; color: var(--muted); line-height: 1.7; }
.modal-body { padding: 0 16px 16px; max-height: 85vh; overflow-y: auto; }

.form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

.field--full {
  grid-column: 1 / -1;
}

.modal-actions {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.modal-actions--spread {
  justify-content: space-between;
}

.checkrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 700;
}

.checkrow input {
  accent-color: var(--emerald2);
}

.link-muted {
  color: #CFE0FF;
  font-weight: 900;
  opacity: .9;
}

.link-muted:hover {
  opacity: 1;
  text-decoration: underline;
}

.form-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.paymob-inline {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(0, 0, 0, .15);
  padding: 12px;
}

.paymob-inline-title {
  font-weight: 900;
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.paymob-inline-icons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.paymob-inline-item {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex: 1 1 160px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .10);
  color: var(--muted);
  font-weight: 900;
}

/* ==========================================
   9. التذييل (Footer)
   ========================================== */
.main-footer {
  padding: 40px 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
  background: rgba(0, 0, 0, .10);
  color: var(--muted);
}

.footer-container {
  width: min(1100px, 92vw);
  margin-inline: auto;
  padding-inline: 10px;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 26px;
}

.footer-title {
  margin: 0;
  font-size: 22px;
  font-weight: 1000;
  color: #D9EAFF;
  letter-spacing: -.2px;
}

.footer-desc {
  margin: 10px 0 0;
  font-weight: 850;
  line-height: 1.8;
  color: rgba(183, 199, 230, .95);
  max-width: 40ch;
}

.footer-links-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 1000;
  color: #CFE0FF;
}

.footer-links-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links-list a {
  display: inline-block;
  color: rgba(183, 199, 230, .98);
  font-weight: 950;
  line-height: 1.6;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(255, 255, 255, .02);
  transition: background .2s ease, border-color .2s ease, color .2s ease, transform .15s ease;
}

.footer-links-list a:hover {
  color: var(--text);
  border-color: rgba(96, 165, 250, .35);
  background: rgba(96, 165, 250, .10);
  transform: translateY(-1px);
  text-decoration: none;
}

.copy-text {
  margin: 0;
  color: #CFE0FF;
  font-weight: 1000;
  line-height: 1.9;
}

.dev-text {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.9;
  font-weight: 850;
  color: rgba(183, 199, 230, .92);
}

.dev-name {
  color: rgba(34, 211, 166, .95);
  font-weight: 1000;
}

/* ==========================================
   10. الشاشات الكبيرة والمستجيبة (Responsive Rules)
   ========================================== */

/* أجهزة الكمبيوتر والشاشات الكبيرة من 860 بكسل فما فوق */
@media (min-width: 860px) {
  .nav-links { display: flex; }
  .hero-grid { grid-template-columns: 1.05fr .95fr; }
  .hero-content { order: 1; }
  .hero-visual { order: 2; }
  .hero-actions { flex-direction: row; align-items: center; }
  .hero-checks { flex-direction: row; gap: 16px; flex-wrap: wrap; }
  .cards { grid-template-columns: repeat(3, 1fr); }
  .filters-grid { grid-template-columns: 1fr 1fr 1fr 1.2fr; }
  .testimonials-grid { grid-template-columns: repeat(3, 1fr); }
  .form-grid { grid-template-columns: 1fr 1fr; }
}

/* شاشات التابلت والموبايل من 768 بكسل وأصغر */
@media (max-width: 768px) {
  .footer-container {
    justify-content: center; /* توسيط محاذاة الفوتر */
    text-align: center;      /* توسيط الكلام على الموبايل لراحة العين */
  }
}

/* شاشات الموبايل المتوسطة من 700 بكسل وأصغر */
@media (max-width: 700px) {
  .footer-col {
    min-width: 100%;
    flex-basis: 100%;
  }
}

/* شاشات الموبايل الصغيرة والضيقة جداً من 480 بكسل وأصغر */
@media (max-width: 480px) {
  .footer-col {
    min-width: 100% !important;
    flex-basis: 100% !important;
  }
  .paymob-icons, .paymob-inline-icons {
    flex-direction: column !important;
    gap: 10px !important;
  }
  .paymob-icon, .paymob-inline-item {
    width: 100% !important;
    flex: 1 1 100% !important;
  }
  .hero-actions .btn {
    width: 100% !important; /* جعل أزرار الهيرو ممتدة عمودياً */
  }
}

/* ==========================================
   11. تحسينات التصفح والأداء (Performance Fixes)
   ========================================== */

/* حل مشكلة توافق الجداول لصفحات الإدارة والمدرسين */
.table-responsive, div:has(table) {
  width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

table {
  max-width: 100%;
}

/* دعم الأجهزة الضعيفة وإلغاء الأنيميشن لو المستخدم مفعل ذلك في جهازه */
@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .acc-panel { transition: none; }
}