/* Al-Is'haam App: native-style shell. Every rule is scoped to html.aispwa-app, so normal browser visitors see nothing of it. */

html.aispwa-app {
  --ap-theme: #0a3d2c;
  --ap-accent: #0f6b4a;
  --ap-gold: #c8891a;
  --ap-ink: #1d2b26;
  --ap-mute: #6b7a74;
  --ap-line: rgba(10, 61, 44, .12);
  --ap-top: 48px;
  --ap-tab: 58px;
  --ap-st: env(safe-area-inset-top, 0px);
  --ap-sb: env(safe-area-inset-bottom, 0px);
  --ap-font: Cairo, system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--ap-top) + var(--ap-st) + 8px);
}
html.aispwa-app body {
  padding-top: calc(var(--ap-top) + var(--ap-st)) !important;
  padding-bottom: calc(var(--ap-tab) + var(--ap-sb) + 30px) !important;
  margin-top: 0 !important;
  -webkit-font-smoothing: antialiased;
  animation: ap-in .28s ease-out both;
}
html.aispwa-app.aispwa-leaving body { opacity: .55; transition: opacity .14s ease-in; }
/* opacity only: a transform on <body> would break the fixed top and bottom bars */
@keyframes ap-in { from { opacity: 0; } }

/* WordPress admin bar never belongs in the app */
html.aispwa-app #wpadminbar { display: none !important; }
html.aispwa-app { margin-top: 0 !important; }

/* Feels like an app, not a page: no callout/selection on controls, no zoom-on-focus, quick taps */
html.aispwa-app a, html.aispwa-app button, html.aispwa-app img { -webkit-touch-callout: none; }
html.aispwa-app a, html.aispwa-app button, html.aispwa-app [role=button], html.aispwa-app input, html.aispwa-app select, html.aispwa-app summary { touch-action: manipulation; }
html.aispwa-app button, html.aispwa-app .ap-top, html.aispwa-app .ap-tabs, html.aispwa-app .ap-hero, html.aispwa-app .ap-tile { -webkit-user-select: none; user-select: none; }
html.aispwa-app input, html.aispwa-app select, html.aispwa-app textarea { font-size: max(16px, 1em); }
html.aispwa-app ::-webkit-scrollbar { display: none; }
html.aispwa-app * { scrollbar-width: none; }

/* Site floating buttons (WhatsApp, back-to-top) must clear the tab bar */
html.aispwa-app .back-to-top, html.aispwa-app #scrollUp, html.aispwa-app .joinchat, html.aispwa-app .whatsapp-float,
html.aispwa-app .wa__btn_popup, html.aispwa-app #ht-ctc-chat, html.aispwa-app .elementor-widget-floating-bars-var-1 {
  bottom: calc(var(--ap-tab) + var(--ap-sb) + 30px) !important;
}
html.aispwa-app .aispwa-kb .back-to-top { display: none; }

/* ---------- start-up splash (installed web app only; the iPhone wrapper has its own native splash) ---------- */
html.aispwa-splash::before {
  content: ""; position: fixed; inset: 0; z-index: 2147483600;
  background: var(--ap-bg, #0a3d2c) var(--ap-logo, none) center / 96px 96px no-repeat;
  transition: opacity .4s ease .1s;
}
html.aispwa-splash.aispwa-ready::before { opacity: 0; pointer-events: none; }

/* ---------- top bar ---------- */
.ap-top {
  position: fixed; z-index: 2147482000; top: 0; inset-inline: 0;
  height: calc(var(--ap-top) + var(--ap-st)); padding-top: var(--ap-st);
  display: grid; grid-template-columns: 48px 1fr 48px; align-items: center;
  background: var(--ap-theme); color: #fff; font-family: var(--ap-font);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06), 0 6px 18px rgba(10, 30, 22, .18);
}
.ap-top button {
  appearance: none; border: 0; background: none; color: inherit; font: inherit; cursor: pointer;
  width: 48px; height: var(--ap-top); display: grid; place-items: center; border-radius: 0;
}
.ap-top button:active { background: rgba(255, 255, 255, .12); }
.ap-top .ap-i { width: 24px; height: 24px; }
.ap-top .ap-back[hidden] { display: block; visibility: hidden; }
[dir=rtl] .ap-top .ap-back .ap-i { transform: scaleX(-1); }
.ap-title {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0;
  font-size: 17px; font-weight: 700; line-height: 1.2; letter-spacing: .1px; text-align: center;
}
.ap-title img { width: 26px; height: 26px; border-radius: 50%; background: #fff; object-fit: cover; flex: none; }
.ap-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- bottom tab bar (floating capsule) ---------- */
.ap-tabs {
  position: fixed; z-index: 2147482000; bottom: calc(var(--ap-sb) + 10px); inset-inline: 12px; height: var(--ap-tab);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: stretch; padding: 0 4px;
  background: rgba(255, 255, 255, .9); border: 1px solid var(--ap-line); border-radius: 26px; font-family: var(--ap-font);
  box-shadow: 0 12px 32px rgba(10, 40, 30, .2), 0 2px 6px rgba(10, 40, 30, .08);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  transition: transform .3s cubic-bezier(.3, .9, .3, 1);
}
html.aispwa-kb .ap-tabs { transform: translateY(170%); }
.ap-tab {
  appearance: none; border: 0; background: none; font: inherit; cursor: pointer; text-decoration: none;
  margin: 6px 1px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: #7b8a84; font-size: 10.5px; font-weight: 700; min-width: 0; position: relative; border-radius: 19px;
  transition: color .2s ease, background-color .25s ease;
}
.ap-tab .ap-i { width: 23px; height: 23px; transition: transform .32s cubic-bezier(.34, 1.56, .64, 1); }
.ap-tab span { max-width: 100%; padding: 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-tab:active .ap-i { transform: scale(.82); }
.ap-tab[aria-current=page] { color: var(--ap-accent); background: rgba(15, 107, 74, .11); }
.ap-tab[aria-current=page] .ap-i { transform: translateY(-1px) scale(1.1); }
.ap-tab.ap-primary { color: var(--ap-ink); background: none !important; }
.ap-tab.ap-primary .ap-i {
  box-sizing: content-box; width: 22px; height: 22px; padding: 13px; margin-top: -30px; border-radius: 50%; color: #fff;
  background: linear-gradient(145deg, #14935f, var(--ap-theme)); box-shadow: 0 10px 22px rgba(10, 61, 44, .4), 0 0 0 5px rgba(255, 255, 255, .95);
}
.ap-tab.ap-primary:active .ap-i { transform: scale(.9); }
.ap-tab.ap-primary[aria-current=page] .ap-i { transform: scale(1.04); }

/* ---------- "More" sheet ---------- */
.ap-sheet { position: fixed; inset: 0; z-index: 2147482500; visibility: hidden; font-family: var(--ap-font); }
.ap-sheet.open { visibility: visible; }
.ap-scrim { position: absolute; inset: 0; background: rgba(8, 24, 18, .5); opacity: 0; transition: opacity .22s ease; }
.ap-sheet.open .ap-scrim { opacity: 1; }
.ap-panel {
  position: absolute; inset-inline: 0; bottom: 0; max-height: 82vh; overflow: auto; background: #fff; color: var(--ap-ink);
  border-radius: 22px 22px 0 0; padding: 10px 16px calc(18px + var(--ap-sb)); transform: translateY(100%);
  transition: transform .42s cubic-bezier(.22, 1, .36, 1); box-shadow: 0 -12px 40px rgba(8, 24, 18, .25);
}
.ap-sheet.open .ap-panel { transform: none; }
.ap-panel.drag { transition: none; }
.ap-grab { width: 40px; height: 5px; border-radius: 3px; background: #d6dedb; margin: 0 auto 12px; }
.ap-sheet h2 { margin: 4px 4px 10px; font-size: 18px; }
.ap-row {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 13px 8px; border: 0; background: none; font: inherit; color: inherit;
  text-align: start; text-decoration: none; border-radius: 14px; cursor: pointer;
}
.ap-row:active { background: #eef3f0; }
.ap-row + .ap-row { border-top: 1px solid #eef1ef; border-radius: 0 0 14px 14px; }
.ap-row .ap-ri { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: #e8f2ed; color: var(--ap-accent); flex: none; }
.ap-row .ap-ri .ap-i { width: 22px; height: 22px; }
.ap-row b { flex: 1; font-size: 15.5px; font-weight: 600; }
.ap-row .ap-chev { width: 18px; height: 18px; color: #a2afa9; transform: scaleX(-1); }
[dir=rtl] .ap-row .ap-chev { transform: none; }
.ap-meta { display: flex; gap: 16px; justify-content: center; margin-top: 12px; color: var(--ap-mute); font-size: 12.5px; }
.ap-meta a { color: inherit; }

/* ---------- toast, progress, pull-to-refresh ---------- */
.ap-toast {
  position: fixed; z-index: 2147483000; inset-inline: 0; margin: 0 auto; width: max-content; max-width: calc(100% - 32px);
  bottom: calc(var(--ap-tab) + var(--ap-sb) + 26px); padding: 10px 18px; border-radius: 999px; background: #17231e; color: #fff;
  font: 600 13.5px/1.3 var(--ap-font); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .25s ease;
}
.ap-toast.show { opacity: 1; transform: none; }
.ap-bar { background-image: linear-gradient(90deg, var(--ap-gold), #f0b84a); box-shadow: 0 0 10px rgba(200, 137, 26, .6); border-radius: 0 3px 3px 0; position: fixed; z-index: 2147482100; top: calc(var(--ap-top) + var(--ap-st)); inset-inline-start: 0; height: 3px; width: 0; opacity: 0; transition: width .2s ease, opacity .2s ease; }
.ap-ptr {
  position: fixed; z-index: 2147482050; top: calc(var(--ap-top) + var(--ap-st) + 6px); inset-inline: 0; margin: 0 auto; width: 38px; height: 38px;
  border-radius: 50%; background: #fff; box-shadow: 0 6px 18px rgba(10, 40, 30, .25); display: grid; place-items: center;
  opacity: 0; transform: translateY(-60px); pointer-events: none;
}
.ap-ptr svg { width: 20px; height: 20px; fill: none; stroke: var(--ap-accent); stroke-width: 2.4; stroke-linecap: round; }
.ap-ptr.spin svg { animation: ap-spin .8s linear infinite; }
@keyframes ap-spin { to { transform: rotate(360deg); } }

/* Pressed state for our own controls */
.ap-press { transition: transform .12s ease, filter .12s ease; }
.ap-press:active { transform: scale(.97); filter: brightness(.96); }

/* ---------- app home screen (/?aispwa=home) ---------- */
body.ap-home { margin: 0; background: #f2f6f4; color: var(--ap-ink); font-family: var(--ap-font); line-height: 1.55; }
html[lang=ar] .l-en, html[lang=en] .l-ar { display: none !important; }
.ap-main { max-width: 640px; margin: 0 auto; padding: 14px 16px 28px; }
.ap-hero {
  position: relative; overflow: hidden; border-radius: 26px; padding: 18px 18px 20px; color: #fff;
  background: radial-gradient(520px circle at 100% 0, rgba(200, 137, 26, .35), transparent 60%), linear-gradient(160deg, var(--ap-theme), #0f6b4a);
  box-shadow: 0 18px 40px rgba(10, 61, 44, .25);
}
.ap-hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.ap-salam { font-size: 13.5px; opacity: .92; }
.ap-seg { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, .16); }
.ap-seg button { appearance: none; border: 0; background: none; color: #fff; font: 600 12.5px var(--ap-font); padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.ap-seg button[aria-pressed=true] { background: #fff; color: var(--ap-theme); }
.ap-hero h2 { margin: 0 0 6px; font-size: 26px; line-height: 1.3; font-weight: 800; }
.ap-hero p { margin: 0 0 18px; opacity: .92; font-size: 15px; }
.ap-cta { display: flex; gap: 10px; }
.ap-btn {
  appearance: none; border: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 20px;
  border-radius: 16px; font: 700 15.5px var(--ap-font); text-decoration: none; cursor: pointer;
}
.ap-btn .ap-i { width: 20px; height: 20px; }
.ap-btn-gold { flex: 1; background: var(--ap-gold); color: #1d2b26; box-shadow: 0 8px 20px rgba(0, 0, 0, .2); }
.ap-btn-ghost { background: rgba(255, 255, 255, .16); color: #fff; }
.ap-sec { margin-top: 22px; }
.ap-sec h3 { margin: 0 4px 10px; font-size: 17px; font-weight: 800; }
.ap-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ap-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 4px 12px; border-radius: 18px; background: #fff; text-decoration: none; color: inherit; box-shadow: 0 2px 10px rgba(10, 61, 44, .07); }
.ap-tile-i { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; background: #e8f2ed; color: var(--ap-accent); }
.ap-tile-i .ap-i { width: 24px; height: 24px; }
.ap-tile-t { font-size: 12.5px; font-weight: 700; text-align: center; line-height: 1.25; }
.ap-rail { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 2px 10px; margin: 0 -16px; padding-inline: 16px; }
.ap-card { flex: none; width: 70%; max-width: 280px; scroll-snap-align: start; border-radius: 20px; overflow: hidden; background: #fff; text-decoration: none; color: inherit; box-shadow: 0 4px 16px rgba(10, 61, 44, .1); }
.ap-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #dfe8e4; }
.ap-card-t { display: block; padding: 12px 14px 14px; font-weight: 700; font-size: 15px; }
.ap-note { display: flex; gap: 12px; margin-top: 22px; padding: 14px 16px; border-radius: 18px; background: #fff8e8; border: 1px solid #f0dcaa; }
.ap-note > .ap-i { width: 26px; height: 26px; flex: none; color: var(--ap-gold); margin-top: 2px; }
.ap-note b { display: block; font-size: 14.5px; margin-bottom: 2px; }
.ap-note p { margin: 0; font-size: 13.5px; color: #5d5640; }
.ap-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-top: 26px; color: var(--ap-mute); font-size: 12.5px; }
.ap-foot a { color: inherit; }

@media (max-width: 360px) { .ap-tiles { grid-template-columns: repeat(3, 1fr); } .ap-hero h2 { font-size: 23px; } }
@media (min-width: 700px) { .ap-tiles { grid-template-columns: repeat(6, 1fr); } }
@media (prefers-reduced-motion: reduce) {
  html.aispwa-app body, .ap-sheet *, .ap-tabs, .ap-toast, .ap-press, .ap-tab .ap-i, .ap-main > *, .ap-card, .ap-card img, .ap-tile { animation: none !important; transition: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

.ap-i { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; display: block; }

/* ================= polish ================= */

/* Smooth page-to-page transitions where the browser supports them (iOS 18.2+, Chrome): the bars stay put, only the page changes. */
html.aispwa-vt .ap-top { view-transition-name: ap-top; }
html.aispwa-vt .ap-tabs { view-transition-name: ap-tabs; }
html.aispwa-vt body { animation: none; }
html.aispwa-vt.aispwa-leaving body { opacity: 1; transition: none; }
::view-transition-group(ap-top), ::view-transition-group(ap-tabs) { animation-duration: 0s; }
::view-transition-old(root) { animation: ap-vt-out .16s ease-in both; }
::view-transition-new(root) { animation: ap-vt-in .3s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes ap-vt-out { to { opacity: 0; transform: translateY(-4px); } }
@keyframes ap-vt-in { from { opacity: 0; transform: translateY(10px); } }

/* Hero: soft pattern + sheen */
.ap-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.09' stroke-width='1.2'%3E%3Crect x='14' y='14' width='36' height='36'/%3E%3Crect x='14' y='14' width='36' height='36' transform='rotate(45 32 32)'/%3E%3C/g%3E%3C/svg%3E");
  -webkit-mask-image: linear-gradient(200deg, #000, transparent 70%); mask-image: linear-gradient(200deg, #000, transparent 70%);
}
.ap-hero > * { position: relative; }
.ap-btn-gold { background: linear-gradient(180deg, #e0a233, var(--ap-gold)); }
.ap-btn { transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), filter .15s ease; }
.ap-press:active { transform: scale(.95); }

/* Home: sections rise in one after the other */
.ap-main > * { animation: ap-rise .6s cubic-bezier(.22, 1, .36, 1) both; }
.ap-main > :nth-child(2) { animation-delay: .06s; } .ap-main > :nth-child(3) { animation-delay: .12s; }
.ap-main > :nth-child(4) { animation-delay: .18s; } .ap-main > :nth-child(5) { animation-delay: .24s; }
@keyframes ap-rise { from { opacity: 0; transform: translateY(18px); } }
.ap-tile { transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s ease; }
.ap-tile:active { transform: scale(.94); box-shadow: 0 1px 4px rgba(10, 61, 44, .1); }

/* Images: shimmer while loading, fade in when ready */
.ap-card { background: linear-gradient(100deg, #e4ece8 30%, #f3f7f5 50%, #e4ece8 70%) 0 0 / 200% 100%; animation: ap-shimmer 1.4s linear infinite; }
.ap-card:has(img.ld) { animation: none; background: #fff; }
.ap-card img { opacity: 0; transition: opacity .5s ease, transform .6s ease; transform: scale(1.04); }
.ap-card img.ld { opacity: 1; transform: none; }
.ap-card-t { background: #fff; }
@keyframes ap-shimmer { to { background-position: -200% 0; } }

/* Notification permission card reuses the sheet */
.ap-ask .ap-panel { text-align: center; padding-top: 14px; }
.ap-ask .ap-ask-i { width: 64px; height: 64px; margin: 4px auto 12px; border-radius: 22px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, #14935f, var(--ap-theme)); box-shadow: 0 12px 26px rgba(10, 61, 44, .3); }
.ap-ask .ap-ask-i .ap-i { width: 32px; height: 32px; }
.ap-ask h2 { margin: 0 0 6px; font-size: 20px; }
.ap-ask p { margin: 0 8px 18px; color: var(--ap-mute); font-size: 14.5px; line-height: 1.6; }
.ap-ask .ap-btn { width: 100%; }
.ap-ask .ap-btn-gold { box-shadow: none; }
.ap-ask .ap-later { appearance: none; border: 0; background: none; font: 600 14px var(--ap-font); color: var(--ap-mute); padding: 14px; margin-top: 4px; cursor: pointer; }
