/* ========================================
   أكاديمية الفلاح - الملف الخارجي للتصميم
   الإصدار: 1.0
   التاريخ: 2026
   ======================================== */

/* ===== المتغيرات العامة ===== */
:root {
  --primary: #166534;
  --primary-hover: #14532d;
  --primary-light: #dcfce7;
  --primary-soft: #22c55e;
  --secondary: #b8942e;
  --secondary-light: #fcd34d;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --text-main: #111827;
  --text-muted: #4b5563;
  --text-faint: #6b7280;
  --border: #e5e7eb;
  --border-hover: #d1d5db;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.10);
  --shadow-xl: 0 12px 32px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --container: 1120px;
  --nav-h: 68px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== الوضع الداكن ===== */
[data-theme="dark"] {
  --bg: #0f1419;
  --surface: #1a1f2e;
  --surface-alt: #151a27;
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --border: #232b3a;
  --border-hover: #334155;
  --primary-light: #0a2e1a;
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
  --shadow-xl: 0 12px 32px rgba(0,0,0,0.5);
}

/* ===== الأساسيات ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  font-family: 'Tajawal', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s ease, color 0.4s ease;
}

a { text-decoration: none; color: inherit; }
img, svg { display: block; max-width: 100%; }
ul { list-style: none; }

.container {
  width: 90%;
  max-width: var(--container);
  margin: 0 auto;
}

/* ===== شريط التنقل ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.3s ease;
}
[data-theme="dark"] .navbar {
  background: rgba(15, 20, 25, 0.94);
}
.navbar.scrolled {
  box-shadow: var(--shadow-md);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--text-main);
  transition: color 0.4s ease;
}
.brand-icon {
  width: 40px;
  height: 40px;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  transition: var(--transition-bounce);
}
.brand:hover .brand-icon {
  transform: scale(1.05) rotate(-5deg);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-links {
  display: flex;
  gap: 1.6rem;
  margin-left: 1rem;
}
.nav-links a {
  font-weight: 500;
  font-size: 0.98rem;
  color: var(--text-muted);
  transition: var(--transition);
  padding: 0.3rem 0;
  position: relative;
}
.nav-links a:hover { color: var(--primary); }
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 0;
  height: 2px;
  background: var(--secondary);
  transition: width 0.3s ease;
  border-radius: 1px;
}
.nav-links a:hover::after { width: 100%; }

.theme-toggle {
  width: 40px;
  height: 40px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: var(--transition);
}
.theme-toggle:hover {
  color: var(--secondary);
  border-color: var(--secondary);
  background: var(--surface);
  transform: scale(1.05);
}
.theme-toggle .fa-sun { display: none; }
.theme-toggle .fa-moon { display: inline-block; }
[data-theme="dark"] .theme-toggle .fa-sun { display: inline-block; }
[data-theme="dark"] .theme-toggle .fa-moon { display: none; }

.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.2rem;
  transition: var(--transition);
}
.mobile-menu-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 999;
  box-shadow: var(--shadow-lg);
}
.mobile-menu.active {
  display: flex;
}
.mobile-menu a {
  padding: 0.8rem 1rem;
  color: var(--text-muted);
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.mobile-menu a:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* ===== القسم الرئيسي ===== */
.hero {
  padding-top: calc(var(--nav-h) + 80px);
  padding-bottom: 80px;
  text-align: center;
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--bg) 100%);
  transition: background 0.4s ease;
}
.hero h1 {
  font-size: clamp(1.9rem, 4.2vw, 2.8rem);
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 1rem;
  line-height: 1.3;
}
.hero h1 span { color: var(--secondary); }
.hero p {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  padding: 0.85rem 2rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1.05rem;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: var(--transition-bounce);
}
.btn:hover {
  background: var(--primary-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.btn:active { transform: translateY(0); }
.btn i { font-size: 0.9rem; transition: transform 0.25s ease; }
.btn:hover i { transform: translateX(-5px); }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; width: 100%; }

/* ===== قسم المنح الدراسية ===== */
.scholarships {
  padding: 80px 0;
}
.section-header {
  text-align: center;
  margin-bottom: 2.5rem;
}
.section-header h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  position: relative;
  display: inline-block;
}
.section-header h2::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 30%;
  left: 30%;
  height: 3px;
  background: var(--secondary);
  border-radius: 2px;
}
.section-header p {
  color: var(--text-muted);
  max-width: 620px;
  margin: 1rem auto 0;
  font-size: 1.05rem;
}

.scholarships-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.8rem;
}
@media (min-width: 769px) {
  .scholarships-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.scholarship-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition-slow);
  position: relative;
}
.scholarship-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s ease;
}
.scholarship-card:hover::before {
  transform: scaleX(1);
  transform-origin: left;
}
.scholarship-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
  border-color: transparent;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem 1.5rem;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}
.flag-img {
  width: 48px;
  height: 36px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.country-name {
  font-weight: 700;
  font-size: 1rem;
  flex: 1;
}
.status {
  padding: 0.25rem 0.7rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
}
.status.active {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.status.expired {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.card-body {
  padding: 1.5rem;
}
.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}
.card-excerpt {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.7;
  margin-bottom: 1rem;
}
.card-meta {
  margin-bottom: 1.2rem;
}
.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.3rem 0.8rem;
  background: var(--surface-alt);
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--text-faint);
}

/* ===== قسم التعريف ===== */
.about {
  padding: 80px 0;
}
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.6rem;
  text-align: center;
  transition: var(--transition);
}
.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: transparent;
}
.feature-icon {
  width: 56px;
  height: 56px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.2rem;
  font-size: 1.4rem;
  transition: var(--transition-bounce);
}
.feature-card:hover .feature-icon {
  background: var(--primary);
  color: #fff;
  transform: scale(1.08);
}
.feature-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.feature-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

/* ===== قسم القنوات ===== */
.channels {
  padding: 80px 0;
  background: var(--surface-alt);
  transition: background 0.4s ease;
}
.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.channel-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.6rem;
  text-align: center;
  transition: var(--transition-slow);
  position: relative;
  overflow: hidden;
}
.channel-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: var(--accent);
  opacity: 0;
  transition: var(--transition);
}
.channel-card:hover::before { opacity: 1; }
.channel-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
  border-color: transparent;
}
.channel-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 1.2rem;
  color: #fff;
  transition: var(--transition-bounce);
}
.channel-card:hover .channel-icon {
  transform: scale(1.1) rotate(-3deg);
}
.ch-telegram { --accent: #0088cc; }
.ch-telegram .channel-icon { background: #0088cc; }
.ch-whatsapp { --accent: #25d366; }
.ch-whatsapp .channel-icon { background: #25d366; }
.ch-youtube { --accent: #ff0000; }
.ch-youtube .channel-icon { background: #ff0000; }
.ch-facebook { --accent: #1877f2; }
.ch-facebook .channel-icon { background: #1877f2; }
.ch-instagram { --accent: #e4405f; }
.ch-instagram .channel-icon { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }

.channel-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.channel-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.channel-link {
  font-weight: 600;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.92rem;
  transition: var(--transition);
}
.channel-card:hover .channel-link { gap: 10px; }
.channel-link i {
  font-size: 0.8rem;
  transition: transform 0.25s ease;
}
.channel-card:hover .channel-link i { transform: translateX(-4px); }

/* ===== الفوتر ===== */
.footer {
  padding: 2.5rem 0;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--surface);
  transition: background 0.4s ease, border-color 0.4s ease;
}
.footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.15rem;
  margin-bottom: 0.6rem;
}
.footer-logo i { color: var(--secondary); }
.footer p { color: var(--text-muted); font-size: 0.92rem; }

/* ===== زر العودة للأعلى ===== */
.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-bounce);
  z-index: 99;
  box-shadow: var(--shadow-md);
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}
.back-to-top:hover {
  background: var(--primary-hover);
  transform: translateY(-3px);
}

/* ===== تأثير الظهور ===== */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== تجاوب ===== */
@media (max-width: 768px) {
  :root { --nav-h: 60px; }
  .hero { padding-top: calc(var(--nav-h) + 50px); padding-bottom: 50px; }
  .hero h1 { font-size: 1.6rem; }
  .nav-links { display: none; }
  .mobile-menu-btn { display: flex; }
  .about, .scholarships, .channels { padding: 50px 0; }
  .about-grid,
  .scholarships-grid,
  .channels-grid { grid-template-columns: 1fr; }
  .feature-card, .channel-card, .scholarship-card { padding: 1.5rem; }
  .section-header h2 { font-size: 1.5rem; }
  .card-header { padding: 1rem; }
}
@media (max-width: 480px) {
  .hero h1 { font-size: 1.4rem; }
  .hero p { font-size: 1rem; }
  .btn { padding: 0.7rem 1.5rem; font-size: 0.95rem; }
  .section-header h2 { font-size: 1.35rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
