/* صفحة التطبيقات /apps/ — نفس الخط ونفس نمط الزجاج */
.apps-page { width: 90%; max-width: 560px; }
.page-sub { text-align: center; color: var(--text-soft); font-size: 0.8rem; margin: -16px 0 18px; }

.glass-pill {
  position: relative; overflow: hidden;
  background: var(--g-bg);
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  border: 1px solid var(--g-border);
  box-shadow: var(--g-shadow);
}

.search { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 16px; border-radius: 16px; cursor: text; }
.search svg { flex: 0 0 auto; width: 18px; height: 18px; fill: none; stroke: var(--text-soft); stroke-width: 1.8; stroke-linecap: round; }
.search input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent;
  color: var(--text-main); font: inherit; font-size: 16px; /* 16px يمنع تكبير الصفحة تلقائيًا في iOS */
  -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--text-soft); opacity: .8; }
.search input::-webkit-search-cancel-button { display: none; }
.search:focus-within { border-color: rgba(0, 140, 255, .55); }

.chips {
  display: flex; gap: 8px; overflow-x: auto; margin: 14px -5% 0; padding: 2px 5% 6px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; height: 36px; padding: 0 16px; border-radius: 50px; cursor: pointer;
  font: inherit; font-weight: 900; font-size: 0.8rem; color: var(--text-main);
  background: var(--g-bg); border: 1px solid var(--g-border);
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  white-space: nowrap;
}
.chip[aria-selected="true"] { color: #2f81f7; border-color: rgba(47, 129, 247, .6); background: rgba(47, 129, 247, .12); }

.count { margin: 14px 2px 4px; font-size: 0.78rem; color: var(--text-soft); min-height: 1.4em; }

.app-list { display: flex; flex-direction: column; }
.app-row { display: flex; align-items: center; gap: 12px; padding: 14px 2px; border-bottom: 1px solid var(--g-border); }
.app-row:last-child { border-bottom: 0; }
.app-icon {
  flex: 0 0 auto; width: 56px; height: 56px; border-radius: 22%; overflow: hidden;
  display: grid; place-items: center; background: var(--ico-bg); color: var(--text-soft);
  font-weight: 900; font-size: 1.3rem;
}
.app-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.app-icon.big { width: 72px; height: 72px; font-size: 1.7rem; }
.app-info { flex: 1; min-width: 0; }
.app-name { font-size: 0.95rem; font-weight: 900; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: 'Inter', 'Handicrafts', sans-serif; }
.app-meta { font-size: 0.74rem; color: var(--text-soft); line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-meta bdi { font-family: 'Inter', sans-serif; }
.view-btn {
  flex: 0 0 auto; height: 32px; padding: 0 18px; border-radius: 50px; cursor: pointer;
  font: inherit; font-weight: 900; font-size: 0.78rem; color: #2f81f7;
  background: rgba(47, 129, 247, .1); border: 1px solid rgba(47, 129, 247, .35);
}
.view-btn:active { transform: scale(.96); }

.state { text-align: center; color: var(--text-soft); font-size: 0.85rem; padding: 36px 0 8px; }
.state:empty { display: none; }

/* ورقة التفاصيل السفلية */
.sheet-back { position: fixed; inset: 0; z-index: 1200; background: rgba(0, 0, 0, .45); opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility 0s linear .2s; }
.sheet-back.active { opacity: 1; visibility: visible; transition: opacity .2s ease; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1210; margin: 0 auto; max-width: 560px;
  padding: 10px 20px calc(env(safe-area-inset-bottom, 0px) + 22px);
  background: var(--bg); border: 1px solid var(--g-border); border-bottom: 0; border-radius: 24px 24px 0 0;
  transform: translateY(105%); transition: transform .25s ease; visibility: hidden;
}
.sheet.active { transform: none; visibility: visible; }
.sheet-grip { width: 38px; height: 4px; border-radius: 4px; background: var(--g-border); margin: 0 auto 14px; }
.sheet-head { display: flex; align-items: center; gap: 14px; }
.sheet-meta { min-width: 0; }
.sheet-meta h2 { font-size: 1.05rem; line-height: 1.4; font-family: 'Inter', 'Handicrafts', sans-serif; }
.sheet-meta p { font-size: 0.78rem; color: var(--text-soft); }
.sheet-desc { margin-top: 14px; font-size: 0.82rem; line-height: 1.8; color: var(--text-soft); white-space: pre-line; }
.sheet-desc:empty { display: none; }
.sheet-close { border: 1px solid var(--g-border); cursor: pointer; margin-top: 18px; font: inherit; font-weight: 900; }

/* زر سهم العودة في الشريط العلوي (بدل زر القائمة) */
.top-back {
  width: 38px; height: 38px; border-radius: 12px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; text-decoration: none;
  color: var(--text-main); background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.14);
}
.top-back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.top-back:active { transform: scale(0.94); }
html[data-theme="light"] .top-back { background: rgba(20, 24, 36, 0.05); border-color: rgba(20, 24, 36, 0.14); }
