/* عرب اف اكس — تطبيق الجوال (PWA) · الخطوة 199 */
:root {
    --pwa-accent: #0EA5E9;
    --pwa-bg: #ffffff;
    --pwa-fg: #0B1220;
    --pwa-muted: #64748B;
    --pwa-line: rgba(15, 23, 42, .09);
    --pwa-soft: #F1F5F9;
    --pwa-nav-h: 64px;
    --pwa-safe-b: env(safe-area-inset-bottom, 0px);
}
html.dark, html[data-theme="dark"], body.dark, [data-theme="dark"] body {
    --pwa-bg: #111A2B;
    --pwa-fg: #E6EDF7;
    --pwa-muted: #94A3B8;
    --pwa-line: rgba(255, 255, 255, .08);
    --pwa-soft: #18233A;
}
@media (prefers-color-scheme: dark) {
    html:not(.light):not([data-theme="light"]).pwa-auto-dark { --pwa-bg: #111A2B; --pwa-fg: #E6EDF7; }
}

/* ===== وضع التطبيق ===== */
html.pwa-standalone { -webkit-tap-highlight-color: transparent; }
html.pwa-standalone body { overscroll-behavior-y: none; }
html.pwa-lock, html.pwa-lock body { overflow: hidden; }

/* ===== الشريط السفلي ===== */
.pwa-nav {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 9990;
    display: flex; align-items: stretch; justify-content: space-around;
    height: calc(var(--pwa-nav-h) + var(--pwa-safe-b));
    padding: 6px 6px calc(6px + var(--pwa-safe-b));
    background: color-mix(in srgb, var(--pwa-bg) 88%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
    border-top: 1px solid var(--pwa-line);
    box-shadow: 0 -6px 24px rgba(2, 8, 23, .06);
    font-family: inherit;
}
.pwa-nav[hidden] { display: none; }
html.pwa-nav-on body { padding-bottom: calc(var(--pwa-nav-h) + var(--pwa-safe-b) + 4px) !important; }
html.pwa-nav-on .wa-float { bottom: calc(var(--pwa-nav-h) + var(--pwa-safe-b) + 14px) !important; }
.pwa-nav-item {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--pwa-muted); text-decoration: none !important; font-size: 11px; font-weight: 600; line-height: 1.1;
    border-radius: 14px; transition: color .2s, transform .15s; position: relative;
}
.pwa-nav-ico { width: 24px; height: 24px; display: grid; place-items: center; }
.pwa-nav-ico svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pwa-nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pwa-nav-item.is-active { color: var(--pwa-accent); }
.pwa-nav-item.is-active::before {
    content: ""; position: absolute; top: -6px; width: 22px; height: 3px; border-radius: 0 0 4px 4px; background: var(--pwa-accent);
}
.pwa-nav-item.is-tap { transform: scale(.92); }
.pwa-nav-item.is-center .pwa-nav-ico {
    width: 46px; height: 46px; margin-top: -22px; border-radius: 16px; color: #fff;
    background: linear-gradient(135deg, var(--pwa-accent), #2563EB);
    box-shadow: 0 8px 18px color-mix(in srgb, var(--pwa-accent) 45%, transparent), 0 0 0 4px var(--pwa-bg);
}
.pwa-nav-item.is-center .pwa-nav-ico svg { width: 24px; height: 24px; }
.pwa-nav-item.is-center.is-active::before { display: none; }
@media (min-width: 900px) { html:not(.pwa-standalone) .pwa-nav { display: none; } html:not(.pwa-standalone).pwa-nav-on body { padding-bottom: 0 !important; } }

/* ===== الأوراق السفلية ===== */
.pwa-sheet { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: flex-end; justify-content: center; font-family: inherit; direction: rtl; }
.pwa-sheet[hidden] { display: none; }
.pwa-sheet-backdrop { position: absolute; inset: 0; background: rgba(2, 8, 23, .55); opacity: 0; transition: opacity .28s; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.pwa-sheet-card {
    position: relative; width: 100%; max-width: 460px; max-height: 92vh; overflow: auto;
    background: var(--pwa-bg); color: var(--pwa-fg);
    border-radius: 24px 24px 0 0; padding: 26px 22px calc(18px + var(--pwa-safe-b));
    box-shadow: 0 -20px 60px rgba(2, 8, 23, .3);
    transform: translateY(105%); transition: transform .32s cubic-bezier(.2, .9, .25, 1);
}
.pwa-sheet-card::before { content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--pwa-line); }
.pwa-sheet.is-open .pwa-sheet-backdrop { opacity: 1; }
.pwa-sheet.is-open .pwa-sheet-card { transform: none; }
@media (min-width: 700px) {
    .pwa-sheet { align-items: center; }
    .pwa-sheet-card { border-radius: 24px; transform: translateY(24px) scale(.98); opacity: 0; transition: transform .28s, opacity .28s; }
    .pwa-sheet.is-open .pwa-sheet-card { opacity: 1; }
    .pwa-sheet-card::before { display: none; }
}
.pwa-x { position: absolute; top: 12px; left: 12px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--pwa-soft); color: var(--pwa-muted); font-size: 22px; line-height: 1; cursor: pointer; }
.pwa-app-row { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.pwa-app-icon { width: 60px; height: 60px; border-radius: 15px; box-shadow: 0 6px 18px rgba(2, 8, 23, .15); flex: none; }
.pwa-app-name { font-weight: 800; font-size: 17px; }
.pwa-app-sub { color: var(--pwa-muted); font-size: 12.5px; margin-top: 2px; }
.pwa-title { font-size: 19px; font-weight: 800; margin: 0 0 6px; line-height: 1.5; color: inherit; }
.pwa-text { margin: 0 0 14px; color: var(--pwa-muted); line-height: 1.8; font-size: 14.5px; }
.pwa-perks { list-style: none; margin: 0 0 18px; padding: 12px 14px; background: var(--pwa-soft); border-radius: 14px; display: grid; gap: 8px; font-size: 14px; }
.pwa-btn {
    display: block; width: 100%; border: 0; border-radius: 14px; padding: 15px 18px; cursor: pointer;
    font: inherit; font-weight: 800; font-size: 16px; color: #fff;
    background: linear-gradient(135deg, var(--pwa-accent), #2563EB);
    box-shadow: 0 10px 22px color-mix(in srgb, var(--pwa-accent) 35%, transparent);
    transition: transform .12s, opacity .2s;
}
.pwa-btn:active { transform: scale(.98); }
.pwa-btn.is-busy { opacity: .65; pointer-events: none; }
.pwa-btn-ghost { background: var(--pwa-soft); color: var(--pwa-fg); box-shadow: none; }
.pwa-later, .pwa-off { display: block; width: 100%; margin-top: 8px; padding: 12px; border: 0; background: none; color: var(--pwa-muted); font: inherit; font-size: 14px; cursor: pointer; }
.pwa-off { color: #DC2626; font-size: 13px; }
.pwa-off[hidden], .pwa-later[hidden], .pwa-btn[hidden] { display: none; }
.pwa-mode { display: none; }
#pwa-install[data-mode="prompt"] .pwa-mode-prompt,
#pwa-install[data-mode="ios"] .pwa-mode-ios,
#pwa-install[data-mode="inapp"] .pwa-mode-inapp,
#pwa-install[data-mode="manual"] .pwa-mode-manual { display: block; }
.pwa-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pwa-steps li { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 14px; background: var(--pwa-soft); border-radius: 14px; font-size: 14.5px; }
.pwa-step-n { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--pwa-accent); color: #fff; font-weight: 800; font-size: 13px; flex: none; }
.pwa-share { width: 22px; height: 22px; fill: none; stroke: #0A84FF; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pwa-muted { color: var(--pwa-muted); font-size: 12.5px; }
.pwa-arrow { text-align: center; font-size: 26px; color: var(--pwa-accent); margin-top: 8px; animation: pwa-bounce 1.2s infinite; }
@keyframes pwa-bounce { 50% { transform: translateY(6px); } }
.pwa-note { margin: 0 0 12px; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, #F59E0B 12%, transparent); line-height: 1.8; font-size: 14px; }
.pwa-bell { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; margin-bottom: 12px; color: #fff; background: linear-gradient(135deg, var(--pwa-accent), #2563EB); animation: pwa-ring 2.4s ease-in-out infinite; transform-origin: 50% 10%; }
.pwa-bell svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
@keyframes pwa-ring { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(12deg); } 82% { transform: rotate(-10deg); } 89% { transform: rotate(6deg); } }
.pwa-topics { display: grid; gap: 8px; margin: 4px 0 16px; }
.pwa-topic { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--pwa-line); border-radius: 14px; cursor: pointer; }
.pwa-topic-txt { display: grid; gap: 2px; }
.pwa-topic-txt b { font-size: 14.5px; }
.pwa-topic-txt small { color: var(--pwa-muted); font-size: 12.5px; }
.pwa-topic.is-locked { background: var(--pwa-soft); cursor: default; }
.pwa-lock { flex: none; font-size: 12px; font-weight: 700; color: #B45309; background: color-mix(in srgb, #F59E0B 16%, transparent); padding: 6px 10px; border-radius: 999px; text-decoration: none !important; }
.pwa-switch { -webkit-appearance: none; appearance: none; flex: none; width: 46px; height: 28px; border-radius: 999px; background: #CBD5E1; position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.pwa-switch::after { content: ""; position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.pwa-switch:checked { background: var(--pwa-accent); }
.pwa-switch:checked::after { transform: translateX(-18px); }
.pwa-err { margin: -6px 0 12px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, #DC2626 10%, transparent); color: #B91C1C; font-size: 13.5px; line-height: 1.7; }
.pwa-err[hidden] { display: none; }

/* ===== زر الجرس العائم (الخطوة 200) ===== */
.pwa-bell-fab {
    position: fixed; z-index: 9989; left: 16px; bottom: calc(20px + var(--pwa-safe-b));
    display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 16px 0 12px; border: 0; border-radius: 999px; cursor: pointer;
    font: inherit; font-weight: 800; font-size: 14px; color: #fff; direction: rtl;
    background: linear-gradient(135deg, var(--pwa-accent), #2563EB);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--pwa-accent) 40%, transparent);
    animation: pwa-fab-in .4s ease both;
}
.pwa-bell-fab[hidden] { display: none; }
.pwa-fab-ico { width: 24px; height: 24px; display: grid; place-items: center; animation: pwa-ring 2.4s ease-in-out infinite; transform-origin: 50% 10%; }
.pwa-fab-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pwa-bell-fab.is-compact { width: 48px; padding: 0; justify-content: center; }
.pwa-bell-fab.is-compact .pwa-fab-txt { display: none; }
html.pwa-nav-on .pwa-bell-fab { bottom: calc(var(--pwa-nav-h) + var(--pwa-safe-b) + 14px); }
@keyframes pwa-fab-in { from { transform: translateY(20px); opacity: 0; } }

/* ===== التنبيه السريع ===== */
.pwa-toast {
    position: fixed; z-index: 10001; left: 50%; bottom: calc(24px + var(--pwa-safe-b)); transform: translate(-50%, 20px); opacity: 0;
    max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px; background: #0B1220; color: #fff; font-size: 14px; font-weight: 600;
    box-shadow: 0 10px 30px rgba(2, 8, 23, .35); transition: transform .25s, opacity .25s; direction: rtl; text-align: center; pointer-events: none;
}
.pwa-toast[hidden] { display: none; }
.pwa-toast.is-on { transform: translate(-50%, 0); opacity: 1; }
html.pwa-nav-on .pwa-toast { bottom: calc(var(--pwa-nav-h) + var(--pwa-safe-b) + 14px); }

@media (prefers-reduced-motion: reduce) {
    .pwa-sheet-card, .pwa-sheet-backdrop, .pwa-toast, .pwa-nav-item { transition: none; }
    .pwa-bell, .pwa-arrow { animation: none; }
}
