:root {
  --bg-color: #f5f5f5;
  --text-color: #000;
  --header-bg: #003366;
  --card-bg: #fff;
  --footer-bg: #222;

  /* 🔹 أزرار وروابط (أزرق فاتح) */
  --btn-bg: #cfe9ff;
  --btn-hover: #b0dbff;
  --btn-text: #004080;

  /* 🔹 شارات الفصل الدراسي */
  --badge-bg: #e9eef5;            /* عادي */
  --badge-text: #27496d;

  /* 🔹 شارة المناهج المطوّرة (لون مميز) */
  --badge-modern-bg: #e9fbf1;     /* أخضر فاتح مائل للنعناع */
  --badge-modern-border: #b7f0d2;
  --badge-modern-text: #0b5e3c;

  /* ظلال زرقاء للكروت */
  --card-shadow: rgba(0, 102, 204, 0.5);
  --card-shadow-hover: rgba(0, 102, 255, 0.7);
}

.dark-mode {
  --bg-color: #121212;
  --text-color: #eee;
  --header-bg: #1a1a1a;
  --card-bg: #1e1e1e;
  --footer-bg: #111;

  --btn-bg: #3a75c4;       /* أزرق أغمق في الداكن */
  --btn-hover: #2d5a99;
  --btn-text: #e7f1ff;

  --badge-bg: #2a3342;
  --badge-text: #d9e6ff;

  --badge-modern-bg: #1e3a2b;
  --badge-modern-border: #2e6040;
  --badge-modern-text: #c7ffe6;

  --card-shadow: rgba(0, 102, 204, 0.35);
  --card-shadow-hover: rgba(0, 102, 255, 0.5);
}

* { box-sizing: border-box; }

body {
  font-family: 'Cairo', sans-serif;
  direction: rtl;
  background: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  padding: 0;
  transition: background 0.3s, color 0.3s;
}

/* ================= Header ================= */
header {
  background-color: var(--header-bg);
  color: white;
  padding: 20px 10px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  text-align: center;
  gap: 15px;
}

.header-logo { justify-self: start; }
.header-logo img {
  height: 80px; width: auto;
  opacity: 0.9;
  transition: opacity 0.3s ease, transform 0.3s ease;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.25));
}
.header-logo img:hover { opacity: 1; transform: scale(1.05); }

.header-text {
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.header-title a {
  color: #fff;
  text-decoration: none;
  font-weight: 900;
  font-size: 32px;
  text-shadow:
    2px 2px 6px rgba(255,255,255,0.6),
    -2px -2px 6px rgba(255,255,255,0.4);
  transition: transform 0.4s ease, text-shadow 0.4s ease;
  display: inline-block;
}
.header-title a:hover {
  transform: scale(1.05) rotateX(5deg) rotateY(-5deg);
  text-shadow:
    3px 3px 8px rgba(255,255,255,0.8),
    -3px -3px 8px rgba(255,255,255,0.6);
}
.header-subtitle {
  font-size: 25px;
  font-weight: 600;
  margin: 4px 0 0;
  color: #e0e0e0;             /* لون أفتح قليلاً لزيادة التباين */
  opacity: 0.9;               /* وضوح أفضل */
  letter-spacing: 0.3px;      /* تباعد طفيف بين الحروف */
  line-height: 1.6;           /* تحسين قابلية القراءة */
}


/* زر تبديل الوضع */
.toggle-mode {
  position: absolute;
  left: 10px;
  top: 10px;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background .3s ease;
}
.toggle-mode:hover { background: var(--btn-hover); }

/* ================= Intro (3D card) ================= */
.intro-download {
  display: inline-block;
  background: var(--card-bg);
  padding: 25px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 6px 15px rgba(0, 102, 204, 0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  margin: 20px 0;
  will-change: transform;
}
.intro-download:hover,
.intro-download:active {
  transform: translateY(-8px) scale(1.05) rotateX(5deg) rotateY(-5deg);
  box-shadow: 0 12px 25px rgba(0, 102, 255, 0.6);
}
.intro-download h2 {
  margin-bottom: 15px;
  font-size: 20px;
  color: var(--text-color);
}

/* زر داخل كارت المقدمة + الأزرار العامة */
.book-card a,
.intro-download a,
.info-card a,
.toggle-mode {
  display: inline-block;
  background: var(--btn-bg);
  color: var(--btn-text);
  padding: 10px 15px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 15px;
  transition: background 0.3s ease, transform .15s ease, box-shadow .2s ease;
  position: relative;
  box-shadow: 0 8px 20px rgba(0, 102, 204, .12);
}
.intro-download a { padding: 12px 20px; font-size: 16px; }

/* أيقونة 📘 قبل النص تلقائيًا */
.book-card a::before,
.intro-download a::before,
.info-card a::before {
  content: "📘 ";
  font-size: 16px;
  margin-left: 5px;
}

.book-card a:hover,
.intro-download a:hover,
.info-card a:hover,
.toggle-mode:hover {
  background: var(--btn-hover);
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(0, 102, 255, .22);
}
.book-card a:active,
.intro-download a:active,
.info-card a:active,
.toggle-mode:active {
  transform: translateY(0);
  box-shadow: 0 6px 16px rgba(0, 102, 255, .18);
}

/* ================= Filters ================= */
.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  margin: 20px auto;
  max-width: 95%;
  background-color: lightblue; /* أو استخدم #add8e6 */
  padding: 15px; /* لإضافة مساحة داخلية حول العناصر */
  border-radius: 10px; /* يعطي شكل دائري ناعم للأطراف لو حابب */
}

.filters * {
  font-size: 1.2rem;
  font-weight: bold;
}


select {
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 16px;
  min-width: 160px;
  width: 100%;
  max-width: 250px;
}

/* ================= Books Grid ================= */
.books-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  padding: 20px;
  max-width: 1200px;
  margin: auto;
}

.book-card {
  background: var(--card-bg);
  padding: 16px 16px 18px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 8px 20px var(--card-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.04);
}
.book-card:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 12px 30px var(--card-shadow-hover);
}

.book-card h3 {
  margin: 8px 0 6px;
  color: var(--text-color);
  font-size: 18px;
  line-height: 1.4;
}
.book-card p {
  color: #666;
  font-size: 14px;
  margin: 0 0 10px;
}

/* شارة الفصل الدراسي */
.term-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--badge-bg);
  color: var(--badge-text);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12.5px;
  font-weight: 800;
  border: 1px solid rgba(0,0,0,.06);
  margin-bottom: 10px;
}
.term-badge::before { content: "📚"; }

/* شارة المناهج المطوّرة (لون مميز) */
.term-badge--modern {
  background: var(--badge-modern-bg);
  color: var(--badge-modern-text);
  border: 1px solid var(--badge-modern-border);
}
.term-badge--modern::before { content: "✨"; }

/* ================= Info Cards ================= */
.info-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  padding: 20px;
  max-width: 1200px;
  margin: auto;
}
.info-card {
  background: var(--card-bg);
  color: var(--text-color);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0, 102, 204, 0.3);
  transition: transform 0.3s, box-shadow 0.3s;
  border: 1px solid rgba(0,0,0,.04);
}
.info-card:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 12px 30px rgba(0, 102, 204, 0.5);
}
.info-card h3 { font-size: 20px; margin-bottom: 10px; }
.info-card p  { font-size: 14px; color: #888; margin-bottom: 15px; }

/* ================= Footer ================= */
footer {
  background: var(--footer-bg);
  color: #ccc;
  text-align: center;
  padding: 15px;
  font-size: 14px;
}

/* ================= Watermark (local) ================= */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: url('Ministry_of_Education_(Egypt)_logo.png') center center no-repeat;
  background-size: 250px;
  opacity: 1.05;      /* شفافية العلامة */
  z-index: -1;        /* خلف المحتوى */
  pointer-events: none;
}

/* ================= Mobile ================= */
@media (max-width: 600px) {
  .header-title a { font-size: 24px; }
  .header-subtitle { font-size: 16px; }
  .book-card h3 { font-size: 16px; }
  .book-card p { font-size: 13px; }
  .book-card a { font-size: 14px; }
}
