/* ===== خطوط وألوان الموقع ===== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;900&display=swap');

:root {
  --bg: #f7f4ef;
  --card: #ffffff;
  --ink: #22303e;
  --muted: #6b7a89;
  --brand: #1f6f5c;        /* أخضر غامق */
  --brand-dark: #14523f;
  --accent: #e8a33d;       /* أصفر دافي */
  --danger: #c94f43;
  --line: #e5ded2;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(34, 48, 62, 0.08);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container { width: min(1100px, 92%); margin: 0 auto; }

/* ===== الهيدر ===== */
header.site-header {
  background: var(--card);
  border-bottom: 3px solid var(--brand);
  position: sticky;
  top: 0;
  z-index: 50;
}

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

.logo {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--brand-dark);
}
.logo span { color: var(--accent); }

.nav-links { display: flex; gap: 6px; flex-wrap: wrap; }

.nav-links a {
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 600;
  color: var(--muted);
  transition: 0.2s;
}
.nav-links a:hover { background: var(--bg); color: var(--brand-dark); }
.nav-links a.active { background: var(--brand); color: #fff; }

/* ===== أزرار ===== */
.btn {
  display: inline-block;
  padding: 10px 24px;
  border-radius: 10px;
  border: none;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
  background: var(--brand);
  color: #fff;
}
.btn:hover { background: var(--brand-dark); }
.btn.secondary { background: var(--card); color: var(--brand-dark); border: 2px solid var(--brand); }
.btn.secondary:hover { background: var(--bg); }
.btn.accent { background: var(--accent); color: #3d2c0a; }
.btn.accent:hover { filter: brightness(0.93); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 5px 14px; font-size: 0.9rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== الهيرو (الصفحة الرئيسية) ===== */
.hero {
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  color: #fff;
  padding: 70px 0;
  text-align: center;
}
.hero h1 { font-size: 2.4rem; font-weight: 900; margin-bottom: 12px; }
.hero h1 em { color: var(--accent); font-style: normal; }
.hero p { font-size: 1.15rem; opacity: 0.92; max-width: 650px; margin: 0 auto 28px; }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  padding: 50px 0;
}
.feature {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.feature .icon { font-size: 2rem; margin-bottom: 8px; }
.feature h3 { color: var(--brand-dark); margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: 0.95rem; }

/* ===== عناوين الأقسام ===== */
.section-title {
  font-size: 1.7rem;
  font-weight: 900;
  color: var(--brand-dark);
  margin: 36px 0 20px;
  padding-right: 14px;
  border-right: 5px solid var(--accent);
}

/* ===== كروت الكورسات ===== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 22px;
  padding-bottom: 50px;
}

.course-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.course-card:hover { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(34,48,62,0.14); }

.course-card .thumb {
  height: 165px;
  background: var(--brand-dark);
  overflow: hidden;
}
.course-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.course-card .thumb .placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 2.5rem; font-weight: 900;
}

.course-card .body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.course-card h3 { font-size: 1.1rem; margin-bottom: 6px; }
.course-card p { color: var(--muted); font-size: 0.92rem; flex: 1; }
.course-card .meta {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  color: var(--brand-dark);
  font-weight: 700;
}

/* شريط التقدم */
.progress-bar {
  background: var(--line);
  border-radius: 20px;
  height: 9px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-bar > div {
  height: 100%;
  background: var(--accent);
  border-radius: 20px;
  transition: width 0.4s;
}

/* ===== صفحة الكورس ===== */
.course-head {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  margin: 34px 0;
  align-items: start;
}
@media (max-width: 760px) { .course-head { grid-template-columns: 1fr; } }

.course-head img { border-radius: var(--radius); box-shadow: var(--shadow); }
.course-head h1 { font-size: 1.9rem; color: var(--brand-dark); margin-bottom: 10px; }
.course-head .desc { color: var(--muted); font-size: 1.05rem; }

.unit-list { list-style: none; margin-bottom: 60px; }
.unit-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: 0.2s;
  box-shadow: var(--shadow);
}
.unit-item:hover { border-color: var(--brand); transform: translateX(-4px); }
.unit-item .num {
  min-width: 42px; height: 42px;
  background: var(--bg);
  border: 2px solid var(--brand);
  color: var(--brand-dark);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900;
}
.unit-item.done .num { background: var(--brand); color: #fff; }
.unit-item .info { flex: 1; }
.unit-item .info h4 { font-size: 1.05rem; }
.unit-item .status { font-size: 0.85rem; font-weight: 700; }
.unit-item .status.done { color: var(--brand); }
.unit-item .status.pending { color: var(--muted); }

/* ===== صفحة الدرس ===== */
.lesson-title { margin: 26px 0 14px; font-size: 1.5rem; color: var(--brand-dark); }

.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 3px solid var(--line);
  margin-bottom: 0;
}
.tab-btn {
  padding: 10px 26px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  border-radius: 10px 10px 0 0;
}
.tab-btn.active { background: var(--brand); color: #fff; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.video-wrap {
  position: relative;
  padding-top: 56.25%;
  background: #000;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.video-wrap iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
}

.slides-frame {
  width: 100%;
  height: 70vh;
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  background: #fff;
}

.watch-note {
  background: #fdf3df;
  border: 1px solid #f0d9a8;
  border-radius: 10px;
  padding: 12px 18px;
  margin: 16px 0;
  font-weight: 600;
  color: #7a5b16;
}
.watch-note.ok { background: #e5f3ec; border-color: #bfe0d1; color: var(--brand-dark); }

/* ===== الأسئلة ===== */
.quiz-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin: 24px 0 60px;
  box-shadow: var(--shadow);
}
.quiz-box h3 { color: var(--brand-dark); margin-bottom: 16px; }

.question { margin-bottom: 22px; }
.question .q-text { font-weight: 700; margin-bottom: 10px; }
.option {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: 0.15s;
}
.option:hover { border-color: var(--brand); }
.option.selected { border-color: var(--brand); background: #e5f3ec; }
.option.correct { border-color: var(--brand); background: #d9efe4; }
.option.wrong { border-color: var(--danger); background: #f8e3e0; }
.option input { accent-color: var(--brand); }

.quiz-result {
  font-size: 1.15rem;
  font-weight: 900;
  padding: 14px 18px;
  border-radius: 10px;
  margin-top: 14px;
}
.quiz-result.pass { background: #d9efe4; color: var(--brand-dark); }
.quiz-result.fail { background: #f8e3e0; color: var(--danger); }

/* ===== صفحة عني ===== */
.about-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px;
  margin: 40px 0;
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 28px;
  align-items: center;
}
@media (max-width: 600px) { .about-card { grid-template-columns: 1fr; text-align: center; } }

.avatar {
  width: 150px; height: 150px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 3.5rem; font-weight: 900;
  margin: 0 auto;
  border: 5px solid var(--accent);
}

.contact-list { list-style: none; margin: 30px 0 60px; }
.contact-list li {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 20px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}
.contact-list .icon { font-size: 1.3rem; }
.contact-list a { color: var(--brand-dark); }
.contact-list a:hover { text-decoration: underline; }

/* ===== الفوتر ===== */
footer.site-footer {
  margin-top: auto;
  background: var(--ink);
  color: #cdd6de;
  text-align: center;
  padding: 20px 0;
  font-size: 0.95rem;
}

/* ===== الأدمن ===== */
.admin-login {
  max-width: 380px;
  margin: 80px auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
  box-shadow: var(--shadow);
}
.admin-login h2 { color: var(--brand-dark); margin-bottom: 18px; text-align: center; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 700; margin-bottom: 5px; font-size: 0.95rem; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 9px 12px;
  border: 2px solid var(--line);
  border-radius: 9px;
  font-family: inherit;
  font-size: 0.98rem;
  background: #fff;
}
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--brand); }
.form-group textarea { resize: vertical; min-height: 80px; }

.admin-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.admin-section h3 { color: var(--brand-dark); margin-bottom: 14px; }

.admin-course {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
  background: var(--bg);
}
.admin-course-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin-course-head h4 { font-size: 1.1rem; }

.admin-unit {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.q-editor {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--bg);
}

.msg { padding: 10px 16px; border-radius: 8px; margin: 10px 0; font-weight: 700; display: none; }
.msg.ok { background: #d9efe4; color: var(--brand-dark); display: block; }
.msg.err { background: #f8e3e0; color: var(--danger); display: block; }

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
