/* ============================================================
   رقيم — css/layout.css
   هيكل التطبيق: Sidebar (سطح المكتب) + Bottom Nav (الموبايل)
   مبني Mobile-first
   ============================================================ */

#app-shell { min-height: 100vh; }

/* ── الشريط العلوي ── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3);
  padding: 0 var(--s4);
  background: var(--bg1);
  border-bottom: 1px solid var(--b1);
}
.topbar-brand { display: flex; align-items: center; gap: var(--s2); font-weight: 700; color: var(--ac); font-size: 17px; }
.topbar-brand .brand-icon { width: 26px; height: 26px; flex-shrink: 0; }
.topbar-hijri { font-size: 12px; color: var(--t3); white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: var(--s2); }

/* ── المحتوى ── */
#page-content {
  padding: var(--s4) var(--s4) calc(var(--bottomnav-h) + var(--s6));
  max-width: 880px;
  margin: 0 auto;
  min-height: calc(100vh - var(--topbar-h));
}

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s3); margin-bottom: var(--s4);
}
.page-title { font-size: 21px; font-weight: 700; color: var(--t1); }
.page-sub { font-size: 12.5px; color: var(--t3); margin-top: 3px; }

/* ── التنقل السفلي (موبايل) ── */
.bottom-nav {
  position: fixed; bottom: 0; right: 0; left: 0; z-index: 40;
  height: var(--bottomnav-h);
  display: flex;
  background: var(--bg1);
  border-top: 1px solid var(--b1);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bn-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--t3); font-size: 10.5px; font-weight: 600;
  transition: color var(--tr);
  position: relative;
}
.bn-item svg { width: 21px; height: 21px; }
.bn-item.active { color: var(--ac); }
.bn-item .bn-icon-wrap { position: relative; }
.bn-more-sheet-trigger.active::after { content:''; position:absolute; top:-2px; right:50%; transform:translateX(50%); width:5px; height:5px; border-radius:50%; background:var(--ac); }

/* ── الشريط الجانبي (سطح المكتب) ── */
.sidebar { display: none; }

/* عنصر تنقّل — يُستخدم في الشريط الجانبي وفي قائمة "المزيد" على الموبايل */
.nav-item {
  display: flex; align-items: center; gap: var(--s3);
  padding: 10px 12px; border-radius: var(--r2);
  color: var(--t2); font-size: 13.5px; font-weight: 600;
  transition: background var(--tr), color var(--tr);
}
.nav-item svg { width: 18px; height: 18px; opacity: .8; flex-shrink: 0; }
.nav-item:hover { background: var(--bg3); color: var(--t1); }
.nav-item.active { background: var(--ac); color: #fff; }
.nav-item.active svg { opacity: 1; }

@media (min-width: 880px) {
  .bottom-nav { display: none; }
  #page-content { margin-right: var(--sidebar-w); max-width: 980px; padding: var(--s6) var(--s7) var(--s7); }
  .topbar { display: none; }

  .sidebar {
    display: flex; flex-direction: column;
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 30;
    width: var(--sidebar-w);
    background: var(--bg1);
    border-left: 1px solid var(--b1);
    padding: var(--s5) var(--s3) var(--s4);
  }
  .sidebar-brand { display: flex; align-items: center; gap: var(--s2); padding: 0 var(--s2) var(--s5); font-size: 19px; font-weight: 700; color: var(--ac); }
  .sidebar-brand .brand-icon { width: 28px; height: 28px; }
  .sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

  .sidebar-foot { margin-top: auto; }
  .hijri-widget {
    background: var(--ac3); border: 1px solid var(--b2); border-radius: var(--r3);
    padding: var(--s3); text-align: center; margin-bottom: var(--s2);
  }
  .hijri-widget .hd { font-size: 12.5px; font-weight: 700; color: var(--ac); }
  .hijri-widget .hg { font-size: 11px; color: var(--t3); margin-top: 2px; }
  .sidebar-version { text-align: center; font-size: 10.5px; color: var(--t4); }
}

/* تخطيطات شبكية مساعدة */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--s3); }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: var(--s2); }
@media (max-width: 460px) {
  .grid-4 { grid-template-columns: repeat(4,1fr); gap: 6px; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.flex-center { display: flex; align-items: center; gap: var(--s2); }
.mt2 { margin-top: var(--s2); } .mt3 { margin-top: var(--s3); } .mt4 { margin-top: var(--s4); }
.mb2 { margin-bottom: var(--s2); } .mb3 { margin-bottom: var(--s3); } .mb4 { margin-bottom: var(--s4); }
