/* ========================================
   الذكاء الاصطناعي - مادة المهارات الرقمية
   ألوان مستوحاة من العلم الأردني
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&family=Cairo:wght@300;400;600;700;900&display=swap');

/* ======= ثيم الاستقلال (الافتراضي) ======= */
:root {
  --black:    #000000;
  --white:    #ffffff;
  --red:      #CE1126;
  --green:    #007A3D;
  --gold:     #C6A84B;
  --gold-light: #e8c96e;
  --gold-dark:  #9a7c2e;

  --bg-dark:    #0f1a0f;
  --bg-card:    #162016;
  --bg-card2:   #1e2e1e;
  --red-dark:   #4a1a10;
  --red-glow:   rgba(206,17,38,0.3);
  --green-dark: #1a3a1a;
  --green-glow: rgba(0,122,61,0.3);
  --gold-glow:  rgba(198,168,75,0.3);

  --text-primary: #f0ece0;
  --text-muted:   #a8b89a;
  --border:       rgba(198,168,75,0.2);

  --shadow-red:   0 0 30px rgba(206,17,38,0.4);
  --shadow-green: 0 0 30px rgba(0,122,61,0.4);
  --shadow-gold:  0 0 30px rgba(198,168,75,0.4);

  --radius: 16px;
  --radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4,0,0.2,1);

  /* متغيرات الثيم الديناميكية */
  --accent:       var(--gold);
  --accent-light: var(--gold-light);
  --accent-dark:  var(--gold-dark);
  --accent-glow:  var(--gold-glow);
  --shadow-accent:var(--shadow-gold);
  --hero-bg: linear-gradient(135deg, #0a1208 0%, #1a3a18 25%, #0f2010 50%, #1e2e10 75%, #0a1208 100%);
  --hero-line: linear-gradient(90deg, var(--red), var(--white), var(--green));
  --navbar-border: var(--gold);
  --wave-display: none;
}

/* ======= ثيم الذكاء الاصطناعي (كحلي/أزرق) ======= */
[data-theme="ai"] {
  --gold:       #4fc3f7;
  --gold-light: #81d4fa;
  --gold-dark:  #0277bd;
  --gold-glow:  rgba(79,195,247,0.3);

  --bg-dark:    #020817;
  --bg-card:    #0a1628;
  --bg-card2:   #0d1f3c;
  --red-dark:   #0d2137;
  --red-glow:   rgba(79,195,247,0.15);
  --green-dark: #0a2240;
  --green-glow: rgba(100,181,246,0.2);

  --text-primary: #e8f4fd;
  --text-muted:   #90caf9;
  --border:       rgba(79,195,247,0.2);

  --shadow-red:   0 0 30px rgba(79,195,247,0.3);
  --shadow-green: 0 0 30px rgba(100,181,246,0.3);
  --shadow-gold:  0 0 30px rgba(79,195,247,0.4);

  --accent:        #4fc3f7;
  --accent-light:  #81d4fa;
  --accent-dark:   #0277bd;
  --accent-glow:   rgba(79,195,247,0.3);
  --shadow-accent: 0 0 30px rgba(79,195,247,0.4);

  --hero-bg: linear-gradient(135deg, #020817 0%, #051b3a 30%, #020d2e 50%, #061830 70%, #020817 100%);
  --hero-line: linear-gradient(90deg, #1565c0, #4fc3f7, #0d47a1);
  --navbar-border: #4fc3f7;
  --wave-display: block;
}

/* ======= تطبيق ثيم AI على العناصر ======= */
[data-theme="ai"] .navbar {
  background: rgba(2,8,23,0.95);
  border-bottom-color: #4fc3f7;
}
[data-theme="ai"] .hero-banner {
  background: var(--hero-bg);
}
[data-theme="ai"] .hero-banner::before {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(79,195,247,0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(100,181,246,0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 20%, rgba(79,195,247,0.08) 0%, transparent 50%);
}
[data-theme="ai"] .hero-banner::after {
  background: var(--hero-line);
}
[data-theme="ai"] .nav-links a:hover,
[data-theme="ai"] .nav-links a.active {
  color: #4fc3f7;
  background: rgba(79,195,247,0.1);
  border-color: #4fc3f7;
}
[data-theme="ai"] .brand-text .main-title { color: #4fc3f7; }
[data-theme="ai"] ::-webkit-scrollbar-thumb { background: #4fc3f7; }
[data-theme="ai"] .hamburger { color: #4fc3f7; }

/* موجات الذكاء الاصطناعي */
.ai-waves {
  display: var(--wave-display, none);
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.ai-wave {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(79,195,247,0.15);
  animation: waveExpand 6s ease-out infinite;
}
.ai-wave:nth-child(1) { width:200px; height:200px; top:10%; left:5%;  animation-delay:0s; }
.ai-wave:nth-child(2) { width:300px; height:300px; top:30%; right:8%; animation-delay:1.5s; }
.ai-wave:nth-child(3) { width:150px; height:150px; top:60%; left:20%; animation-delay:3s; }
.ai-wave:nth-child(4) { width:250px; height:250px; top:5%;  right:30%;animation-delay:4.5s; }

/* شبكة الذكاء الاصطناعي */
.ai-grid-bg {
  display: var(--wave-display, none);
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(79,195,247,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79,195,247,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* نقاط متحركة */
.ai-nodes {
  display: var(--wave-display, none);
  position: absolute; inset: 0;
  pointer-events: none; z-index: 1;
}
.ai-node {
  position: absolute;
  width: 4px; height: 4px;
  background: #4fc3f7;
  border-radius: 50%;
  animation: nodePulse 3s ease-in-out infinite;
}
.ai-conn {
  position: absolute;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(79,195,247,0.4), transparent);
  animation: connFlow 4s ease-in-out infinite;
}

@keyframes waveExpand {
  0%   { transform: scale(0.3); opacity: 0.8; }
  100% { transform: scale(2.5); opacity: 0; }
}
@keyframes nodePulse {
  0%,100% { transform: scale(1); opacity: 0.4; box-shadow: none; }
  50%      { transform: scale(2); opacity: 1; box-shadow: 0 0 8px #4fc3f7; }
}
@keyframes connFlow {
  0%,100% { opacity: 0; }
  50%      { opacity: 1; }
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Cairo', 'Tajawal', sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  direction: rtl;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ======= SCROLLBAR ======= */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 3px; }

/* ======= NAVBAR ======= */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.92);
  backdrop-filter: blur(20px);
  border-bottom: 2px solid var(--gold);
  padding: 0 2rem;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-logo {
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: visible;
}

.brand-text {
  display: flex; flex-direction: column; line-height: 1.2;
}
.brand-text .main-title { font-size: 1rem; font-weight: 700; color: var(--gold); }
.brand-text .sub-title  { font-size: 0.7rem; color: var(--text-muted); }

.nav-links {
  display: flex; gap: 4px; list-style: none;
}

.nav-links a {
  display: flex; align-items: center; gap: 5px;
  padding: 8px 14px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  border: 1px solid transparent;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--gold);
  background: rgba(198,168,75,0.1);
  border-color: var(--gold);
}

.nav-links a .nav-icon { font-size: 1rem; }

.hamburger {
  display: none;
  background: none; border: none;
  color: var(--gold); font-size: 1.5rem; cursor: pointer;
}

/* ======= PAGE WRAPPER ======= */
.page-content {
  margin-top: 70px;
  min-height: calc(100vh - 70px);
}

/* ======= HERO BANNER ======= */
.hero-banner {
  background: linear-gradient(135deg, #000 0%, var(--red-dark) 30%, #000 50%, var(--green-dark) 70%, #000 100%);
  padding: 80px 2rem 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-banner::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 20% 50%, var(--red-glow) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 50%, var(--green-glow) 0%, transparent 60%),
              radial-gradient(ellipse at 50% 50%, var(--gold-glow) 0%, transparent 40%);
}

.hero-banner::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--red), var(--white), var(--green));
}

.hero-stars {
  position: absolute; inset: 0; pointer-events: none;
}

.star {
  position: absolute;
  width: 3px; height: 3px;
  background: var(--gold);
  border-radius: 50%;
  animation: twinkle 3s ease-in-out infinite;
}

@keyframes twinkle {
  0%,100% { opacity: 0.2; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.5); }
}

.hero-content { position: relative; z-index: 2; }

.school-badge {
  display: inline-block;
  background: rgba(198,168,75,0.15);
  border: 1px solid var(--gold);
  border-radius: 50px;
  padding: 8px 24px;
  font-size: 0.85rem;
  color: var(--gold);
  margin-bottom: 20px;
  letter-spacing: 1px;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--white), var(--gold), var(--white));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.hero-meta {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 16px;
  margin-top: 20px;
}

.hero-meta span {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 6px 18px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hero-meta span strong { color: var(--gold); }

/* ======= SECTION STYLES ======= */
.section { padding: 60px 2rem; max-width: 1200px; margin: 0 auto; }

.section-title {
  display: flex; align-items: center; gap: 14px;
  font-size: 1.8rem; font-weight: 800;
  margin-bottom: 36px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

.section-title .title-icon {
  width: 50px; height: 50px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.title-icon.red   { background: rgba(206,17,38,0.2); border: 1px solid var(--red); }
.title-icon.green { background: rgba(0,122,61,0.2);  border: 1px solid var(--green); }
.title-icon.gold  { background: rgba(198,168,75,0.2); border: 1px solid var(--gold); }

/* ======= CARDS ======= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}

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

.card-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}

.card-body { padding: 20px; }

/* ======= GRID LAYOUTS ======= */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ======= BUTTONS ======= */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px;
  border-radius: 50px;
  font-family: 'Cairo', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  border: none;
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold), var(--gold-light));
  color: var(--black);
}
.btn-gold:hover { box-shadow: var(--shadow-gold); transform: translateY(-2px); }

.btn-red {
  background: linear-gradient(135deg, var(--red-dark), var(--red));
  color: var(--white);
}
.btn-red:hover { box-shadow: var(--shadow-red); transform: translateY(-2px); }

.btn-green {
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: var(--white);
}
.btn-green:hover { box-shadow: var(--shadow-green); transform: translateY(-2px); }

.btn-outline {
  background: transparent;
  border: 2px solid var(--gold);
  color: var(--gold);
}
.btn-outline:hover { background: var(--gold); color: var(--black); }

/* ======= BADGES ======= */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-red   { background: rgba(206,17,38,0.2); color: var(--red); border: 1px solid var(--red); }
.badge-green { background: rgba(0,122,61,0.2); color: var(--green); border: 1px solid var(--green); }
.badge-gold  { background: rgba(198,168,75,0.2); color: var(--gold); border: 1px solid var(--gold); }

/* ======= FOOTER ======= */
.footer {
  background: #000;
  border-top: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--red), var(--white), var(--green)) 1;
  padding: 40px 2rem 20px;
  text-align: center;
}

.footer-logo { font-size: 2rem; margin-bottom: 10px; }
.footer-title { color: var(--gold); font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.footer-sub   { color: var(--text-muted); font-size: 0.85rem; }
.footer-divider { border: none; border-top: 1px solid var(--border); margin: 24px auto; max-width: 300px; }
.footer-copy  { color: var(--text-muted); font-size: 0.8rem; }

/* ======= JORANIAN FLAG STRIPE ======= */
.flag-stripe {
  height: 5px;
  background: linear-gradient(90deg, var(--red) 33.33%, var(--white) 33.33% 66.66%, var(--green) 66.66%);
}

/* ======= HIDDEN ======= */
.hidden { display: none !important; }

/* ======= QUIZ STYLES ======= */
.quiz-option {
  background: var(--bg-card2);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Cairo', sans-serif;
  font-size: 0.95rem;
  color: var(--text-primary);
  text-align: right;
  width: 100%;
}
.quiz-option:hover { border-color: var(--gold); background: rgba(198,168,75,0.05); }
.quiz-option.correct { border-color: var(--green); background: rgba(0,122,61,0.15); color: #4cff8f; }
.quiz-option.wrong   { border-color: var(--red); background: rgba(206,17,38,0.15); color: #ff6b6b; }

.quiz-progress { height: 6px; background: var(--bg-card2); border-radius: 3px; margin-bottom: 24px; }
.quiz-progress-bar { height: 100%; background: linear-gradient(90deg, var(--green), var(--gold)); border-radius: 3px; transition: width 0.5s ease; }

/* ======= TIPS ======= */
.tip-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.tip-card::before {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 4px; height: 100%;
}
.tip-card.tip-red::before   { background: var(--red); }
.tip-card.tip-green::before { background: var(--green); }
.tip-card.tip-gold::before  { background: var(--gold); }
.tip-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-gold); border-color: var(--gold); }

/* ======= GAME STYLES ======= */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 500px;
  margin: 0 auto;
}

.memory-card {
  aspect-ratio: 1;
  background: linear-gradient(135deg, var(--red-dark), var(--green-dark));
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  transition: var(--transition);
  user-select: none;
  border: 2px solid var(--border);
  perspective: 600px;
}
.memory-card.flipped { 
  background: var(--bg-card2); 
  border-color: var(--gold);
  box-shadow: 0 0 10px var(--gold-glow);
}
.memory-card.matched { 
  background: rgba(0,122,61,0.3);
  border-color: var(--green);
  cursor: default;
}
.memory-card .card-back { display: none; }
.memory-card.flipped .card-back { display: flex; }
.memory-card.flipped .card-front { display: none; }

/* ======= CONTACT FORM ======= */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--gold);
  font-weight: 600;
}
.form-input,
.form-textarea {
  width: 100%;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--text-primary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.95rem;
  transition: var(--transition);
  direction: rtl;
}
.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(198,168,75,0.15);
}
.form-textarea { min-height: 120px; resize: vertical; }

/* ======= AI CHAT (Ask AI page) ======= */
.chat-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.chat-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(206,17,38,0.2), rgba(0,122,61,0.2));
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.chat-messages {
  padding: 20px;
  min-height: 300px;
  max-height: 400px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
}
.chat-bubble {
  max-width: 80%;
  padding: 12px 18px;
  border-radius: 18px;
  line-height: 1.6;
  font-size: 0.95rem;
}
.chat-bubble.user {
  background: linear-gradient(135deg, var(--red-dark), var(--red));
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-bubble.ai {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.chat-bubble.ai.loading { opacity: 0.6; }
.chat-input-area {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px;
}
.chat-input {
  flex: 1;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 12px 20px;
  color: var(--text-primary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  direction: rtl;
}
.chat-input:focus { outline: none; border-color: var(--gold); }
.chat-send {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  border: none; border-radius: 50px;
  padding: 12px 24px;
  color: var(--black);
  font-family: 'Cairo', sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
.chat-send:hover { box-shadow: var(--shadow-gold); }

/* ======= INFOGRAPHIC IMAGE VIEWER ======= */
.infographic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.infographic-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
}
.infographic-item:hover {
  border-color: var(--gold);
  transform: translateY(-3px);
  box-shadow: var(--shadow-gold);
}
.infographic-item img {
  width: 100%; height: 200px;
  object-fit: cover;
}
.infographic-item-title {
  padding: 12px;
  font-size: 0.85rem;
  text-align: center;
  color: var(--gold);
}

/* LIGHTBOX */
.lightbox {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.95);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.lightbox.open { opacity: 1; pointer-events: all; }
.lightbox img { max-width: 90vw; max-height: 90vh; border-radius: var(--radius); }
.lightbox-close {
  position: absolute; top: 20px; left: 20px;
  background: var(--red); border: none; color: #fff;
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 1.2rem; cursor: pointer;
}
.lightbox-nav {
  position: absolute;
  background: rgba(198,168,75,0.2);
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.4rem;
  transition: var(--transition);
}
.lightbox-nav:hover { background: var(--gold); color: var(--black); }
.lightbox-prev { right: 20px; }
.lightbox-next { left: 20px; }

/* ======= RESPONSIVE — TABLET ======= */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex; flex-direction: column;
    position: fixed; top: 70px; left: 0; right: 0;
    background: rgba(0,0,0,0.98);
    padding: 16px;
    border-bottom: 1px solid var(--border);
    z-index: 999;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
  }
  .nav-links.open a {
    padding: 14px 18px;
    font-size: 1rem;
    border-bottom: 1px solid var(--border);
  }
  .hamburger { display: block; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .memory-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }

  .section-title { font-size: 1.4rem; }
  .section-title .title-icon { width: 40px; height: 40px; font-size: 1.1rem; }

  .chat-container { border-radius: var(--radius-sm); }
  .chat-messages { min-height: 250px; max-height: 340px; }

  .infographic-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

/* ======= RESPONSIVE — MOBILE ======= */
@media (max-width: 600px) {
  /* --- Navbar --- */
  .navbar { padding: 0 14px; height: 60px; }
  .brand-logo { width: 36px; height: 36px; font-size: 1.1rem; }
  .brand-text .main-title { font-size: 0.85rem; }
  .brand-text .sub-title  { font-size: 0.65rem; }
  .nav-links.open { top: 60px; }
  .page-content { margin-top: 60px; }

  /* --- Hero --- */
  .hero-banner { padding: 48px 14px 36px; }
  .hero-title   { font-size: 1.6rem !important; }
  .hero-subtitle { font-size: 0.9rem; }
  .school-badge { font-size: 0.75rem; padding: 6px 16px; }
  .hero-meta { gap: 8px; }
  .hero-meta span { font-size: 0.78rem; padding: 5px 12px; }
  .hero-banner .btn { padding: 10px 18px; font-size: 0.85rem; }

  /* --- Section & Typography --- */
  .section { padding: 28px 14px; }
  .section-title { font-size: 1.2rem; gap: 10px; margin-bottom: 22px; }
  .section-title .title-icon { width: 36px; height: 36px; font-size: 1rem; flex-shrink: 0; }

  /* --- Grids: single column on mobile --- */
  .grid-2,
  .grid-3,
  .grid-4 { grid-template-columns: 1fr; gap: 12px; }

  /* --- Cards --- */
  .card-header { padding: 14px 16px; }
  .card-body   { padding: 14px 16px; }

  /* --- Buttons --- */
  .btn { padding: 11px 20px; font-size: 0.88rem; }

  /* --- Memory game --- */
  .memory-grid { grid-template-columns: repeat(4, 1fr); gap: 7px; max-width: 100%; }
  .memory-card { font-size: 1.3rem; border-radius: var(--radius-sm); }

  /* --- Quiz --- */
  .quiz-option { padding: 12px 14px; font-size: 0.88rem; }

  /* --- Chat (Ask AI) --- */
  .chat-messages  { min-height: 220px; max-height: 300px; padding: 14px; gap: 10px; }
  .chat-bubble    { font-size: 0.88rem; padding: 10px 14px; max-width: 90%; }
  .chat-input-area{ padding: 10px 12px; gap: 8px; }
  .chat-input     { font-size: 0.85rem; padding: 10px 14px; }
  .chat-send      { padding: 10px 14px; font-size: 0.82rem; white-space: nowrap; }
  .suggested-qs   { gap: 7px; }
  .sq-btn         { font-size: 0.78rem; padding: 7px 12px; }

  /* --- Infographic --- */
  .infographic-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .infographic-item img { height: 140px; }
  .infographic-item-title { font-size: 0.75rem; padding: 8px; }
  .filter-bar { gap: 7px; }
  .filter-btn { font-size: 0.78rem; padding: 7px 14px; }

  /* --- Lightbox --- */
  .lightbox img { max-width: 96vw; max-height: 80vh; }
  .lightbox-nav { padding: 10px 14px; font-size: 1.1rem; }
  .lightbox-prev { right: 8px; }
  .lightbox-next { left: 8px; }
  .lightbox-close { top: 10px; left: 10px; width: 36px; height: 36px; font-size: 1rem; }

  /* --- Contact --- */
  .contact-grid { grid-template-columns: 1fr; gap: 16px; }
  .do-dont { grid-template-columns: 1fr; gap: 12px; }

  /* --- Games --- */
  .game-tabs { gap: 6px; }
  .game-tab { padding: 8px 14px; font-size: 0.8rem; }
  .game-box-header { padding: 14px 16px; flex-wrap: wrap; gap: 10px; }
  .game-box-body   { padding: 16px 14px; }
  .game-stats { gap: 16px; }
  .scramble-word-display { font-size: 1.8rem; letter-spacing: 4px; padding: 18px; }
  .scramble-input-row { flex-direction: column; }
  .scramble-input-row .btn { width: 100%; justify-content: center; }
  .speed-header { flex-wrap: wrap; gap: 10px; }
  .timer-display { font-size: 1.1rem; padding: 6px 14px; }

  /* --- Tips accordion --- */
  .accordion-header { font-size: 0.88rem; padding: 14px 16px; }

  /* --- Stat cards --- */
  .stat-number { font-size: 1.8rem; }
  .stat-label  { font-size: 0.78rem; }

  /* --- Quick nav cards --- */
  .qnc-icon  { width: 56px; height: 56px; font-size: 1.6rem; border-radius: 14px; }
  .qnc-title { font-size: 0.92rem; }
  .qnc-desc  { font-size: 0.78rem; }

  /* --- Home feature box --- */
  .home-feature-box { flex-direction: column; align-items: center; text-align: center; padding: 20px 16px; }
  .feature-icon { font-size: 2.5rem; }
  .feature-content h2 { font-size: 1.2rem; }
  .feature-content p  { font-size: 0.88rem; }

  /* --- Team cards --- */
  .team-card { padding: 20px 14px; }
  .team-avatar { width: 64px; height: 64px; font-size: 2rem; }

  /* --- Score circle --- */
  .score-circle { width: 90px; height: 90px; font-size: 1.1rem; }

  /* --- Footer --- */
  .footer { padding: 28px 14px 16px; }
  .footer-title { font-size: 0.95rem; }
  .footer-sub   { font-size: 0.78rem; }

  /* --- Form --- */
  .form-input, .form-textarea { font-size: 0.9rem; padding: 12px 14px; }
  .form-label { font-size: 0.85rem; }

  /* --- Info banner (ask-ai) --- */
  .info-banner { font-size: 0.82rem; padding: 12px 14px; }

  /* --- Tips grid --- */
  .tips-grid { grid-template-columns: 1fr; }
  .tip-card  { padding: 18px 16px; }
  .tip-icon  { font-size: 1.6rem; }
  .tip-title { font-size: 0.92rem; }

  /* Result card (quiz) */
  .result-card { padding: 28px 18px; }
}

/* ======= ANIMATIONS ======= */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-in { animation: fadeInUp 0.6s ease forwards; }
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }

/* ======= SCORE DISPLAY ======= */
.score-circle {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: conic-gradient(var(--green) var(--pct), var(--bg-card2) var(--pct));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 800;
  margin: 0 auto;
  position: relative;
}
.score-circle::before {
  content: '';
  position: absolute;
  inset: 8px;
  background: var(--bg-card);
  border-radius: 50%;
}
.score-circle span { position: relative; z-index: 1; color: var(--gold); }

/* ======= زر تبديل الثيم ======= */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid var(--gold);
  border-radius: 50px;
  padding: 7px 14px;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Cairo', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
  flex-shrink: 0;
}
.theme-toggle-btn:hover {
  background: rgba(198,168,75,0.15);
  box-shadow: 0 0 16px var(--gold-glow);
  transform: translateY(-1px);
}
.theme-toggle-inner {
  position: relative;
  width: 28px; height: 20px;
  display: inline-block;
}
.theme-icon-jordan,
.theme-icon-ai {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  transition: opacity 0.4s, transform 0.4s;
}
.theme-icon-jordan { opacity: 1;  transform: scale(1); }
.theme-icon-ai     { opacity: 0;  transform: scale(0.5); }

[data-theme="ai"] .theme-toggle-btn {
  border-color: #4fc3f7;
  color: #4fc3f7;
  background: rgba(79,195,247,0.08);
}
[data-theme="ai"] .theme-toggle-btn:hover {
  background: rgba(79,195,247,0.18);
  box-shadow: 0 0 16px rgba(79,195,247,0.4);
}
[data-theme="ai"] .theme-icon-jordan { opacity: 0; transform: scale(0.5); }
[data-theme="ai"] .theme-icon-ai     { opacity: 1; transform: scale(1); }
[data-theme="ai"] #themeLabel        { color: #4fc3f7; }

/* إخفاء الليبل على الشاشات الصغيرة */
@media (max-width: 900px) {
  .theme-toggle-label { display: none; }
  .theme-toggle-btn { padding: 7px 10px; }
}
@media (max-width: 600px) {
  .theme-toggle-btn { padding: 6px 9px; }
}

/* ======= ثيم AI — تأثيرات إضافية على البطاقات والعناصر ======= */
[data-theme="ai"] .card,
[data-theme="ai"] .tip-card,
[data-theme="ai"] .quick-nav-card,
[data-theme="ai"] .stat-card,
[data-theme="ai"] .home-topic-card,
[data-theme="ai"] .team-card,
[data-theme="ai"] .contact-info-card,
[data-theme="ai"] .contact-form-card,
[data-theme="ai"] .quiz-container,
[data-theme="ai"] .chat-container,
[data-theme="ai"] .game-box,
[data-theme="ai"] .infographic-item,
[data-theme="ai"] .summary-infographic-card {
  background: var(--bg-card);
  border-color: rgba(79,195,247,0.2);
}
[data-theme="ai"] .card:hover,
[data-theme="ai"] .tip-card:hover,
[data-theme="ai"] .quick-nav-card:hover,
[data-theme="ai"] .stat-card:hover,
[data-theme="ai"] .home-topic-card:hover,
[data-theme="ai"] .infographic-item:hover,
[data-theme="ai"] .summary-infographic-card:hover {
  border-color: #4fc3f7;
  box-shadow: 0 0 24px rgba(79,195,247,0.25);
}
[data-theme="ai"] .section-title { border-bottom-color: rgba(79,195,247,0.2); }
[data-theme="ai"] .school-badge  { border-color: #4fc3f7; color: #4fc3f7; background: rgba(79,195,247,0.08); }
[data-theme="ai"] .hero-title    { color: #e8f4fd; }
[data-theme="ai"] .footer        { border-image: linear-gradient(90deg,#1565c0,#4fc3f7,#0d47a1) 1; }
[data-theme="ai"] .flag-stripe   { background: linear-gradient(90deg,#0d47a1 33%,#4fc3f7 33% 66%,#1565c0 66%); }
[data-theme="ai"] .btn-gold      { background: linear-gradient(135deg,#0277bd,#4fc3f7,#81d4fa); color:#020817; }
[data-theme="ai"] .btn-green     { background: linear-gradient(135deg,#01579b,#0288d1); }
[data-theme="ai"] .btn-outline   { border-color:#4fc3f7; color:#4fc3f7; }
[data-theme="ai"] .btn-outline:hover { background:#4fc3f7; color:#020817; }
[data-theme="ai"] .badge-gold    { background:rgba(79,195,247,0.15); color:#4fc3f7; border-color:#4fc3f7; }
[data-theme="ai"] .badge-green   { background:rgba(2,136,209,0.15);  color:#29b6f6; border-color:#29b6f6; }
[data-theme="ai"] .independence-card-wrapper { background: linear-gradient(180deg,#020817,#031428,#020d2e); }
[data-theme="ai"] .quiz-option:hover { border-color:#4fc3f7; background:rgba(79,195,247,0.06); }
[data-theme="ai"] .quiz-progress-bar { background:linear-gradient(90deg,#0288d1,#4fc3f7); }
[data-theme="ai"] .form-input:focus,
[data-theme="ai"] .form-textarea:focus { border-color:#4fc3f7; box-shadow:0 0 0 3px rgba(79,195,247,0.12); }
[data-theme="ai"] .chat-input:focus    { border-color:#4fc3f7; }
[data-theme="ai"] .chat-send { background:linear-gradient(135deg,#0277bd,#4fc3f7); color:#020817; }
[data-theme="ai"] .filter-btn.active,
[data-theme="ai"] .filter-btn:hover    { border-color:#4fc3f7; color:#4fc3f7; background:rgba(79,195,247,0.1); }
[data-theme="ai"] .game-tab.active,
[data-theme="ai"] .game-tab:hover      { border-color:#4fc3f7; color:#4fc3f7; background:rgba(79,195,247,0.1); }
[data-theme="ai"] .memory-card.flipped { border-color:#4fc3f7; box-shadow:0 0 10px rgba(79,195,247,0.3); }
[data-theme="ai"] .memory-card.matched { background:rgba(2,136,209,0.2); border-color:#29b6f6; }
[data-theme="ai"] .accordion-header:hover { color:#4fc3f7; }
[data-theme="ai"] .tip-card.tip-green { border-right-color:#29b6f6; }
[data-theme="ai"] .tip-card.tip-gold  { border-right-color:#4fc3f7; }
[data-theme="ai"] .info-item .info-icon { border-color: rgba(79,195,247,0.4) !important; }

/* ======= إصلاحات إضافية للموبايل =======*/

/* ناف بار — منع التداخل بين العناصر */
@media (max-width: 900px) {
  .navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 8px;
  }
  .navbar-brand { flex: 1; min-width: 0; }
  .brand-text .main-title { font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .brand-text .sub-title  { display: none; }
  .theme-toggle-btn { flex-shrink: 0; }
  .hamburger { flex-shrink: 0; }
}

@media (max-width: 480px) {
  .navbar { padding: 0 10px; gap: 6px; }
  .brand-logo svg { width: 28px !important; height: 28px !important; }
  .brand-text .main-title { font-size: 0.75rem; }
  .theme-toggle-btn { padding: 5px 8px; }
}

/* بطاقة الاستقلال — منع الفيضان */
@media (max-width: 480px) {
  .ind-content { padding: 18px 12px 16px; gap: 14px; }
  .ind-logo { max-width: 200px; }
  .ind-title-ar { font-size: 1.1rem; }
  .ind-title-num { font-size: 3rem; }
  .ind-message { padding: 14px 12px; }
  .ind-msg-text { font-size: 0.82rem; line-height: 1.7; }
  .ind-msg-dua  { font-size: 0.85rem; line-height: 1.8; }
  .ind-sig-school { font-size: 0.75rem; }
  .ind-signature { flex-direction: column; gap: 8px; text-align: center; }
  .ind-sig-line { width: 60%; height: 1px; margin: 0 auto; }
  .ind-corner { font-size: 0.9rem; }
}

/* هيرو — منع overflow الأفقي */
.hero-banner { overflow: hidden; }
.hero-meta   { padding: 0 10px; }

/* أقسام — منع التمدد الأفقي */
@media (max-width: 480px) {
  .section { padding: 24px 12px; }
  .hero-banner { padding: 44px 12px 32px; }
  .hero-meta span { font-size: 0.72rem; padding: 4px 10px; }
  .school-badge { font-size: 0.7rem; padding: 5px 12px; }
  .section-title { font-size: 1.1rem; }

  /* بطاقات الصفحة الرئيسية */
  .card-header { padding: 12px 14px; gap: 8px; }
  .card-body   { padding: 12px 14px; font-size: 0.85rem; }

  /* شبكة الإحصائيات */
  .grid-4 { grid-template-columns: repeat(2,1fr); gap: 8px; }
  .stat-number { font-size: 1.5rem; }
  .stat-label  { font-size: 0.75rem; }

  /* الإنفوجرافيك */
  .infographic-grid { grid-template-columns: repeat(2,1fr); gap: 8px; }
  .infographic-item img { height: 120px; }

  /* الألعاب */
  .memory-grid { grid-template-columns: repeat(4,1fr); gap: 5px; }
  .memory-card { font-size: 1.1rem; }

  /* Chat */
  .chat-input-area { flex-wrap: nowrap; gap: 6px; }
  .chat-input { font-size: 0.8rem; min-width: 0; flex: 1; }
  .chat-send  { font-size: 0.76rem; padding: 9px 10px; flex-shrink: 0; }
}

/* منع أي overflow أفقي عام */
html, body { overflow-x: hidden; max-width: 100vw; }
img { max-width: 100%; }

/* ======= ثيم الزيتي الملكي — تفاصيل إضافية ======= */
body {
  background: var(--bg-dark);
  background-image:
    radial-gradient(ellipse at 0% 0%,   rgba(0,122,61,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 100% 100%, rgba(198,168,75,0.06) 0%, transparent 50%);
}

.navbar {
  background: rgba(10,18,8,0.94);
  backdrop-filter: blur(20px);
  border-bottom: 2px solid var(--gold);
}

.hero-banner {
  background: var(--hero-bg) !important;
}
.hero-banner::before {
  background:
    radial-gradient(ellipse at 15% 50%, rgba(0,122,61,0.22) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 50%, rgba(198,168,75,0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 20%, rgba(206,17,38,0.12) 0%, transparent 45%) !important;
}

.card, .tip-card, .quick-nav-card, .stat-card,
.home-topic-card, .team-card, .contact-info-card,
.contact-form-card, .quiz-container, .chat-container,
.game-box, .infographic-item, .summary-infographic-card {
  background: var(--bg-card);
  border-color: rgba(198,168,75,0.18);
}

.card:hover, .tip-card:hover, .quick-nav-card:hover,
.stat-card:hover, .home-topic-card:hover,
.infographic-item:hover, .summary-infographic-card:hover {
  border-color: var(--gold);
  box-shadow: 0 8px 32px rgba(0,122,61,0.2), 0 0 20px rgba(198,168,75,0.15);
}

/* شريط الفوتر بألوان العلم */
.flag-stripe {
  background: linear-gradient(90deg,
    #000 33.33%,
    #fff 33.33% 66.66%,
    #007A3D 66.66%);
}

/* شريط الهيرو السفلي */
.hero-banner::after {
  background: linear-gradient(90deg, var(--red), var(--gold), var(--green)) !important;
}

/* تمييز النص المتوهج */
::-webkit-scrollbar-thumb { background: #2d4a2d; }
::-webkit-scrollbar-track  { background: #0f1a0f; }
