/* =========================================================
   صفحة المساجد ثلاثية الأبعاد — النموذج الأول «معاصر»
   ========================================================= */

.x3-canvas { position: absolute; inset: 0; touch-action: pan-y; cursor: grab; }
.x3-canvas:active { cursor: grabbing; }
.x3-canvas canvas { display: block; width: 100% !important; height: 100% !important; outline: none; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 14px; margin-bottom: 26px; }
.crumbs--light { color: rgba(255, 255, 255, .6); }
.crumbs--light a:hover { color: #fff; }
.crumbs--light span { color: #fff; font-weight: 600; }
.x3-hint { position: absolute; bottom: 18px; left: 50%; translate: -50% 0; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: rgba(255, 255, 255, .7); background: rgba(255, 255, 255, .08); padding: 5px 14px; border-radius: 999px; backdrop-filter: blur(6px); pointer-events: none; white-space: nowrap; animation: hintPulse 3s ease-in-out infinite; }
.x3-hint--dark { color: var(--ink-2); background: rgba(255, 255, 255, .7); bottom: 96px; }
@keyframes hintPulse { 50% { opacity: .55; } }

/* ---------- 1. الكرة ---------- */
.x3-globe { position: relative; min-height: calc(100vh - 124px); display: flex; align-items: center; color: #fff; overflow: hidden; background: radial-gradient(1100px 700px at 25% 50%, #1f7fbe 0%, transparent 60%), linear-gradient(160deg, #0b3654, var(--blue-deep) 50%, #072a42); padding: 40px 0 80px; }
.x3-globe__bg i { position: absolute; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .06); left: 25%; top: 50%; translate: -50% -50%; animation: orbit 30s linear infinite; }
.x3-globe__bg i:nth-child(1) { width: 720px; height: 720px; }
.x3-globe__bg i:nth-child(2) { width: 980px; height: 980px; border-style: dashed; animation-duration: 60s; animation-direction: reverse; }
.x3-globe__bg i:nth-child(3) { width: 1260px; height: 1260px; }
@keyframes orbit { to { rotate: 360deg; } }
.x3-globe__grid { position: relative; display: grid; grid-template-columns: 1fr 1.1fr; gap: 40px; align-items: center; width: min(100% - 32px, 1320px); }
.x3-tag { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: rgba(255, 255, 255, .85); margin-bottom: 16px; }
.x3-tag b { background: var(--gold); color: var(--ink); padding: 1px 10px; border-radius: 8px; font-weight: 700; letter-spacing: .05em; }
.x3-title { font-size: clamp(34px, 4.4vw, 58px); font-weight: 700; line-height: 1.2; margin-bottom: 16px; }
.x3-title span { color: var(--gold); }
.x3-lead { font-size: 17.5px; color: rgba(255, 255, 255, .78); max-width: 520px; margin-bottom: 28px; }
.x3-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 560px; }
.x3-chip { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); color: #fff; font-size: 14.5px; font-weight: 500; transition: background .25s, border-color .25s, transform .25s var(--ease); opacity: 0; transform: translateY(14px); animation: chipIn .6s var(--ease) forwards; animation-delay: var(--d); }
@keyframes chipIn { to { opacity: 1; transform: none; } }
.x3-chip .flag { width: 26px; height: 26px; border-radius: 50%; flex: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, .15); }
.x3-chip:hover { background: rgba(255, 255, 255, .12); transform: translateY(-2px); }
.x3-chip.is-active { background: #fff; color: var(--blue-deep); border-color: #fff; }
.x3-chip.is-active .flag { box-shadow: 0 0 0 2px var(--gold); }
.x3-picked { display: flex; align-items: center; gap: 14px; margin-top: 22px; padding: 14px 16px; border-radius: 18px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); backdrop-filter: blur(10px); max-width: 560px; animation: chipIn .5s var(--ease); }
.x3-picked__flag .flag { width: 46px; height: 46px; border-radius: 50%; display: block; box-shadow: 0 0 0 3px var(--gold); }
.x3-picked > div { flex: 1; line-height: 1.4; }
.x3-picked b { display: block; font-size: 18px; }
.x3-picked small { color: rgba(255, 255, 255, .7); }
.x3-globe__stage { position: relative; height: min(640px, 72vh); }
.x3-tip { position: absolute; z-index: 3; pointer-events: none; padding: 6px 12px; border-radius: 10px; background: #fff; color: var(--blue-deep); font-weight: 700; font-size: 14px; box-shadow: var(--sh-lg); translate: -50% calc(-100% - 14px); white-space: nowrap; }
.x3-tip::after { content: ""; position: absolute; bottom: -5px; left: 50%; width: 10px; height: 10px; background: #fff; transform: translateX(-50%) rotate(45deg); }
.x3-scroll { position: absolute; bottom: 22px; left: 50%; translate: -50% 0; width: 26px; height: 42px; border: 2px solid rgba(255, 255, 255, .5); border-radius: 14px; }
.x3-scroll span { position: absolute; top: 7px; left: 50%; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: #fff; animation: wheel 1.6s infinite; }
@keyframes wheel { to { transform: translateY(14px); opacity: 0; } }

/* ---------- 2. المصمّم ---------- */
.x3-config { position: relative; display: grid; grid-template-columns: 1fr 420px; min-height: calc(100vh - 84px); background: #fff; }
.x3-config__view { position: relative; min-height: 640px; overflow: hidden; background: linear-gradient(180deg, #a9d3ef 0%, #d9ecf8 55%, #f3f8fc 100%); transition: background 1.2s; order: 1; }
.x3-config.is-night .x3-config__view { background: linear-gradient(180deg, #061c2d 0%, #0b3654 55%, #134a72 100%); }
.x3-config.is-night .x3-hint--dark { background: rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .75); }
.x3-topbar { position: absolute; top: 18px; inset-inline: 18px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; z-index: 4; pointer-events: none; }
.x3-topbar > * { pointer-events: auto; }
.x3-badge { display: flex; align-items: center; gap: 10px; padding: 6px 16px 6px 6px; border-radius: 999px; background: rgba(255, 255, 255, .92); box-shadow: var(--sh); font-weight: 700; color: var(--blue-deep); font-size: 15px; backdrop-filter: blur(10px); }
.x3-badge .flag { width: 30px; height: 30px; border-radius: 50%; }
.x3-badge small { font-weight: 500; color: var(--muted); }
.x3-tools { display: flex; gap: 6px; padding: 5px; border-radius: 16px; background: rgba(255, 255, 255, .92); box-shadow: var(--sh); backdrop-filter: blur(10px); }
.x3-tool { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--ink-2); transition: .2s; }
.x3-tool:hover { background: var(--blue-50); color: var(--blue); }
.x3-tool.is-on { background: var(--blue); color: #fff; }
.x3-tool .ic { width: 19px; height: 19px; }
.x3-capbar { position: absolute; z-index: 4; bottom: 22px; left: 50%; translate: -50% 0; display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 999px; background: rgba(255, 255, 255, .95); box-shadow: var(--sh-lg); }
.x3-capbar__btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-50); color: var(--blue); transition: .2s; }
.x3-capbar__btn:hover { background: var(--blue); color: #fff; }
.x3-capbar__btn:disabled { opacity: .3; pointer-events: none; }
.x3-capbar__val { min-width: 130px; text-align: center; line-height: 1.1; }
.x3-capbar__val b { display: block; font-size: 26px; font-weight: 700; color: var(--blue-deep); }
.x3-capbar__val span { font-size: 12.5px; color: var(--muted); }
.x3-capbar__val.is-bump b { animation: bump .45s var(--ease); }
@keyframes bump { 40% { transform: scale(1.15); color: var(--blue); } }

/* النقاط التعريفية */
.x3-hotspots { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.x3-hotspots.is-off { display: none; }
.hs { position: absolute; left: 0; top: 0; transition: opacity .3s; will-change: transform; }
.hs.is-hidden { opacity: 0; }
.hs__dot { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(28, 121, 181, .45); }
.hs__dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #fff; animation: ping 2s infinite; }
@keyframes ping { to { transform: scale(2.4); opacity: 0; } }
.hs__lbl { position: absolute; top: -12px; right: 16px; white-space: nowrap; padding: 4px 12px; border-radius: 10px; background: rgba(15, 68, 103, .88); color: #fff; font-size: 13px; line-height: 1.4; backdrop-filter: blur(6px); }
.hs__lbl b { display: block; color: var(--gold); font-size: 12px; font-weight: 700; }

.x3-fallback { position: absolute; inset: 0; display: grid; place-items: end center; padding-bottom: 90px; }
.x3-fallback .mosque-svg { width: min(90%, 760px); height: auto; }
.x3-fallback p { position: absolute; top: 80px; left: 50%; translate: -50% 0; font-size: 13px; color: var(--muted); background: #fff; padding: 4px 14px; border-radius: 999px; }

/* اللوحة */
.x3-panel { order: 2; display: flex; flex-direction: column; border-inline-start: 1px solid var(--line); background: #fff; position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); max-height: 900px; z-index: 5; }
.x3-panel__head { padding: 24px 26px 14px; }
.x3-panel__step { font-size: 13px; font-weight: 700; color: var(--blue); }
.x3-panel__head h2 { font-size: 24px; line-height: 1.35; color: var(--blue-deep); }
.x3-tabs { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 26px; padding: 4px; border-radius: 14px; background: var(--bg-2); }
.x3-tabs button { height: 40px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--muted); transition: .25s var(--ease); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.x3-tabs button.is-active { background: #fff; color: var(--blue); box-shadow: var(--sh-sm); }
.x3-tabs i { font-style: normal; font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--blue); color: #fff; display: none; place-items: center; padding: 0 5px; }
.x3-tabs i:not(:empty) { display: inline-grid; }
.x3-panel__body { flex: 1; overflow-y: auto; padding: 18px 26px; scrollbar-width: thin; }
.x3-pane { display: none; }
.x3-pane.is-active { display: block; animation: paneIn .45s var(--ease); }
@keyframes paneIn { from { opacity: 0; transform: translateX(-14px); } }
.x3-caps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.x3-cap { position: relative; padding: 10px 8px; border-radius: 14px; border: 1.5px solid var(--line); text-align: center; transition: .25s var(--ease); line-height: 1.25; }
.x3-cap b { display: block; font-size: 19px; font-weight: 700; color: var(--blue-deep); }
.x3-cap small { font-size: 11.5px; color: var(--muted); }
.x3-cap:hover:not(:disabled) { border-color: var(--blue-100); transform: translateY(-2px); }
.x3-cap.is-active { border-color: var(--blue); background: var(--blue-50); box-shadow: 0 8px 20px -12px rgba(28, 121, 181, .8); }
.x3-cap.is-active b { color: var(--blue); }
.x3-cap:disabled { opacity: .35; cursor: not-allowed; }
.x3-cap:disabled small { text-decoration: line-through; }
.x3-specs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.x3-specs div { padding: 10px 12px; border-radius: 12px; background: var(--bg-2); line-height: 1.3; }
.x3-specs small { display: block; font-size: 12px; color: var(--muted); }
.x3-specs b { font-size: 16px; color: var(--ink); }
.x3-desc { font-size: 14px; color: var(--ink-2); line-height: 1.9; }
.x3-note { font-size: 13px; color: var(--muted); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.x3-3d { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; padding: 1px 6px; border-radius: 6px; background: var(--gold); color: var(--ink); }
.x3-svcs { display: grid; gap: 8px; }
.x3-svc { display: grid; grid-template-columns: 38px 1fr auto 22px; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 14px; border: 1.5px solid var(--line); text-align: start; transition: .25s var(--ease); }
.x3-svc:hover { border-color: var(--blue-100); }
.x3-svc__ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--bg-2); color: var(--ink-2); transition: .3s; }
.x3-svc__ic .ic { width: 18px; height: 18px; }
.x3-tabs .x3-only-m, .x3-wiz { display: none; }
.x3-svc__name { font-weight: 600; font-size: 14.5px; display: flex; align-items: center; gap: 6px; }
.x3-svc__price { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.x3-svc__box { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line); display: grid; place-items: center; transition: .25s; }
.x3-svc__box svg { width: 13px; height: 13px; fill: none; stroke: #fff; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .35s; }
.x3-svc.is-on { border-color: var(--blue); background: var(--blue-50); }
.x3-svc.is-on .x3-svc__ic { background: var(--blue); color: #fff; }
.x3-svc.is-on .x3-svc__box { background: var(--blue); border-color: var(--blue); }
.x3-svc.is-on .x3-svc__box svg { stroke-dashoffset: 0; }
.x3-panel__foot { padding: 16px 26px 22px; border-top: 1px solid var(--line); background: #fff; }
.x3-sum div { display: flex; justify-content: space-between; font-size: 14px; color: var(--ink-2); padding: 2px 0; }
.x3-sum b { color: var(--ink); }
.x3-total { display: flex; justify-content: space-between; align-items: baseline; margin: 8px 0 12px; }
.x3-total span { font-weight: 700; color: var(--blue); }
.x3-total b { font-size: 32px; font-weight: 700; color: var(--blue-deep); line-height: 1.1; }
.x3-total small { font-size: 14px; color: var(--muted); font-weight: 500; }
.x3-total.is-bump b { animation: bump .45s var(--ease); }

/* ---------- 3. السلة ---------- */
.x3-cart { background: var(--bg-2); }
.x3-cartbox { background: #fff; border-radius: var(--r-xl); border: 1px solid var(--line); padding: clamp(20px, 3vw, 36px); box-shadow: var(--sh); }
.x3-cartbox__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.x3-cartbox__total { text-align: left; line-height: 1.2; }
.x3-cartbox__total small { display: block; color: var(--muted); font-size: 13px; }
.x3-cartbox__total b { font-size: 30px; color: var(--blue); }
.x3-cartlist li { display: grid; grid-template-columns: 46px 1fr auto auto; gap: 14px; align-items: center; padding: 14px 6px; border-bottom: 1px solid var(--line); animation: rowIn .5s var(--ease) both; }
@keyframes rowIn { from { opacity: 0; transform: translateY(12px); } }
.x3-cartlist .flag { width: 46px; height: 46px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); display: block; }
.x3-cartlist b { display: block; font-size: 16px; color: var(--blue-deep); }
.x3-cartlist small { color: var(--muted); font-size: 13px; }
.x3-cartlist output { font-weight: 700; color: var(--blue); white-space: nowrap; }
.x3-cartlist .icon-btn { width: 36px; height: 36px; }
.x3-empty { text-align: center; color: var(--muted); padding: 30px 0; }
.x3-pay { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.x3-pay .btn { flex: 1; min-width: 220px; }

/* ---------- الاستجابة ---------- */
@media (max-width: 1100px) {
  .x3-config { grid-template-columns: 1fr 360px; }
  .x3-chips { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .x3-globe { min-height: 0; padding: 30px 0 70px; }
  .x3-globe__grid { grid-template-columns: 1fr; }
  .x3-globe__stage { height: 380px; order: -1; margin-top: -10px; }
  .x3-chips { grid-template-columns: repeat(3, 1fr); }
  /* المصمّم على الجوال: شاشة كاملة — المسجد ثابت في الأعلى والخطوات أسفله */
  .x3-config { display: flex; flex-direction: column; height: calc(100dvh - var(--header-h)); min-height: 560px; scroll-margin-top: var(--header-h); }
  .x3-config__view { order: 0; flex: 0 0 44%; min-height: 0; height: auto; }
  .x3-panel { order: 1; flex: 1; min-height: 0; position: relative; top: 0; height: auto; max-height: none; border: 0; border-radius: 22px 22px 0 0; margin-top: -18px; box-shadow: 0 -14px 30px -18px rgba(15, 68, 103, .35); }
  .x3-panel__head { display: none; }
  .x3-tabs { margin: 14px 16px 0; grid-template-columns: repeat(4, 1fr); counter-reset: st; }
  .x3-tabs button { height: 44px; flex-direction: column; gap: 0; font-size: 12px; line-height: 1.1; counter-increment: st; }
  .x3-tabs button::before { content: counter(st); font-size: 11px; font-weight: 700; opacity: .6; }
  .x3-tabs button.is-done { color: var(--blue); }
  .x3-tabs i { display: none !important; }
  .x3-tabs .x3-only-m { display: inline-flex !important; }
  .x3-panel__body { flex: 1; overflow-y: auto; padding: 14px 16px; overscroll-behavior: contain; }
  .x3-panel__foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 20px -14px rgba(0, 0, 0, .25); }
  .x3-sum, .x3-total, #addMosque { display: none; }
  .x3-wiz { display: flex; align-items: center; gap: 10px; }
  .x3-wiz__prev { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line); flex: none; transition: .2s; }
  .x3-wiz__prev:disabled { opacity: .3; }
  .x3-wiz__total { flex: 1; line-height: 1.2; }
  .x3-wiz__total small { display: block; font-size: 12px; color: var(--muted); }
  .x3-wiz__total b { font-size: 20px; color: var(--blue-deep); }
  .x3-wiz__next { height: 48px; padding: 0 20px; flex: none; }
  .x3-mchips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .x3-mchips .x3-chip { background: var(--bg-2); border-color: var(--line); color: var(--ink); opacity: 1; transform: none; animation: none; }
  .x3-mchips .x3-chip.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }
  .x3-caps { grid-template-columns: repeat(4, 1fr); }
  .x3-cap b { font-size: 16px; }
  .x3-cap small { font-size: 10.5px; }
  .x3-svc { grid-template-columns: 34px 1fr auto 20px; padding: 8px 10px; }
  .x3-svc__ic { width: 34px; height: 34px; }
  .x3-capbar { bottom: 28px; padding: 4px; }
  .x3-capbar__btn { width: 36px; height: 36px; }
  .x3-capbar__val { min-width: 90px; }
  .x3-capbar__val b { font-size: 20px; }
  .x3-hint--dark, .hs__lbl { display: none; }
  .x3-chips { display: none; }
  .x3-globe__stage { height: 340px; }
  .mbar { display: none !important; }
}
@media (max-width: 600px) {
  .x3-chips { grid-template-columns: repeat(2, 1fr); }
  .x3-topbar { top: 10px; inset-inline: 10px; flex-direction: row; align-items: center; }
  .x3-badge { font-size: 13px; padding: 4px 12px 4px 4px; }
  .x3-badge .flag { width: 24px; height: 24px; }
  .x3-tools { padding: 3px; gap: 2px; }
  #tIn, #tOut { display: none; }
  .x3-tool { width: 36px; height: 36px; }
  .hs__lbl { display: none; }
  .x3-capbar { bottom: 14px; }
  .x3-hint--dark { display: none; }
  .x3-cartlist li { grid-template-columns: 38px 1fr auto; }
  .x3-cartlist li .icon-btn { grid-column: 3; grid-row: 1 / span 2; }
  .x3-cartlist li output { grid-column: 2; }
  .x3-cartlist .flag { width: 38px; height: 38px; }
  .mbar { display: none !important; }
}
@media (prefers-reduced-motion: reduce) { .x3-chip { opacity: 1; transform: none; animation: none; } }
