/* هيكل التطبيق: القائمة الجانبية، الشريط العلوي، تبويبات القسم، وشريط الجوال السفلي.
   تستخدمه مساحة التاجر ولوحة الإدارة. القيم من assets/tokens.css. */
#appView {
  min-height: 100vh;
}
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}
.app-body {
  min-width: 0;
}

/* القائمة الجانبية */
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100vh;
  padding: 22px 14px 16px;
  overflow-y: auto;
  border-inline-start: 1px solid var(--border);
  background: var(--surface);
}
.sidebar .brand {
  margin: 0 8px 4px;
}
.sidebar .create-btn {
  width: 100%;
}
.workspace-box {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--brand-tint);
}
.workspace-box strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.workspace-box small {
  color: var(--muted);
}
.workspace-select {
  width: 100%;
  min-height: 36px;
  margin-top: 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.nav-list {
  display: grid;
  gap: 2px;
}
.nav-label,
.workspace-label {
  margin: 8px 12px 2px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 700;
}
.workspace-label {
  margin: 0 0 2px;
}
.nav-divider {
  height: 1px;
  margin: 8px;
  background: var(--border);
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: var(--touch);
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
  text-align: right;
}
.nav-link:hover {
  background: var(--surface-2);
}
.nav-link.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
}
.nav-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.sidebar-foot {
  display: grid;
  gap: 2px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.sidebar-foot .btn {
  justify-content: flex-start;
  min-height: 40px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

/* الشريط العلوي */
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 68px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.app-topbar .page-name {
  font-size: 18px;
  font-weight: 700;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.top-user {
  display: grid;
  line-height: 1.3;
  text-align: left;
}
.top-user span {
  font-size: 14px;
  font-weight: 700;
}
.top-user small {
  color: var(--muted);
}
.mobile-menu {
  display: none;
}
.app-main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 32px 56px;
}

/* تبويبات القسم: لما يحتوي القسم أكثر من صفحة */
.section-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
}
.section-tab {
  min-height: var(--touch);
  padding: 0 16px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
}
.section-tab:hover {
  color: var(--text);
}
.section-tab.active {
  border-bottom-color: var(--brand);
  color: var(--brand);
  font-weight: 700;
}

/* تنبيه الحفظ والنشر داخل صفحة الإنشاء فقط */
.app-banner {
  margin-bottom: 20px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--brand-tint);
  color: var(--muted);
  font-size: 13px;
}

/* شريط الجوال السفلي */
.bottom-bar {
  display: none;
}
.menu-overlay {
  display: none;
}

@media (max-width: 900px) {
  .app-topbar {
    padding: 0 20px;
  }
  .app-main {
    padding: 22px 20px 48px;
  }
  .top-user {
    display: none;
  }
}
@media (max-width: 720px) {
  .app-shell {
    display: block;
  }
  .sidebar {
    position: fixed;
    top: 0;
    right: calc(-1 * var(--sidebar-w) - 24px);
    z-index: 100;
    width: var(--sidebar-w);
    height: 100dvh;
    transition: right 0.2s;
  }
  .menu-open .sidebar {
    right: 0;
  }
  .menu-open .menu-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 99;
    background: var(--overlay);
  }
  .mobile-menu {
    display: inline-flex;
  }
  .app-topbar {
    height: 60px;
    padding: 0 16px;
  }
  .app-main {
    padding: 18px 16px calc(96px + env(safe-area-inset-bottom));
  }
  .bottom-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 90;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: var(--surface);
  }
  .bottom-tab {
    display: grid;
    justify-items: center;
    gap: 2px;
    min-height: 52px;
    padding: 4px 0;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 12px;
  }
  .bottom-tab svg {
    width: 22px;
    height: 22px;
  }
  .bottom-tab.active {
    color: var(--brand);
    font-weight: 700;
  }
  .bottom-tab.create span:first-child {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--brand);
    color: var(--on-brand);
    font-size: 24px;
    line-height: 1;
  }
}
