:root {
  --navy: #073955;
  --navy-2: #0b5270;
  --teal: #0f9f9a;
  --teal-soft: #e6f7f5;
  --orange: #f06b22;
  --ink: #102b3a;
  --muted: #607681;
  --surface: #ffffff;
  --background: #f4f8fa;
  --line: #dce7ec;
  --shadow: 0 10px 28px rgba(7, 57, 85, .10);
  --radius: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--background);
  min-height: 100vh;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
button, input { font: inherit; }
button { cursor: pointer; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 18px 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
}
.topbar h1 { margin: 2px 0 0; font-size: 20px; }
.eyebrow { margin: 0; font-size: 12px; opacity: .75; }
.icon-button {
  width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.3);
  border-radius: 14px; color: #fff; background: rgba(255,255,255,.08); font-size: 22px;
}
main { max-width: 760px; margin: 0 auto; padding: 16px; }
.hero {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px; border-radius: 24px; color: #fff;
  background: radial-gradient(circle at 15% 10%, #17aaa6 0, transparent 42%), linear-gradient(135deg, #075174, #062e49);
  box-shadow: var(--shadow); overflow: hidden;
}
.hero h2 { margin: 10px 0 6px; font-size: clamp(23px, 6vw, 34px); }
.hero p { margin: 0; line-height: 1.7; opacity: .86; }
.hero-icon { font-size: 58px; filter: drop-shadow(0 8px 12px rgba(0,0,0,.2)); }
.pill { display: inline-block; padding: 5px 10px; border: 1px solid rgba(255,255,255,.35); border-radius: 99px; font-size: 12px; }

.search { display: flex; gap: 8px; margin: 16px 0 22px; }
.search input {
  min-width: 0; flex: 1; border: 1px solid var(--line); border-radius: 16px;
  padding: 13px 15px; color: var(--ink); background: var(--surface); outline: none;
}
.search input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15,159,154,.12); }
.search button { border: 0; border-radius: 16px; padding: 0 18px; color: #fff; background: var(--teal); font-weight: 800; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 22px 2px 12px; }
.section-heading span { color: var(--teal); font-size: 12px; font-weight: 700; }
.section-heading h2 { margin: 2px 0 0; font-size: 21px; }
.link-button { border: 0; color: var(--teal); background: transparent; font-weight: 800; }
.course-heading { margin-top: 28px; }

.category-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.category-card {
  display: flex; align-items: center; gap: 10px; min-height: 76px; padding: 13px;
  border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: var(--surface); text-align: right;
}
.category-card:hover { border-color: var(--teal); transform: translateY(-1px); }
.category-icon { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; border-radius: 14px; background: var(--teal-soft); font-size: 23px; }
.category-card strong { display: block; font-size: 14px; }
.category-card small { color: var(--muted); }

.cards { display: grid; gap: 13px; }
.card {
  position: relative; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: 0 5px 18px rgba(7,57,85,.055);
}
.course-card { border-top: 4px solid var(--teal); }
.card-head { display: flex; align-items: flex-start; gap: 12px; }
.card-icon { display: grid; place-items: center; width: 54px; height: 54px; flex: 0 0 54px; border-radius: 17px; background: linear-gradient(145deg, var(--teal-soft), #fff2e9); font-size: 28px; }
.card h3 { margin: 0 0 5px; font-size: 18px; line-height: 1.45; }
.card p { margin: 0; color: var(--muted); line-height: 1.65; font-size: 14px; }
.price { margin-top: 11px; color: var(--orange); font-weight: 900; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.actions a { display: grid; place-items: center; min-height: 43px; padding: 8px; border-radius: 13px; text-decoration: none; font-weight: 800; font-size: 14px; }
.primary { color: #fff; background: var(--orange); }
.secondary { color: var(--teal); border: 1px solid var(--teal); background: transparent; }
.post-card { cursor: pointer; }
.post-card:hover { border-color: var(--teal); }
.post-meta { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 9px; }
.post-meta span { padding: 4px 8px; border-radius: 20px; color: var(--navy); background: var(--teal-soft); font-size: 11px; }
.compact .card { padding: 15px; }
.view { display: none; }
.view.active { display: block; animation: show .18s ease-out; }
.empty { padding: 35px 18px; border: 1px dashed var(--line); border-radius: var(--radius); text-align: center; color: var(--muted); }
.empty span { font-size: 36px; }
.loading { min-height: 110px; opacity: .55; }
.loading::after { content: "جارٍ التحميل…"; display: grid; place-items: center; min-height: 90px; color: var(--muted); }

.bottom-nav {
  position: fixed; z-index: 20; right: 0; bottom: 0; left: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px);
}
.nav-item { display: grid; justify-items: center; gap: 2px; border: 0; border-radius: 14px; padding: 7px; color: var(--muted); background: transparent; font-size: 12px; }
.nav-item span { font-size: 22px; line-height: 1; }
.nav-item.active { color: #fff; background: var(--teal); }

body.dark {
  --ink: #e7f0f3; --muted: #9bb0ba; --surface: #102d3c; --background: #071e2a;
  --line: #274653; --teal-soft: #143f45; --shadow: 0 10px 28px rgba(0,0,0,.28);
}
@keyframes show { from { opacity: 0; transform: translateY(4px); } }
@media (min-width: 620px) {
  .category-grid { grid-template-columns: repeat(3, 1fr); }
  .cards:not(.compact) { grid-template-columns: repeat(2, 1fr); }
}

