:root{
  --bg:#f4efe7;
  --text:#111;
  --muted:#666;
  --border:#e8e8e8;
  --card:#fafafa;
  --warn:#111; /* أحادي رسمي */
  --radius:14px;
  --shadow: 0 6px 18px rgba(0,0,0,.06);
}

/* ========== Base ========== */
*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; color:var(--text); }
body{
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;
  direction: rtl;
  line-height: 1.75;

  /* PDF-like background */
  background-color: var(--bg);
  background-image: url("../images/pattern.svg");
  background-repeat: repeat;
  background-size: 520px 520px;
  background-attachment: fixed;
}

/* طبقة تلطيف خفيفة عشان تبقى زي PDF */
body::before{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: rgba(255,255,255,0.55);
}

a{ color:inherit; text-decoration:none; }
a:hover{ text-decoration:underline; }

.center{ text-align:center; }

/* خلى كل المحتوى فوق طبقة الخلفية */
.header,
.container{
  position: relative;
  z-index: 1;
}

.container{
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px;
}

/* ========== Header ========== */
.header{
  position: sticky;
  top: 0;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom:1px solid var(--border);
  z-index: 50;
}

.header-inner{
  display:flex;
  align-items:center;
  gap:12px;
  justify-content: space-between;
  padding: 12px 18px;
}

.brand{
  display:flex;
  flex-direction:column;
  gap:2px;
}
.brand h1{
  margin:0;
  font-size: 16px;
  font-weight: 800;
}
.brand small{ color:var(--muted); }

.search{
  display:flex;
  gap:8px;
  align-items:center;
}
.search input{
  width:min(420px, 52vw);
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius: 12px;
  outline: none;
}
.search button{
  padding:10px 12px;
  border:1px solid var(--border);
  background:#fff;
  border-radius:12px;
  cursor:pointer;
}

/* ========== Layout ========== */
.layout{
  display:grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  margin-top: 16px;
}

/* ========== Sidebar (upgraded, CSS-only) ========== */
.sidebar{
  position: sticky;
  top: 78px;
  height: calc(100vh - 100px);
  overflow:auto;

  background:#fff;
  border-radius:18px;
  padding:18px;
  box-shadow:0 10px 30px rgba(0,0,0,.06);
  border:1px solid rgba(0,0,0,.05);
}

.sidebar .nav-title{
  font-size:18px;
  font-weight:800;
  color:#7a5c2e;
  padding-bottom:10px;
  margin: 6px 0 12px;
  border-bottom:2px solid rgba(201,167,123,.35);
  letter-spacing:.2px;
}

.sidebar .nav{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.sidebar .nav a{
  position:relative;
  display:block;
  padding:12px 20px;
  border-radius:12px;
  text-decoration:none;
  color:#2b2b2b;
  background:#faf8f4;
  border:1px solid rgba(0,0,0,.04);
  transition:transform .2s ease, background .2s ease, box-shadow .2s ease, color .2s ease;
  line-height:1.35;
}
.sidebar .nav a:hover{
  background:#f1e6d6;
  transform:translateX(-3px);
  box-shadow:0 6px 18px rgba(0,0,0,.06);
  text-decoration:none;
}
.sidebar .nav a.active{
  background:linear-gradient(90deg, rgba(201,156,93,1), rgba(212,176,122,1));
  color:#fff;
  border-color:transparent;
  box-shadow:0 10px 24px rgba(201,156,93,.22);
}
.sidebar .nav a.active::before{
  content:"";
  position:absolute;
  right:10px;
  top:50%;
  transform:translateY(-50%);
  width:6px;
  height:60%;
  border-radius:10px;
  background:rgba(255,255,255,.55);
}

/* كارت الملاحظة داخل السايدبار */
.sidebar > .card{
  margin-top:16px;
  background:#f7f2e9;
  border:1px solid rgba(201,167,123,.25);
  border-radius:14px;
  box-shadow:none;
}
.sidebar > .card .badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  background:rgba(201,167,123,.16);
  color:#7a5c2e;
  border:1px solid rgba(201,167,123,.22);
  padding:6px 10px;
  border-radius:999px;
  font-weight:700;
  font-size:13px;
}
.sidebar > .card [style*="color:var(--muted)"]{
  color:#6f6f6f !important;
  font-size:14px;
  line-height:1.7;
}
.sidebar > .card [data-results]{
  font-size:14px;
  line-height:1.6;
  color:#6f6f6f !important;
}
.sidebar .kbd{
  display:inline-block;
  padding:3px 8px;
  border-radius:8px;
  background:#e9e1d6;
  border:1px solid rgba(0,0,0,.06);
  font-size:12px;
  color:#5f5f5f;
}

/* ========== Main ========== */
.main{
  border:1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);

  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(2px);

  padding: 40px;
  min-height: 70vh;
}

.page-title{
  margin:0 0 10px;
  font-size: 32px;
  font-weight: 900;
  color:#7b4a2e;
}

.lead{
  color: var(--muted);
  margin: 0 0 16px;
}

/* ========== Blocks ========== */
.card{
  border:1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
  margin: 14px 0;
}

.badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-weight:800;
  font-size: 13px;
  color: var(--warn);
}

.badge-soft{
  background:#f5f5f5;
  border:1px solid var(--border);
}

.notice{
  border:1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.notice .badge{ margin-bottom:6px; }

.hr{ border:none; border-top:1px solid var(--border); margin:16px 0; }

/* ========== Footer nav ========== */
.footer-nav{
  display:flex;
  gap:10px;
  justify-content:space-between;
  margin-top: 18px;
  padding-top: 14px;
  border-top:1px solid var(--border);
}
.footer-nav a{
  border:1px solid var(--border);
  padding: 10px 12px;
  border-radius: 12px;
  background:#fff;
}
.footer-nav a:hover{ background: var(--card); text-decoration:none; }

/* ========== Section TOC (upgraded) ========== */
.toc{
  background:#ffffff;
  border-radius:18px;
  padding:20px;
  margin:25px 0;
  box-shadow:0 10px 30px rgba(0,0,0,.06);
  border:1px solid rgba(0,0,0,.05);
}
.toc .badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:15px;
  font-weight:700;
  background:rgba(201,167,123,.15);
  color:#7a5c2e;
  border:1px solid rgba(201,167,123,.25);
  padding:6px 14px;
  border-radius:999px;
  margin-bottom:14px;
}
.toc a{
  display:block;
  padding:12px 14px;
  margin-bottom:8px;
  border-radius:12px;
  text-decoration:none;
  color:#2f2f2f;
  background:#faf8f4;
  border:1px solid rgba(0,0,0,.04);
  font-size:14px;
  transition:all .25s ease;
}
.toc a:hover{
  background:#f1e6d6;
  transform:translateX(-4px);
  box-shadow:0 6px 16px rgba(0,0,0,.06);
  text-decoration:none;
}
.toc a.active{
  background:linear-gradient(90deg,#c9a77b,#d4b07a);
  color:#fff;
  border-color:transparent;
}

/* ========== Sections ========== */
.section{
  padding-top: 10px;
  margin-top: 18px;
}

.top-link{
  display:inline-block;
  margin-top: 10px;
  color: var(--muted);
}

/* ========== Progress bar ========== */
.progress-wrap{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  z-index: 999;
}
.progress-bar{
  height: 100%;
  width: 0%;
  background: #111;
}

/* ========== Floating Back-to-top (mobile-first) ========== */
.fab-top{
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 1000;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow);
  border-radius: 999px;
  padding: 10px 12px;
  cursor: pointer;
  display: none;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}
.fab-top:active{ transform: translateY(1px); }
@media (min-width: 901px){
  .fab-top{ display:none !important; }
}

/* ========== Welcome card typography ========== */
.welcome-card{
  max-width: 900px;
  margin: 40px auto;
  padding: 40px;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 12px 35px rgba(0,0,0,0.05);
  line-height: 2;
  font-size: 17px;
}

.welcome-title{
  text-align: center;
  font-size: 28px;
  color: #7b4a2e;
  margin: 12px 0 20px;
  line-height: 1.8;
}

.welcome-subtitle{
  text-align: center;
  font-size: 22px;
  color: #b98a45;
  margin: 30px 0 15px;
}

.divider{
  height: 1px;
  background: linear-gradient(to left,#d9c9b2,transparent,#d9c9b2);
  margin: 30px 0;
}

.welcome-card p{ line-height: 1.9; }

.highlight{
  text-align: center;
  font-weight: 700;
  color: #7b4a2e;
  margin-top: 20px;
}

.dua{
  text-align: center;
  font-weight: 700;
  color: #a36f3c;
  margin-top: 15px;
}

/* ========== Media blocks ========== */
.hero-image{
  width: 100%;
  margin-bottom: 30px;
  overflow: hidden;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}
.hero-image img{
  width: 100%;
  height: auto;
  display: block;
}

.map-wrapper{
  border:1px solid var(--border);
  border-radius:16px;
  overflow:hidden;
  background:#f9f9f9;
}
.map-image{
  width:100%;
  height:auto;
  display:block;
  transition:transform .3s ease;
}
.map-image:hover{ transform:scale(1.02); }

.video-wrapper{
  position:relative;
  padding-bottom:56.25%;
  height:0;
  overflow:hidden;
  border-radius:16px;
  margin-top:10px;
  box-shadow:0 10px 25px rgba(0,0,0,.08);
}
.video-wrapper iframe{
  position:absolute;
  top:0;
  left:0;
  width:100%;
  height:100%;
  border:0;
}

/* ========== Responsive ========== */
@media (max-width: 900px){
  .layout{ grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    top: 0;
    height:auto;
  }
  .search input{ width: 52vw; }
}

@media (max-width:768px){
  .toc{
    padding:16px;
    border-radius:16px;
  }
  .toc a{
    font-size:13px;
    padding:11px 12px;
  }
}

@media (max-width: 980px){
  .sidebar{
    border-radius:16px;
    padding:16px;
  }
	
  .sidebar .nav a{
    padding:12px 20px;
  }
}
