/* ============================================
   جامع السعادات - ملف الأنماط الرئيسي
   ============================================ */

:root {
  --ink: #17312b;
  --muted: #67756f;
  --green: #0c4a3c;
  --green-2: #176650;
  --mint: #e9f0e9;
  --cream: #f8f4ec;
  --gold: #c69b52;
  --line: #dfe5dd;
  --white: #fff;
  --surface: #fff;
  --surface-muted: #fafafa;
  --reading-text: #2d3748;
  --reading-muted: #4a5c56;
  --shadow: 0 18px 50px rgba(17,47,38,.09);
  --radius: 12px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e6eee9;
  --muted: #aab9b1;
  --green: #28684f;
  --green-2: #85d3b2;
  --mint: #202c27;
  --cream: #19211d;
  --gold: #d3ad69;
  --line: #3a4941;
  --white: #242e29;
  --surface: #222c27;
  --surface-muted: #1c2521;
  --reading-text: #e0e8e3;
  --reading-muted: #c1cdc6;
  --shadow: 0 18px 50px rgba(0,0,0,.22);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  font: 15px/1.8 'Cairo', sans-serif;
  direction: rtl;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

/* ── Layout ── */
.shell { width: min(1180px, calc(100% - 40px)); margin: auto; }

/* ── Navigation ── */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.navin { height: 78px; display: flex; align-items: center; gap: 38px; }
.brand { display: flex; align-items: center; gap: 11px; margin-left: auto; }
.mark {
  width: 39px; height: 39px; border-radius: var(--radius);
  background: var(--green); color: #e7c27c;
  display: grid; place-items: center;
  font-family: Amiri, serif; font-size: 24px;
}
.brand strong { display: block; font: 800 17px 'Cairo', sans-serif; }
.links { display: flex; gap: 27px; color: #44534d; font-size: 13px; font-weight: 600; }
.links a:hover { color: var(--green); }

/* ── Buttons ── */
.nav-cta, .btn-primary {
  border: 0; border-radius: 9px;
  background: var(--green); color: white;
  padding: 11px 20px; font-weight: 700; transition: background .2s;
}
.nav-cta:hover, .btn-primary:hover { background: var(--green-2); }
.btn-gold {
  border: 0; border-radius: 9px;
  background: var(--gold); color: white;
  padding: 11px 20px; font-weight: 700; transition: background .2s;
}
.btn-gold:hover { background: #b08840; }
.btn-outline {
  border: 2px solid var(--green); border-radius: 9px;
  background: transparent; color: var(--green);
  padding: 9px 18px; font-weight: 700; transition: all .2s;
}
.btn-outline:hover { background: var(--green); color: white; }

/* ── Mobile Menu ── */
.menu { display: none; border: 0; background: none; font-size: 23px; color: var(--green); }
.mobile-nav {
  display: flex; position: fixed; inset: 0;
  background: rgba(12,74,60,.96); z-index: 200;
  flex-direction: column; align-items: center; justify-content: center; gap: 32px;
  opacity: 0; transform: translateY(-10px); pointer-events: none; visibility: hidden;
  transition: opacity .32s ease, transform .32s ease, visibility .32s;
}
.mobile-nav.open { opacity: 1; transform: translateY(0); pointer-events: auto; visibility: visible; }
.mobile-nav a { color: white; font-size: 22px; font-weight: 700; }
.mobile-nav .close-menu {
  position: absolute; top: 22px; left: 22px;
  font-size: 28px; color: white; background: none; border: 0;
}

/* ── Hero ── */
.hero { background: var(--cream); padding: 74px 0 68px; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.02fr .98fr; gap: 70px; align-items: center; }
.eyebrow { color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: .05em; }
.hero h1 { font: 800 clamp(39px,5vw,67px)/1.2 'Cairo', sans-serif; margin: 16px 0 20px; max-width: 590px; }
.hero h1 em { color: var(--green-2); font-family: Amiri, serif; font-style: normal; font-weight: 700; }
.hero p { color: var(--muted); font-size: 17px; max-width: 520px; margin: 0 0 30px; }

/* ── Search ── */
.search {
  display: flex; max-width: 570px; padding: 7px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 11px; box-shadow: 0 8px 22px rgba(30,50,43,.06);
}
.search input {
  min-width: 0; flex: 1; border: 0;
  padding: 11px 13px; outline: 0;
  color: var(--ink); text-align: right; background: transparent;
}
.search input::placeholder {
  color: #8c9b94;
  opacity: 1;
}
.search button {
  border: 0; border-radius: 7px;
  background: var(--gold); color: #fff;
  padding: 0 19px; font-weight: 700; transition: background .2s;
}
.search button:hover { background: #b08840; }

/* ── Hero Art ── */
.hero-art {
  position: relative;
  min-height: 350px;
  isolation: isolate;
}
.hero-photo {
  width: 100%; height: 350px; object-fit: cover; object-position: center;
  border-radius: 18px 130px 18px 18px;
  display: block;
  box-shadow: 0 20px 34px rgba(17,47,38,.16);
}
.stamp {
  position: absolute; right: 0; bottom: 0; left: 0;
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 58px 28px 22px; border-radius: 0 0 18px 18px;
  color: white;
  background: linear-gradient(0deg, rgba(8,39,31,.88), rgba(8,39,31,.42) 58%, transparent);
}
.stamp b { display: block; font: 800 38px/1.25 'Cairo', sans-serif; color: #f0ce86; text-shadow: 0 2px 12px rgba(0,0,0,.3); }
.stamp span { font-size: 13px; font-weight: 700; color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.5); }
/* ── Quick Links ── */
.quick {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; margin-top: -31px; position: relative; z-index: 2;
}
.quick a {
  padding: 20px 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  text-align: center; font-weight: 600; font-size: 13px;
  box-shadow: var(--shadow); transition: all .2s;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.quick a:hover { border-color: var(--green); color: var(--green); transform: translateY(-3px); }
.quick a .icon { font-size: 28px; }

/* ── Sections ── */
.section { padding: 74px 0; }
.section.tint { background: var(--mint); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 32px; }
.section-head h2 { font: 700 29px 'Cairo', sans-serif; margin: 7px 0 0; }
.section-head p { color: var(--muted); margin: 6px 0 0; }
.view-all { color: var(--green-2); font-weight: 700; font-size: 13px; }
.view-all:hover { text-decoration: underline; }

/* ── Cards ── */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 24px; }
.card {
  border: 1px solid var(--line); border-radius: 16px;
  overflow: hidden; background: var(--surface); box-shadow: var(--shadow);
  transition: transform .25s, box-shadow .25s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-5px); box-shadow: 0 28px 60px rgba(17,47,38,.13); }
.thumb { position: relative; aspect-ratio: 16/9; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card:hover .thumb img { transform: scale(1.05); }
.tag {
  position: absolute; top: 12px; right: 12px;
  background: var(--green); color: white;
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px;
}
.type-badge {
  position: absolute; top: 12px; left: 12px;
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px;
}
.type-badge.lesson { background: var(--green); color: white; border: 1px solid var(--gold); }
.type-badge.video  { background: #e53935; color: white; }
.type-badge.audio  { background: #1565c0; color: white; }
.type-badge.text   { background: #6a1b9a; color: white; }
.type-badge.clip   { background: #d97706; color: white; }
.card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.card-body h3 { margin: 0 0 6px; font-size: 16px; line-height: 1.4; }
.meta { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.desc { color: var(--reading-muted); font-size: 13px; line-height: 1.7; flex: 1; margin: 0 0 16px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.watch {
  border: 0; border-radius: 8px; background: var(--green); color: white;
  padding: 9px 16px; font-weight: 700; font-size: 13px; transition: background .2s;
}
.watch:hover { background: var(--green-2); }
.duration { color: var(--muted); font-size: 12px; }

/* ── Feature ── */
.feature { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); }
.feature img { width: 100%; min-height: 320px; object-fit: cover; display: block; }
.feature-copy {
  padding: 50px 44px; display: flex; flex-direction: column;
  justify-content: center; background: var(--green); color: white;
}
.feature-copy h2 { font: 700 28px 'Cairo', sans-serif; margin: 0 0 14px; }
.feature-copy p { opacity: .85; margin: 0 0 24px; }

/* ── Speakers ── */
.speakers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.speaker-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 28px 22px; text-align: center; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s;
  cursor: pointer; position: relative;
}
.speaker-card:hover { transform: translateY(-4px); box-shadow: 0 10px 24px rgba(0,0,0,0.08); border-color: var(--gold); }
.speaker-avatar {
  width: 90px; height: 90px; border-radius: 50%;
  background: var(--mint); margin: 0 auto 14px;
  display: grid; place-items: center; font-size: 30px;
  overflow: hidden; border: 3px solid var(--gold); box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.speaker-avatar img {
  width: 100%; height: 100%; object-fit: cover; object-position: center top;
}
.speaker-card h4 { margin: 0 0 4px; font-size: 16px; color: var(--green); }
.speaker-card p { color: var(--muted); font-size: 12px; margin: 0; }
.speaker-count {
  display: inline-block; margin-top: 10px;
  background: var(--mint); color: var(--green);
  font-size: 11px; font-weight: 700; padding: 4px 12px; border-radius: 20px;
}
.speaker-bio-btn {
  display: inline-block; margin-top: 12px; font-size: 12px; font-weight: 700; color: var(--gold);
}

/* ── Speaker Bio Modal ── */
.bio-modal-content {
  background: var(--surface); border-radius: 16px; width: 90%; max-width: 750px;
  max-height: 88vh; overflow-y: auto; padding: 32px; position: relative;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3); line-height: 1.8;
}
.bio-modal-content .modal-close {
  position: sticky;
  top: 0;
  z-index: 1;
  float: left;
  width: 38px;
  height: 38px;
  margin: -12px -12px 0 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--green-2);
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.bio-header {
  display: flex; gap: 24px; align-items: center; border-bottom: 2px solid var(--mint);
  padding-bottom: 24px; margin-bottom: 24px;
}
.bio-avatar {
  width: 120px; height: 120px; border-radius: 50%; border: 4px solid var(--gold);
  object-fit: cover; object-position: center top; flex-shrink: 0; box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.bio-section-title {
  color: var(--green); font-size: 17px; font-weight: 800; margin: 20px 0 8px;
  display: flex; align-items: center; gap: 8px; border-right: 4px solid var(--gold); padding-right: 10px;
}
.bio-text { color: var(--ink); font-size: 15px; margin-bottom: 12px; text-align: justify; }
.bio-list { list-style: none; padding: 0; margin: 0 0 16px; }
.bio-list li {
  position: relative; padding-right: 22px; margin-bottom: 10px; font-size: 14.5px; color: var(--ink);
}
.bio-list li::before {
  content: '✦'; position: absolute; right: 0; top: 0; color: var(--gold); font-size: 13px;
}

/* ── Stats Bar ── */
.stats-bar { background: var(--green); color: white; padding: 40px 0; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; text-align: center; }
.stat-item b { display: block; font: 800 36px 'Cairo', sans-serif; color: #e4bc70; }
.stat-item span { font-size: 13px; opacity: .8; }

/* ── Archive Page ── */
.archive-tools { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 28px; align-items: center; }
.archive-tools .search { flex: 1; min-width: 260px; }
.archive-tools select { padding: 12px 16px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer; }
.filter-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-tag { padding: 7px 16px; border: 1px solid var(--line); border-radius: 20px; font-size: 12px; font-weight: 600; background: var(--surface); color: var(--ink); cursor: pointer; transition: all .2s; }
.filter-tag:hover, .filter-tag.active { background: var(--green); color: white; border-color: var(--green); }
.sort-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.results-count { color: var(--muted); font-size: 13px; }

/* ── Detail Page ── */
.detail-head { background: var(--green); color: white; padding: 40px 44px; border-radius: 18px 18px 0 0; }
.detail-head .eyebrow { color: #e4bc70; }
.detail-head h1 { font: 700 32px 'Cairo', sans-serif; margin: 10px 0 16px; }
.detail-head .meta { color: rgba(255,255,255,.7); font-size: 13px; }
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 28px; }
.detail-main { background: var(--surface); border: 1px solid var(--line); border-radius: 0 0 0 18px; overflow: hidden; }
.detail-media { background: #000; aspect-ratio: 16/9; }
.detail-media iframe, .detail-media video { width: 100%; height: 100%; }
.detail-media.media-with-audio { display: flex; flex-direction: column; aspect-ratio: auto; background: var(--surface); }
.media-video { width: 100%; aspect-ratio: 16/9; flex: 0 0 auto; background: #000; }
.media-video iframe { display: block; width: 100%; height: 100%; }
.media-audio-panel { flex: 0 0 auto; padding: 16px 20px; background: var(--mint); border-top: 2px solid var(--gold); }
.media-audio-title { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; color: var(--green); font-size: 13px; font-weight: 700; }
.media-audio-panel iframe { display: block; width: 100%; height: 166px; }
.media-audio-panel audio { display: block; width: 100%; min-height: 54px; }
.detail-media.audio-only { background: var(--mint); display: grid; place-items: center; aspect-ratio: unset; padding: 30px; }
.detail-media.audio-only audio { width: 100%; height: 54px; }
/* ── Detail Body & Markdown Styling ── */
.detail-body { padding: 32px 40px; direction: rtl; text-align: right; }
.reading-toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.reading-toggle {
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-muted);
  color: var(--ink);
  font-weight: 700;
  transition: background .2s, border-color .2s;
}
.reading-toggle:hover, .reading-toggle:focus-visible { background: var(--mint); border-color: var(--green-2); }
.detail-body h3 { font-size: 20px; font-weight: 700; color: var(--green); margin: 24px 0 14px; border-right: 4px solid var(--gold); padding-right: 12px; }
.detail-body p { color: var(--reading-text); line-height: 1.9; font-size: 15px; margin-bottom: 16px; }
.detail-body ul, .detail-body ol { padding-right: 24px; color: var(--reading-text); line-height: 2; font-size: 15px; margin-bottom: 18px; }
.reading-toolbar + h3 { margin-top: 0; }
.detail-body li { margin-bottom: 6px; }
.detail-body li::marker { color: var(--gold); font-weight: bold; }
.detail-body strong { color: var(--green-2); font-weight: 700; }
.detail-body blockquote { margin: 18px 0; padding: 14px 20px; background: var(--mint); border-right: 4px solid var(--green-2); border-radius: 6px; color: var(--green-2); font-style: italic; font-size: 15px; }
#detail.large-reading-text .detail-body p,
#detail.large-reading-text .detail-body ul,
#detail.large-reading-text .detail-body ol,
#detail.large-reading-text .detail-body blockquote,
#detail.large-reading-text .detail-body .points-list li,
#detail.large-reading-text .detail-body .detail-table { font-size: 18px; }
#detail.large-reading-text .detail-body h3 { font-size: 24px; }
#detail.large-reading-text .detail-body { line-height: 2.1; }

/* ── Rich Markdown Tables ── */
.table-wrapper { overflow-x: auto; margin: 20px 0; border-radius: 10px; border: 1px solid var(--line); box-shadow: 0 2px 6px rgba(0,0,0,0.03); }
.detail-table { width: 100%; border-collapse: collapse; direction: rtl; text-align: right; font-size: 14px; }
.detail-table th { background: var(--mint); color: var(--green-2); font-weight: 700; padding: 12px 16px; border-bottom: 2px solid var(--line); }
.detail-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--reading-text); }
.detail-table tr:last-child td { border-bottom: none; }
.detail-table tr:nth-child(even) { background: var(--surface-muted); }
.detail-table tr:hover { background: var(--mint); }

/* ── Points Checklist / Badges ── */
.points-list { list-style: none; padding: 0 !important; display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.points-list li { display: flex; align-items: flex-start; gap: 10px; background: var(--surface-muted); border: 1px solid var(--line); padding: 10px 16px; border-radius: 8px; font-size: 14px; color: var(--reading-text); margin-bottom: 0; }
.points-list li::before { content: "✦"; color: var(--gold); font-weight: bold; font-size: 16px; line-height: 1.2; flex-shrink: 0; }

.media-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }

.detail-side { display: flex; flex-direction: column; gap: 16px; }
.btn-action-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.btn-action-yt {
  background: #ff0000;
  color: #ffffff !important;
  border: 1px solid #e00000;
}
.btn-action-yt:hover {
  background: #cc0000;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255,0,0,0.25);
}
.btn-action-sc {
  background: #ff5500;
  color: #ffffff !important;
  border: 1px solid #e04b00;
}
.btn-action-sc:hover {
  background: #e04b00;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255,85,0,0.25);
}
.btn-action-pdf {
  background: var(--mint);
  color: var(--green-2) !important;
  border: 1px solid var(--line);
  cursor: pointer;
}
.btn-action-pdf:hover {
  background: var(--mint);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(17,47,38,0.12);
}
.btn-action-link svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.info-box { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.info-box h4 { margin: 0 0 14px; font-size: 14px; color: var(--muted); }
.info-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.info-row:last-child { border-bottom: 0; }
.info-row span:first-child { color: var(--muted); }
.info-row span:last-child { font-weight: 600; }
.related-list { display: flex; flex-direction: column; gap: 12px; }
.related-item { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 10px; transition: background .2s; cursor: pointer; }
.related-item:hover { background: var(--mint); }
.related-thumb { width: 60px; height: 45px; border-radius: 7px; object-fit: cover; flex-shrink: 0; }
.related-item h5 { margin: 0 0 3px; font-size: 13px; line-height: 1.3; }
.related-item span { font-size: 11px; color: var(--muted); }

/* ── Admin Panel ── */
.admin-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 150; overflow-y: auto; padding: 30px 20px; }
.admin-overlay.open { display: block; }
.admin-modal { background: var(--surface); border-radius: 20px; max-width: 760px; margin: auto; box-shadow: 0 30px 80px rgba(0,0,0,.2); }
.admin-modal-head { background: var(--green); color: white; padding: 22px 30px; border-radius: 20px 20px 0 0; display: flex; justify-content: space-between; align-items: center; }
.admin-modal-head h3 { margin: 0; font-size: 18px; }
.admin-modal-body { padding: 28px 30px; }
.close-admin { background: none; border: 0; color: white; font-size: 22px; line-height: 1; }
.admin-toggle { position: fixed; bottom: 28px; left: 28px; width: 56px; height: 56px; border-radius: 50%; background: var(--gold); color: white; border: 0; font-size: 24px; box-shadow: 0 8px 24px rgba(198,155,82,.5); z-index: 50; transition: transform .2s; }
.admin-toggle:hover { transform: scale(1.1); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; color: var(--ink); }
.field input, .field select, .field textarea { padding: 11px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-muted); color: var(--ink); transition: border-color .2s, box-shadow .2s; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 0; border-color: var(--green); box-shadow: 0 0 0 3px rgba(12,74,60,.1); background: var(--surface); }
.field textarea { resize: vertical; min-height: 90px; }
.field .hint { font-size: 11px; color: var(--muted); }
.form-actions { display: flex; gap: 12px; margin-top: 20px; }

/* ── Admin editor improvements ── */
.admin-overlay.open { display: grid; place-items: center; }
.admin-modal {
  width: min(920px, 100%);
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.admin-modal-head { flex: 0 0 auto; }
.admin-modal-body { overflow-y: auto; overscroll-behavior: contain; }
.admin-modal .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.admin-modal .field { min-width: 0; }
.admin-modal .field input,
.admin-modal .field select,
.admin-modal .field textarea { width: 100%; min-width: 0; box-sizing: border-box; min-height: 46px; }
.admin-modal .field textarea { line-height: 1.8; }
#fSummary { direction: rtl; text-align: right; }
.format-toolbar { display: flex; flex-wrap: wrap; gap: 7px; }
.format-toolbar button {
  min-height: 38px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  transition: background .18s, border-color .18s, transform .18s;
}
.format-toolbar button:hover,
.format-toolbar button:focus-visible {
  background: var(--mint);
  border-color: var(--green);
}
.format-toolbar .ai-format-button { background: #f3efff; border-color: #d7c8ff; color: #5436a4; }
.format-toolbar .ai-format-button:hover,
.format-toolbar .ai-format-button:focus-visible { background: #e8deff; border-color: #8d70d6; }
.format-toolbar .ai-format-button:disabled { opacity: .65; cursor: wait; }
.format-toolbar button:active { transform: translateY(1px); }
.image-embed-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; }
.image-embed-controls button {
  min-height: 46px;
  padding: 8px 13px;
  border: 1px solid var(--green);
  border-radius: 9px;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.image-embed-controls button:hover { background: #083a30; }
.summary-preview-wrap { margin-top: 8px; }
.summary-preview-title { margin-bottom: 8px; color: var(--green); font-size: 12px; font-weight: 800; }
.summary-preview {
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-muted);
  color: var(--ink);
  overflow-wrap: anywhere;
  direction: rtl;
  text-align: right;
}
.summary-preview .table-wrapper,
.detail-body .table-wrapper { direction: rtl; }
.summary-preview .detail-table,
.detail-body .detail-table { direction: rtl; text-align: right; }
.summary-preview .hint { color: var(--muted); }
.summary-preview h3 { margin: 10px 0; color: var(--green); font-size: 16px; }
.summary-preview p { margin: 0 0 10px; line-height: 1.8; }
.summary-preview p:last-child { margin-bottom: 0; }
.summary-preview ul,
.summary-preview ol { padding-inline-start: 24px; margin: 8px 0; line-height: 1.8; }
.summary-preview img,
.detail-body .summary-image img { width: 100%; max-height: 420px; border-radius: 12px; object-fit: contain; background: #f2f5f2; }
.summary-image { margin: 18px 0; text-align: center; }
.summary-image figcaption { margin-top: 7px; color: var(--muted); font-size: 12px; }
.summary-image-fallback { display: inline-flex; padding: 10px 14px; border-radius: 9px; background: var(--mint); color: var(--green); font-weight: 700; }
.summary-preview blockquote { margin: 10px 0; padding: 10px 14px; border-right: 3px solid var(--gold); background: var(--mint); }
.form-actions { flex-wrap: wrap; }
.form-actions > button { min-height: 44px; }

/* ── Toast ── */
.toast { position: fixed; bottom: 30px; right: 30px; background: var(--green); color: white; padding: 14px 22px; border-radius: 10px; font-weight: 700; font-size: 14px; z-index: 999; box-shadow: var(--shadow); transform: translateY(80px); opacity: 0; transition: all .3s; }
.toast.show { transform: translateY(0); opacity: 1; }

/* ── Page Sharing ── */
.share-widget { position: fixed; bottom: 24px; left: 24px; z-index: 90; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.share-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 12px 17px; border: 0; border-radius: 999px; background: var(--green); color: #fff; box-shadow: 0 8px 24px rgba(17,47,38,.24); font-weight: 700; transition: background .2s, transform .2s; }
.share-toggle:hover { background: var(--green-2); transform: translateY(-2px); }
.share-toggle svg { width: 21px; height: 21px; fill: currentColor; }
.share-menu { display: grid; gap: 4px; min-width: 210px; padding: 8px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow); }
.share-menu[hidden] { display: none; }
.share-menu a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; font-size: 13px; font-weight: 700; transition: background .2s; }
.share-menu a:hover { background: var(--mint); }
.share-menu svg { width: 19px; height: 19px; fill: var(--green); flex: 0 0 auto; }

/* ── Footer ── */
.footer { background: var(--green); color: #c9ddd6; padding: 60px 0 32px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 48px; }
.footer h5 { color: white; font-size: 14px; margin: 0 0 16px; }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer ul li { margin-bottom: 10px; }
.footer ul li a:hover { color: white; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding-top: 24px; display: flex; justify-content: space-between; font-size: 12px; opacity: .6; }

/* ── Page Visibility ── */
.home { display: block; }
.home.hidden { display: none; }
.section-page { display: none; }
.section-page.active { display: block; }
.questions-section { min-height: 75vh; }
.questions-frame {
  display: block;
  width: 100%;
  height: 520px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .icon { font-size: 60px; margin-bottom: 16px; }
.empty-state h3 { font-size: 20px; color: var(--ink); margin-bottom: 8px; }
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 36px; }
.page-btn { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font-weight: 600; transition: all .2s; }
.page-btn:hover, .page-btn.active { background: var(--green); color: white; border-color: var(--green); }

/* ── Responsive ── */
@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .speakers { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > div:first-child { grid-column: span 2; }
  .detail-grid { grid-template-columns: 1fr; }
  .feature { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .shell { width: min(100% - 28px, 620px); }
  .share-widget { bottom: max(18px, env(safe-area-inset-bottom)); left: 14px; }
  .navin { height: 66px; }
  .links, .nav-cta { display: none; }
  .menu { display: block; }
  .hero { padding: 46px 0; }
  .hero-grid { display: block; }
  .hero h1 { font-size: 38px; }
  .hero-art { min-height: 240px; margin-top: 32px; }
  .hero-photo { height: 250px; }
  .stamp { padding: 46px 20px 17px; }
  .stamp b { font-size: 32px; }
  .stamp span { font-size: 12px; }
  .quick { grid-template-columns: repeat(2, 1fr); }
  .quick a:last-child { grid-column: span 2; }
  .section { padding: 50px 0; }
  .detail-head { padding: 28px 22px; }
  .detail-head h1 { font-size: 24px; }
  .detail-body { padding: 22px; }
  .admin-modal-body { padding: 20px; }
}
@media (max-width: 600px) {
  .cards { grid-template-columns: 1fr; }
  .speakers { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-grid > div:first-child { grid-column: auto; }
  .form-grid.cols-3 { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  #bioModalOverlay.open { display: grid; place-items: center; padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)); }
  .bio-modal-content {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 20px);
    padding: 20px 17px;
    border-radius: 16px;
    line-height: 1.85;
  }
  .bio-modal-content .modal-close { margin: -7px -5px 0 0; }
  .bio-header {
    flex-direction: column;
    gap: 12px;
    padding: 8px 8px 18px;
    margin-bottom: 18px;
    text-align: center;
  }
  .bio-avatar { width: 104px; height: 104px; }
  .bio-header h2 { font-size: 19px !important; line-height: 1.6; }
  .bio-header p { line-height: 1.7; }
  .bio-section-title { font-size: 15px; line-height: 1.6; margin-top: 17px; }
  .bio-text { font-size: 14px; text-align: right; line-height: 1.9; overflow-wrap: anywhere; }
  .bio-list li { font-size: 13.5px; line-height: 1.8; }
}

@media (max-width: 680px) {
  .admin-overlay.open { place-items: start center; padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)); }
  .admin-modal { max-height: calc(100dvh - 16px); border-radius: 15px; }
  .admin-modal-head { padding: 15px 17px; border-radius: 15px 15px 0 0; }
  .admin-modal-head h3 { font-size: 16px; }
  .admin-modal-body { padding: 16px; }
  .admin-modal .form-grid { grid-template-columns: minmax(0, 1fr); gap: 15px; }
  .admin-modal .form-full { grid-column: auto; }
  .format-toolbar { gap: 6px; }
  .format-toolbar button { min-height: 42px; padding: 7px 10px; }
  .image-embed-controls { grid-template-columns: minmax(0, 1fr); }
  .form-actions { display: grid; grid-template-columns: 1fr; }
  .form-actions > button { width: 100%; }
}



/* ============================================================
   ✨ MODERN ANIMATION & STYLE UPGRADE — 2026
   ============================================================ */
::selection { background: var(--green); color: #f0ce86; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: var(--cream); }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--green), var(--green-2)); border-radius: 999px; }
html { scrollbar-color: var(--green) var(--cream); }

/* Nav glass + shrink */
.nav { transition: background .35s, box-shadow .35s, backdrop-filter .35s; }
.nav.scrolled { background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(18px) saturate(1.2); box-shadow: 0 8px 32px rgba(12,74,60,.10), 0 1px 0 rgba(12,74,60,.06); }
.nav.scrolled .navin { height: 62px; transition: height .3s; }
.links a { position: relative; }
.links a::after { content:""; position:absolute; right:0; bottom:-4px; width:0; height:2px; background: var(--gold); border-radius:999px; transition: width .3s cubic-bezier(.4,0,.2,1); }
.links a:hover::after, .links a.active::after { width:100%; }

:root[data-theme="dark"] .links,
:root[data-theme="dark"] .speaker-card h4,
:root[data-theme="dark"] .bio-section-title,
:root[data-theme="dark"] .detail-body h3,
:root[data-theme="dark"] .media-audio-title,
:root[data-theme="dark"] .summary-preview-title { color: var(--green-2); }

/* Hero mesh + entrance */
.hero { position: relative; }
.hero::before { content:""; position:absolute; inset:0; background: radial-gradient(ellipse 700px 400px at 85% 10%, rgba(198,155,82,.08) 0%, transparent 60%), radial-gradient(ellipse 600px 500px at 15% 90%, rgba(12,74,60,.06) 0%, transparent 55%); pointer-events:none; }
@keyframes fadeUp { from { opacity:0; transform: translateY(22px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes floatY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes pulseGlow { 0%,100% { box-shadow: 0 0 0 0 rgba(198,155,82,.22); } 50% { box-shadow: 0 0 0 10px rgba(198,155,82,0); } }
@keyframes countPop { 0% { transform: scale(.7); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
.hero-grid > div:first-child h1 { animation: fadeUp .8s .1s both; }
.hero-grid > div:first-child p { animation: fadeUp .8s .25s both; }
.hero-grid > div:first-child .search { animation: fadeUp .8s .4s both; }
.hero-art { animation: fadeIn .9s .35s both; }
.hero-photo { transition: transform .7s cubic-bezier(.2,.8,.2,1); }
.hero-art:hover .hero-photo { transform: scale(1.02); }
.stamp { animation: pulseGlow 3s infinite; }
@media (min-width: 901px) { .hero-art { animation: fadeIn .9s .35s both, floatY 6s 1.2s ease-in-out infinite; } }

/* Reveal on scroll */
.reveal { opacity:0; transform: translateY(24px); transition: opacity .7s cubic-bezier(.2,.8,.2,1), transform .7s cubic-bezier(.2,.8,.2,1); }
.reveal.in { opacity:1; transform: translateY(0); }
.reveal-delay-1 { transition-delay: .08s; }
.reveal-delay-2 { transition-delay: .16s; }
.reveal-delay-3 { transition-delay: .24s; }

/* إخفاء عناصر الإدارة افتراضياً لغير المشرف */
body:not(.is-admin) .admin-only {
  display: none !important;
}
body:not(.is-admin) .admin-toggle {
  display: none !important;
}

/* Quick links polish */
.quick a { position: relative; overflow: hidden; }
.quick a::after { content:""; position:absolute; inset:0; background: linear-gradient(100deg, transparent 30%, rgba(198,155,82,.07) 50%, transparent 70%); transform: translateX(-100%); transition: transform .6s; }
.quick a:hover::after { transform: translateX(100%); }
.quick a .icon { transition: transform .35s cubic-bezier(.34,1.56,.64,1); display: inline-block; }
.quick a:hover .icon { transform: translateY(-4px) scale(1.12) rotate(-6deg); }

/* Cards premium hover */
.card { position: relative; transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s, border-color .3s; }
.card::before { content:""; position:absolute; inset:0; border-radius:16px; pointer-events:none; opacity:0; background: linear-gradient(100deg, transparent 40%, rgba(255,255,255,.5) 50%, transparent 60%); transform: translateX(-100%); transition: transform .7s, opacity .3s; z-index:1; }
.card:hover { transform: translateY(-7px); box-shadow: 0 22px 48px rgba(12,74,60,.14), 0 4px 12px rgba(12,74,60,.08); border-color: rgba(198,155,82,.35); }
.card:hover::before { opacity:1; transform: translateX(100%); }
.card .thumb { overflow: hidden; border-radius: 16px 16px 0 0; }
.card .thumb img { transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.card:hover .thumb img { transform: scale(1.07); }

/* Buttons lift */
.btn-primary, .btn-gold, .nav-cta, .btn-outline, .btn-action-link { position: relative; overflow: hidden; transition: transform .2s, box-shadow .25s, background .2s; }
.btn-primary:hover, .btn-gold:hover, .nav-cta:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(12,74,60,.22); }
.btn-primary:active, .btn-gold:active, .nav-cta:active { transform: translateY(0) scale(.98); }

/* Stats bar mesh */
.stats-bar { position: relative; overflow:hidden; }
.stats-bar::before { content:""; position:absolute; inset:0; background: radial-gradient(ellipse 600px 300px at 20% 0%, rgba(198,155,82,.14), transparent 60%), radial-gradient(ellipse 500px 300px at 90% 100%, rgba(255,255,255,.05), transparent 60%); pointer-events:none; }
.stat-item b.counting { animation: countPop .5s ease; }

/* Feature + speakers */
.feature img { transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.feature:hover img { transform: scale(1.03); }

/* Detail head shimmer */
.detail-head { position: relative; overflow:hidden; }
.detail-head::after { content:""; position:absolute; inset:0; background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.06) 45%, transparent 70%); transform: translateX(-100%); animation: shimmerLine 1.2s .6s both; }
@keyframes shimmerLine { to { transform: translateX(100%); } }

/* Footer glow */
.footer { position: relative; }
.footer::before { content:""; position:absolute; top:0; left:0; right:0; height:1px; background: linear-gradient(90deg, transparent, rgba(198,155,82,.35), transparent); }



/* Admin modal pop */
.admin-overlay.open .admin-modal { animation: modalPop .4s cubic-bezier(.34,1.56,.64,1) both; }
@keyframes modalPop { from { opacity:0; transform: scale(.92) translateY(14px); } to { opacity:1; transform: scale(1) translateY(0); } }

/* Page fade */
.page-fade-in { animation: fadeUp .45s both; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; }
  .hero-art { animation: none !important; }
  .reveal { opacity:1; transform:none; }
}

.bismillah-container {
  text-align: center;
  padding: 24px 0 8px;
  background: var(--cream);
}
.bismillah {
  font-family: 'Amiri', serif;
  font-size: 42px;
  color: var(--gold);
  line-height: 1;
  display: inline-block;
  opacity: 0.9;
  text-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Responsive adjustments for Bismillah */
@media (max-width: 600px) {
  .bismillah {
    font-size: 32px;
  }
}
@media (max-width: 400px) {
  .bismillah {
    font-size: 28px;
  }
}