/* ===================================================
   مفهوم للمدارس — نظام التصميم البصري
   Mafhooom Schools — Design System
   =================================================== */

/* --- Google Fonts Fallback (until self-hosted) --- */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap');

/* --- CSS Custom Properties (Design Tokens) --- */
:root {
  /* Brand Colors */
  --color-navy: #1A237E;
  --color-navy-light: #283593;
  --color-purple: #673AB7;
  --color-purple-light: #7E57C2;
  --color-purple-dark: #512DA8;
  --color-gold: #FFC107;
  --color-gold-light: #FFD54F;
  --color-gold-dark: #FFA000;

  /* Neutral Colors */
  --color-white: #FFFFFF;
  --color-bg: #F8F9FA;
  --color-bg-alt: #F0F2F5;
  --color-text: #1A1A2E;
  --color-text-secondary: #4A4A6A;
  --color-text-muted: #8E8EA0;
  --color-border: #E2E8F0;

  /* Status Colors */
  --color-success: #4CAF50;
  --color-error: #F44336;

  /* Typography */
  --font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  --font-size-4xl: 2.5rem;
  --font-size-5xl: 3.5rem;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.15);
  --shadow-glow-purple: 0 4px 30px rgba(103, 58, 183, 0.3);
  --shadow-glow-gold: 0 4px 20px rgba(255, 193, 7, 0.3);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* Layout */
  --container-max: 1200px;
  --header-height: 72px;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
  direction: rtl;
  text-align: right;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  color: var(--color-purple);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-purple-light);
}

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

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  font-weight: 700;
  color: var(--color-navy);
}

/* --- Utilities --- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.section-title {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  text-align: center;
  margin-bottom: var(--space-md);
  color: var(--color-navy);
}

.section-subtitle {
  font-size: var(--font-size-lg);
  text-align: center;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-3xl);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.gold-accent {
  color: var(--color-gold-dark);
}

/* --- Header / Navigation --- */
.site-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
  z-index: 1000;
  transition: box-shadow var(--transition-base);
}

.site-header.scrolled {
  box-shadow: var(--shadow-md);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.header-title {
  font-size: var(--font-size-xl);
  font-weight: 800;
  color: var(--color-navy);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.nav-links a {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--color-purple);
  background: rgba(103, 58, 183, 0.08);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-navy);
  margin: 5px 0;
  transition: all var(--transition-fast);
  border-radius: 2px;
}

/* --- Hero Section --- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-purple) 50%, var(--color-purple-dark) 100%);
  padding-top: var(--header-height);
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 80%;
  height: 150%;
  background: radial-gradient(circle, rgba(255, 193, 7, 0.12) 0%, transparent 60%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -20%;
  width: 60%;
  height: 80%;
  background: radial-gradient(circle, rgba(103, 58, 183, 0.2) 0%, transparent 60%);
  pointer-events: none;
}

.hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3xl);
  position: relative;
  z-index: 1;
}

.hero-content {
  flex: 1;
  max-width: 600px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-full);
  color: var(--color-gold);
  font-size: var(--font-size-sm);
  font-weight: 600;
  margin-bottom: var(--space-xl);
}

.hero h1 {
  font-size: var(--font-size-5xl);
  font-weight: 800;
  color: var(--color-white);
  line-height: 1.2;
  margin-bottom: var(--space-lg);
}

.hero h1 .highlight {
  background: linear-gradient(135deg, var(--color-gold), var(--color-gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: var(--font-size-lg);
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.8;
  margin-bottom: var(--space-2xl);
}

.hero-actions {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.hero-visual {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-logo-container {
  position: relative;
  width: 320px;
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-logo-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: pulse-glow 3s ease-in-out infinite;
}

.hero-logo-container::after {
  content: '';
  position: absolute;
  inset: -20px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.05);
  animation: pulse-glow 3s ease-in-out infinite 0.5s;
}

.hero-logo {
  width: 220px;
  height: 220px;
  object-fit: contain;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 8px 30px rgba(0, 0, 0, 0.3));
}

@keyframes pulse-glow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.7; }
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.875rem 2rem;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: 700;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-gold), var(--color-gold-dark));
  color: var(--color-navy);
  box-shadow: var(--shadow-glow-gold);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(255, 193, 7, 0.45);
  color: var(--color-navy);
}

.btn-outline {
  background: transparent;
  color: var(--color-white);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
  color: var(--color-white);
  transform: translateY(-2px);
}

.btn-icon {
  width: 20px;
  height: 20px;
}

/* --- Features Section --- */
.features {
  padding: var(--space-4xl) 0;
  background: var(--color-white);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-xl);
}

.feature-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--color-purple), var(--color-gold));
  opacity: 0;
  transition: opacity var(--transition-base);
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}

.feature-card:hover::before {
  opacity: 1;
}

.feature-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-lg);
  font-size: 1.75rem;
}

.feature-icon.purple {
  background: rgba(103, 58, 183, 0.1);
}

.feature-icon.navy {
  background: rgba(26, 35, 126, 0.1);
}

.feature-icon.gold {
  background: rgba(255, 193, 7, 0.1);
}

.feature-icon.green {
  background: rgba(76, 175, 80, 0.1);
}

.feature-icon.blue {
  background: rgba(33, 150, 243, 0.1);
}

.feature-icon.orange {
  background: rgba(255, 152, 0, 0.1);
}

.feature-card h3 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-sm);
}

.feature-card p {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  line-height: 1.7;
}

/* --- CTA Section --- */
.cta-section {
  padding: var(--space-4xl) 0;
  background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-purple) 100%);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta-section::before {
  content: '';
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 193, 7, 0.08) 0%, transparent 50%);
  pointer-events: none;
}

.cta-section h2 {
  color: var(--color-white);
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-md);
  position: relative;
}

.cta-section p {
  color: rgba(255, 255, 255, 0.75);
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-2xl);
  position: relative;
}

.cta-section .btn {
  position: relative;
}

/* --- Footer --- */
.site-footer {
  background: var(--color-navy);
  color: rgba(255, 255, 255, 0.7);
  padding: var(--space-3xl) 0 var(--space-xl);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3xl);
  margin-bottom: var(--space-2xl);
}

.footer-brand {
  max-width: 300px;
}

.footer-brand-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.footer-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.footer-brand-name {
  font-size: var(--font-size-xl);
  font-weight: 800;
  color: var(--color-white);
}

.footer-brand p {
  font-size: var(--font-size-sm);
  line-height: 1.8;
}

.footer-links h4 {
  color: var(--color-white);
  font-size: var(--font-size-base);
  margin-bottom: var(--space-md);
}

.footer-links ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.footer-links a {
  color: rgba(255, 255, 255, 0.6);
  font-size: var(--font-size-sm);
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--color-gold);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-size-xs);
}

.footer-bottom a {
  color: var(--color-gold);
}

/* --- Page Header (for inner pages) --- */
.page-header {
  background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-purple) 100%);
  padding: calc(var(--header-height) + var(--space-3xl)) 0 var(--space-3xl);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  background: radial-gradient(circle at top right, rgba(255, 193, 7, 0.1) 0%, transparent 60%);
  pointer-events: none;
}

.page-header h1 {
  color: var(--color-white);
  font-size: var(--font-size-4xl);
  margin-bottom: var(--space-sm);
  position: relative;
}

.page-header .page-date {
  color: rgba(255, 255, 255, 0.6);
  font-size: var(--font-size-sm);
  position: relative;
}

/* --- Content Section (for inner pages) --- */
.content-section {
  padding: var(--space-3xl) 0;
  background: var(--color-white);
}

.content-wrapper {
  max-width: 800px;
  margin: 0 auto;
}

/* Table of Contents */
.toc {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  margin-bottom: var(--space-2xl);
}

.toc h3 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-md);
  color: var(--color-navy);
}

.toc ol {
  list-style: decimal;
  list-style-position: inside;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toc a {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.toc a:hover {
  color: var(--color-purple);
}

/* Article Styles */
.article h2 {
  font-size: var(--font-size-2xl);
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--color-border);
}

.article h3 {
  font-size: var(--font-size-xl);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
}

.article p {
  margin-bottom: var(--space-md);
  color: var(--color-text-secondary);
  line-height: 1.9;
}

.article ul {
  margin-bottom: var(--space-md);
  padding-right: var(--space-xl);
}

.article ul li {
  margin-bottom: var(--space-sm);
  color: var(--color-text-secondary);
  line-height: 1.8;
  position: relative;
  padding-right: var(--space-lg);
}

.article ul li::before {
  content: '•';
  position: absolute;
  right: 0;
  color: var(--color-purple);
  font-weight: 700;
}

.article strong {
  color: var(--color-navy);
}

.article table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-xl);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.article th,
.article td {
  padding: var(--space-md);
  text-align: right;
  border: 1px solid var(--color-border);
}

.article th {
  background: var(--color-navy);
  color: var(--color-white);
  font-weight: 700;
}

.article td {
  color: var(--color-text-secondary);
}

.article .highlight-box {
  background: linear-gradient(135deg, rgba(103, 58, 183, 0.05), rgba(26, 35, 126, 0.05));
  border: 1px solid rgba(103, 58, 183, 0.15);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin: var(--space-xl) 0;
}

.article .highlight-box strong {
  color: var(--color-purple);
}

/* --- Contact Page --- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-xl);
  max-width: 800px;
  margin: 0 auto;
}

.contact-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  text-align: center;
  transition: all var(--transition-base);
}

.contact-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}

.contact-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-lg);
  font-size: 1.5rem;
  background: rgba(103, 58, 183, 0.1);
}

.contact-card h3 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-sm);
}

.contact-card p {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

.contact-card a {
  color: var(--color-purple);
  font-weight: 600;
  direction: ltr;
  unicode-bidi: embed;
}

/* --- 404 Page --- */
.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-purple) 100%);
  color: var(--color-white);
  padding: var(--space-xl);
}

.error-code {
  font-size: 8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--color-gold), var(--color-gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: var(--space-md);
}

.error-page h2 {
  color: var(--color-white);
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-md);
}

.error-page p {
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: var(--space-2xl);
}

/* --- Mobile Navigation --- */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
    z-index: 1001;
  }

  .nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: var(--color-white);
    flex-direction: column;
    padding: calc(var(--header-height) + var(--space-xl)) var(--space-xl) var(--space-xl);
    box-shadow: var(--shadow-xl);
    transition: right var(--transition-base);
    z-index: 999;
  }

  .nav-links.active {
    right: 0;
  }

  .nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
  }

  .nav-overlay.active {
    display: block;
  }

  /* Hero responsive */
  .hero h1 {
    font-size: var(--font-size-3xl);
  }

  .hero-inner {
    flex-direction: column-reverse;
    text-align: center;
    padding-top: var(--space-2xl);
    padding-bottom: var(--space-2xl);
  }

  .hero-content {
    max-width: 100%;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero-logo-container {
    width: 200px;
    height: 200px;
  }

  .hero-logo {
    width: 140px;
    height: 140px;
  }

  /* Features responsive */
  .features-grid {
    grid-template-columns: 1fr;
  }

  /* Footer responsive */
  .footer-inner {
    flex-direction: column;
    gap: var(--space-2xl);
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
  }

  /* Page header responsive */
  .page-header h1 {
    font-size: var(--font-size-2xl);
  }

  /* Contact responsive */
  .contact-grid {
    grid-template-columns: 1fr;
  }

  /* 404 responsive */
  .error-code {
    font-size: 5rem;
  }

  .section-title {
    font-size: var(--font-size-2xl);
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero h1 {
    font-size: var(--font-size-4xl);
  }

  .hero-logo-container {
    width: 250px;
    height: 250px;
  }

  .hero-logo {
    width: 170px;
    height: 170px;
  }
}

/* --- Animations --- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children animation */
.stagger-children .fade-in:nth-child(1) { transition-delay: 0.1s; }
.stagger-children .fade-in:nth-child(2) { transition-delay: 0.2s; }
.stagger-children .fade-in:nth-child(3) { transition-delay: 0.3s; }
.stagger-children .fade-in:nth-child(4) { transition-delay: 0.4s; }
.stagger-children .fade-in:nth-child(5) { transition-delay: 0.5s; }
.stagger-children .fade-in:nth-child(6) { transition-delay: 0.6s; }
