/* Demo mode (spec 2026-09-27-demo-mode-design.md §7): the «نسخة تجريبية» bar, the trial-ended popup,
   plan badges, and the small demo blocks the admin, dashboard, users and login pages use.
   Loaded only while demo mode is on (partials/demo_assets.php). No horizontal scroll at 360 px. */

:root { --demo-bar-h: 30px; }

.demo-bar,
.demo-bar *,
.demo-card,
.demo-card *,
.plan-badge {
  font-family: "IBM Plex Sans Arabic", -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, sans-serif;
  box-sizing: border-box;
}

/* ---------- Bar: thin, sticky, one line ---------- */
.demo-bar {
  position: sticky; top: 0; z-index: 120;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; height: var(--demo-bar-h); margin: 0; padding: 0 12px;
  overflow: hidden; white-space: nowrap; direction: rtl;
  background: #1b1428; color: #e9dcff; border-bottom: 1px solid #3d2d63;
  font-size: 12px; line-height: 1;
}
.demo-bar-label { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; font-weight: 700; color: #fff; }
.demo-bar-label::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: #b58cff; box-shadow: 0 0 0 3px rgba(181, 140, 255, .22);
}
.demo-bar-time { flex-shrink: 0; color: #cdb9f7; }
.demo-bar-time [data-demo-minutes] { font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.demo-bar .demo-bar-link {
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
  color: #fff; font-weight: 600; text-decoration: underline;
  text-underline-offset: 3px; text-decoration-color: rgba(233, 220, 255, .45);
}
.demo-bar .demo-bar-link:hover { text-decoration-color: currentColor; }
.demo-bar .demo-bar-toggle {
  position: relative; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 5px;
  width: auto; height: 22px; margin: 0; padding: 0 9px;
  border: 1px solid #6b4fb3; border-radius: 999px;
  background: transparent; color: #e9dcff;
  font-size: 11px; font-weight: 600; line-height: 1; cursor: pointer;
}
.demo-bar .demo-bar-toggle:hover,
.demo-bar .demo-bar-toggle[aria-pressed="false"] { background: #2b2140; }
.demo-bar .demo-bar-form { display: contents; }
.demo-bar-eye { width: 13px; height: 13px; flex-shrink: 0; }
.demo-bar a:focus-visible,
.demo-bar button:focus-visible { outline: 2px solid #b58cff; outline-offset: 1px; }

@media (max-width: 480px) {
  .demo-bar { gap: 10px; padding: 0 10px; }
  .demo-bar .demo-bar-toggle { padding: 0 7px; }
  .demo-bar-toggle-text {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
}
@media (max-width: 340px) {
  .demo-bar { gap: 8px; padding: 0 8px; }
  .demo-bar-label::before { display: none; }
}

/* Other sticky bars stop below the demo bar instead of sliding under it. */
.demo-bar ~ main .category-sticky-bar,
.demo-bar ~ main #stickyNav { top: var(--demo-bar-h); }
[data-menu-layout="kiosk"] .demo-bar ~ main #stickyNav { max-height: calc(100vh - var(--demo-bar-h)); }
.demo-bar ~ .admin-shell { min-height: calc(100vh - var(--demo-bar-h)); }
.demo-bar ~ .admin-shell .admin-topbar { top: var(--demo-bar-h); }
.demo-bar ~ .admin-shell .admin-sidebar { top: var(--demo-bar-h); height: calc(100vh - var(--demo-bar-h)); }

/* ---------- Plan badges (Tasks 4, 7, 9) ---------- */
.plan-badge,
html a.plan-badge {
  display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle;
  margin: 0; padding: 2px 8px;
  border: 1px solid #6b4fb3; border-radius: 999px;
  background: #2b2140; color: #e9dcff;
  font-size: .7rem; font-weight: 600; line-height: 1.5; letter-spacing: 0;
  white-space: nowrap; text-decoration: none; direction: rtl;
}
html a.plan-badge:hover { background: #3a2c57; color: #fff; }
html a.plan-badge:focus-visible { outline: 2px solid #b58cff; outline-offset: 2px; }
.plan-badge.plan-badge-float {
  position: absolute; top: 8px; inset-inline-start: 8px; z-index: 5;
  max-width: calc(100% - 16px); box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}
/* Above the host instead of on it: its corner holds a control (phone search toggle, round floating button). */
.plan-badge.plan-badge-float.plan-badge-edge {
  top: -4px; inset-inline-start: 0; max-width: none; transform: translateY(-100%);
}
.plan-badge.plan-badge-nav {
  flex-shrink: 1; min-width: 0; max-width: 55%;
  margin-inline-start: auto; padding: 1px 6px; font-size: .62rem;
}
.plan-badge.plan-badge-limit { margin-inline-start: 6px; }
html.demo-badges-hidden [data-plan-badge] { display: none !important; }

/* ---------- Trial-ended popup ---------- */
.demo-overlay {
  position: fixed; inset: 0; z-index: 2147483000;
  display: grid; place-items: center; padding: 16px; overflow-y: auto;
  background: rgba(8, 6, 14, .84);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  direction: rtl;
}
.demo-card {
  width: min(440px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  margin: 0; padding: 26px 22px 20px;
  border: 1px solid #3d2d63; border-radius: 18px;
  background: #161320; color: #ece8f6; text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .55); outline: none;
}
.demo-card .demo-card-title { margin: 0 0 8px; font-size: 1.2rem; font-weight: 700; line-height: 1.4; color: #d9c4ff; }
.demo-card .demo-card-text { margin: 0 0 18px; font-size: .95rem; line-height: 1.8; color: #b3abc6; white-space: pre-line; overflow-wrap: anywhere; }
.demo-card .demo-restart { margin: 0 0 16px; padding: 0 0 16px; border-bottom: 1px solid #2b2440; }
.demo-card .demo-restart-btn {
  display: block; width: 100%; margin: 0; padding: 12px;
  border: 0; border-radius: 10px; background: #7c5cd6; color: #fff;
  font-size: 1rem; font-weight: 700; cursor: pointer;
}
.demo-card .demo-restart-btn:hover { background: #6a4bc4; }
.demo-card .demo-restart-btn:disabled { opacity: .6; cursor: progress; }
.demo-card .demo-restart-btn:focus-visible { outline: 2px solid #d9c4ff; outline-offset: 2px; }
.demo-card .demo-restart-note { margin: 8px 0 0; font-size: .8rem; color: #8f86a6; }
.demo-card .demo-restart-error {
  margin: 8px 0 0; padding: 8px 10px; border-radius: 8px;
  background: #3a1f28; color: #ffb4c0; font-size: .85rem; line-height: 1.6;
}
.demo-card .demo-restart-error[hidden] { display: none; }
.demo-card .sc-buttons { display: grid; gap: 10px; }
.demo-card .sc-btn {
  display: block; padding: 11px; border: 1px solid #2f2845; border-radius: 10px;
  background: #0f0d16; color: #ece8f6; font-weight: 600; text-decoration: none; overflow-wrap: anywhere;
}
.demo-card .sc-wa { background: #25d366; border-color: #25d366; color: #06240f; }
.demo-card .demo-card-features {
  display: inline-block; margin-top: 16px; color: #d9c4ff; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px;
}
.demo-card .demo-owner { display: block; margin-top: 14px; font-size: .78rem; color: #6f6885; text-decoration: none; }
.demo-blocked-body { margin: 0; min-height: 100vh; background: #0d0b13; }
@media (max-width: 400px) {
  .demo-card { padding: 22px 16px 18px; border-radius: 14px; }
  .demo-card .demo-card-title { font-size: 1.08rem; }
}

/* ---------- Admin: feature strip under the page header (Task 7) ---------- */
.demo-feature-strip {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px;
  max-width: 1176px; margin: 18px 32px 0; padding: 12px 16px;
  border: 1px solid #4a3780; border-radius: 12px;
  background: linear-gradient(135deg, rgba(124, 92, 214, .16), rgba(124, 92, 214, .05));
}
.demo-feature-strip strong { font-size: .92rem; color: var(--a-text, #fff); }
.demo-feature-strip p { flex: 1 1 240px; min-width: 0; margin: 0; font-size: .86rem; line-height: 1.6; color: var(--a-muted, #b3abc6); }
@media (max-width: 900px) { .demo-feature-strip { margin: 14px 16px 0; } }

/* ---------- Admin: dashboard welcome card «جرّب هذه أولًا» (Task 7) ---------- */
.demo-welcome {
  margin: 0 0 20px; padding: 20px;
  border: 1px solid #4a3780; border-radius: 14px;
  background: linear-gradient(135deg, rgba(124, 92, 214, .18), rgba(124, 92, 214, .04));
}
.demo-welcome[hidden] { display: none; }
.demo-welcome-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.demo-welcome-head h2 { margin: 0; font-size: 1.1rem; }
.demo-welcome-list {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 10px;
  margin: 0; padding: 0; list-style: none;
}
.demo-welcome-list a {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 12px 14px;
  border: 1px solid var(--a-line, #2f2845); border-radius: 10px;
  background: var(--a-surface, #161320); color: var(--a-text, #fff);
  font-weight: 600; text-decoration: none;
}
.demo-welcome-list a:hover { border-color: #7c5cd6; }
.demo-welcome-num {
  display: grid; place-items: center; flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  background: #7c5cd6; color: #fff; font-size: .8rem; font-weight: 700;
}
.demo-welcome-more { display: inline-block; margin-top: 14px; font-weight: 600; color: #b996ff; }
.demo-welcome-hide {
  flex-shrink: 0; margin: 0; padding: 4px 10px; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--a-muted, #b3abc6); font: inherit; font-size: .8rem; cursor: pointer;
}
.demo-welcome-hide:hover { border-color: var(--a-line, #2f2845); color: var(--a-text, #fff); }

/* ---------- Admin: users page locked in demo mode (Task 7) ---------- */
.demo-locked-card {
  max-width: 560px; margin: 24px auto; padding: 28px 22px;
  border: 1px dashed #4a3780; border-radius: 14px;
  background: rgba(124, 92, 214, .08); text-align: center;
}
.demo-locked-icon {
  display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  background: #2b2140; color: #d9c4ff;
}
.demo-locked-card h2 { margin: 8px 0 6px; font-size: 1.1rem; }
.demo-locked-card p { margin: 0 0 14px; line-height: 1.7; color: var(--a-muted, #b3abc6); }

/* ---------- Login page hint (Task 7) ---------- */
.demo-login-hint {
  margin: 0 0 14px; padding: 12px;
  border: 1px solid #4a3780; border-radius: 8px;
  background: #221a33; color: #e9dcff;
  font-size: .9rem; line-height: 1.7; direction: rtl; text-align: right;
}
.demo-login-hint a { display: inline-block; margin-top: 4px; font-weight: 700; color: #d9c4ff; }
