/* الموقع التجريبي: متجر بسيط بألوان الهوية المعتمدة و IBM Plex Sans Arabic. */
:root {
  --teal: #0D9EA8;
  --ramp-1: #0499AE;
  --ramp-2: #22B398;
  --ramp-3: #74D85D;
  --ink: #0B2A2E;
  --ink-2: #274247;
  --muted: #5E7A78;
  --paper: #F4F9F9;
  --border: #E6F0EF;
  --white: #FFFFFF;
  --outline: #AFC4C2;
  --deep: #0A6E72;
  --deepest: #063C43;
  --bad: #B3261E;
  --tint: rgba(13, 158, 168, 0.08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: 'IBM Plex Sans Arabic', Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.75;
}
a { color: var(--deep); }
img, svg { max-width: 100%; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ---------- الشريط العلوي والهيدر ---------- */
.demo-bar { background: var(--deepest); color: var(--white); font-size: 13px; text-align: center; padding: 7px 16px; }
.site-head { background: var(--white); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(100deg, var(--ramp-1), var(--ramp-2), var(--ramp-3)); display: grid; place-items: center; }
.nav { display: flex; gap: 28px; }
.nav a { color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 15px; padding: 6px 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--deep); border-bottom-color: var(--ramp-2); }
.cart-link { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 15px; }
.cart-link:hover { border-color: var(--outline); background: var(--paper); }
.cart-count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--deep); color: var(--white); display: inline-grid; place-items: center; font-size: 13px; font-variant-numeric: tabular-nums; }

main { padding: 28px 0 72px; min-height: 60vh; }
h1 { font-size: clamp(26px, 3.4vw, 34px); line-height: 1.35; margin: 0 0 6px; font-weight: 700; }
h2 { font-size: 20px; line-height: 1.4; margin: 0 0 14px; font-weight: 700; }
.muted { color: var(--muted); }

.crumbs { font-size: 14px; color: var(--muted); margin: 0 0 20px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--deep); }

/* ---------- صفحة المنتج ---------- */
.product { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: start; }
.gallery-main { background: var(--paper); border-radius: 20px; aspect-ratio: 1 / 1; display: grid; place-items: center; padding: 8%; }
.gallery-main svg { width: 100%; height: auto; display: block; }
.gallery-main [hidden] { display: none; }
.thumbs { display: flex; gap: 12px; margin-top: 12px; }
.thumb { width: 76px; height: 76px; padding: 10px; border-radius: 14px; border: 2px solid transparent; background: var(--paper); cursor: pointer; }
.thumb svg { width: 100%; height: 100%; display: block; }
.thumb[aria-pressed="true"] { border-color: var(--deep); }

.chip { display: inline-block; font-size: 13px; font-weight: 600; color: var(--deep); background: var(--tint); border-radius: 999px; padding: 2px 12px; margin-bottom: 10px; }
.price-row { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 4px; }
.price { font-size: 30px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.price-note { font-size: 14px; color: var(--muted); }
.stock { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--deep); margin-bottom: 14px; }
.stock::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ramp-2); }
.lead { color: var(--ink-2); margin: 0 0 22px; max-width: 46ch; }

.buy { display: grid; grid-template-columns: auto 1fr; gap: 12px; margin-bottom: 12px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--outline); border-radius: 12px; background: var(--white); height: 52px; }
.qty button { width: 44px; height: 100%; border: 0; background: transparent; font-size: 20px; color: var(--ink); cursor: pointer; border-radius: 12px; }
.qty button:hover { background: var(--tint); }
.qty output { min-width: 36px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 28px;
  border: 1px solid var(--deep); border-radius: 12px; background: var(--deep); color: var(--white);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; transition: background 0.15s;
}
.btn:hover { background: var(--deepest); border-color: var(--deepest); }
.btn-ghost { background: var(--white); color: var(--deep); border-color: var(--outline); }
.btn-ghost:hover { background: var(--tint); border-color: var(--deep); }
.btn-block { width: 100%; }
.btn:focus-visible, .qty button:focus-visible, .thumb:focus-visible, input:focus-visible, .pay:focus-within, .cart-link:focus-visible, .xray-tab:focus-visible, .xr-btn:focus-visible {
  outline: 3px solid var(--ramp-2); outline-offset: 2px;
}

.added { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 14px 16px; border: 1px solid var(--ramp-2); background: rgba(34, 179, 152, 0.08); border-radius: 14px; }
.added[hidden] { display: none; }
.added p { margin: 0; font-weight: 500; }
.added a { font-weight: 700; }

.perks { list-style: none; margin: 24px 0 0; padding: 20px 0 0; border-top: 1px solid var(--border); display: grid; gap: 12px; }
.perks li { display: flex; align-items: center; gap: 12px; font-size: 15px; color: var(--ink-2); }
.perks svg { flex: none; color: var(--deep); }

.details { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; margin-top: 56px; padding-top: 40px; border-top: 1px solid var(--border); }
.details p { color: var(--ink-2); margin: 0 0 12px; }
.specs { width: 100%; border-collapse: collapse; }
.specs th, .specs td { text-align: right; padding: 11px 0; border-bottom: 1px solid var(--border); font-weight: 400; }
.specs th { color: var(--muted); width: 40%; }

/* ---------- الدفع ---------- */
.checkout { display: grid; grid-template-columns: 1.35fr 1fr; gap: 32px; align-items: start; }
.card { background: var(--white); border: 1px solid var(--border); border-radius: 18px; padding: 24px; }
.summary { background: var(--paper); border-color: var(--paper); position: sticky; top: 92px; }
.block + .block { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.block-head h2 { margin: 0; }
.link-btn { border: 0; background: none; color: var(--deep); font: inherit; font-size: 14px; font-weight: 600; text-decoration: underline; cursor: pointer; padding: 6px 0; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 14px; color: var(--ink-2); }
.field input {
  width: 100%; min-height: 50px; padding: 0 14px; border: 1px solid var(--outline); border-radius: 12px;
  background: var(--white); color: var(--ink); font: inherit;
}
.field input[type="tel"], .field input[type="email"] { direction: ltr; text-align: left; }
.field input::placeholder { color: var(--outline); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pays { display: grid; gap: 10px; }
.pay { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--outline); border-radius: 12px; cursor: pointer; font-weight: 500; }
.pay input { width: 18px; height: 18px; accent-color: var(--deep); }
.pay:has(input:checked) { border-color: var(--deep); background: var(--tint); }
.pay small { display: block; color: var(--muted); font-weight: 400; }
.hint { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.error { color: var(--bad); font-size: 14px; font-weight: 600; margin: 0 0 12px; }

.sum-item { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.sum-thumb { width: 64px; height: 64px; flex: none; border-radius: 12px; background: var(--white); border: 1px solid var(--border); padding: 8px; }
.sum-item strong { display: block; line-height: 1.5; }
.sum-item span { font-size: 14px; color: var(--muted); }
.line { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.line.total { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--ink); font-weight: 700; font-size: 19px; }

/* ---------- الشكر ---------- */
.narrow { max-width: 680px; margin: 0 auto; }
.thanks { text-align: center; padding: 36px 24px; }
.thanks-mark { width: 64px; height: 64px; border-radius: 999px; background: linear-gradient(100deg, var(--ramp-1), var(--ramp-2), var(--ramp-3)); display: grid; place-items: center; margin: 0 auto 16px; }
.order-id { display: inline-block; margin-inline-start: 6px; padding: 4px 14px; border-radius: 999px; background: var(--paper); font-family: 'IBM Plex Mono', monospace; font-size: 15px; direction: ltr; }
.attr-table { width: 100%; border-collapse: collapse; }
.attr-table th, .attr-table td { text-align: right; padding: 10px 0; border-bottom: 1px solid var(--border); font-weight: 400; }
.attr-table th { color: var(--muted); width: 45%; }
.attr-table td { font-family: 'IBM Plex Mono', monospace; font-size: 14px; direction: ltr; text-align: left; overflow-wrap: anywhere; }
.stack { display: grid; gap: 20px; }
.demo-tag { display: inline-block; font-size: 12px; font-weight: 700; color: var(--deepest); background: rgba(116, 216, 93, 0.35); border-radius: 6px; padding: 1px 8px; margin-inline-start: 8px; vertical-align: middle; }

/* ---------- الفوتر ---------- */
.site-foot { border-top: 1px solid var(--border); background: var(--paper); padding: 28px 0; font-size: 14px; color: var(--muted); }
.site-foot .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-foot strong { color: var(--ink-2); }

/* ---------- السلة ---------- */
.cart-row { display: grid; grid-template-columns: auto 1fr auto auto auto; align-items: center; gap: 18px; }
.cart-info strong { display: block; line-height: 1.5; }
.cart-info span { font-size: 14px; color: var(--muted); }
.cart-row .qty { height: 46px; }
.cart-line { font-variant-numeric: tabular-nums; min-width: 90px; text-align: left; }
.cart-remove { color: var(--bad); }
.buy-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- لينكات الإعلانات ---------- */
.ads { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.ad { border: 1px solid var(--border); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 12px; background: var(--white); }
.ad-top { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.ad-top .chip { margin: 0; }
.ad-ids { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: 14px; }
.ad-ids dt { color: var(--muted); }
.ad-ids dd { margin: 0; font-family: 'IBM Plex Mono', monospace; direction: ltr; text-align: left; overflow-wrap: anywhere; }
.ad-link { display: block; direction: ltr; text-align: left; font-family: 'IBM Plex Mono', monospace; font-size: 12px; line-height: 1.6; color: var(--ink-2); background: var(--paper); border-radius: 10px; padding: 10px; overflow-wrap: anywhere; margin-top: auto; }

/* ---------- لوحة X-Ray (مبسّطة) ---------- */
.xray { position: fixed; left: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.xray-tab {
  order: 2; min-height: 44px; padding: 0 20px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--deepest); color: var(--white); font: inherit; font-weight: 600; letter-spacing: 0.02em;
  box-shadow: 0 8px 20px rgba(34, 179, 152, 0.32);
}
.xray-panel {
  order: 1; display: none; width: min(320px, calc(100vw - 32px)); max-height: min(70vh, 560px);
  background: var(--white); border: 1px solid var(--outline); border-radius: 16px; overflow: hidden;
  box-shadow: 0 16px 40px rgba(11, 42, 46, 0.18);
}
.xray.is-open .xray-panel { display: flex; flex-direction: column; }
.xray-head { background: var(--deepest); color: var(--white); padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; }
.xray-head a { color: var(--white); font-size: 13px; }
.xray-body { overflow-y: auto; padding: 14px 16px 16px; font-size: 14px; line-height: 1.6; display: grid; gap: 14px; }
.xr-source { display: grid; gap: 2px; }
.xr-label { font-size: 12px; color: var(--muted); }
.xr-source strong { font-size: 16px; }
.xr-mono { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--deep); direction: ltr; text-align: right; }
.xr-list { display: grid; gap: 6px; }
.xr-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.xr-k { color: var(--ink-2); }
.xr-v { font-weight: 600; text-align: left; overflow-wrap: anywhere; color: var(--ink); }
.xr-v.is-ok { color: var(--deep); }
.xr-v.is-bad { color: var(--bad); }
.xr-empty { margin: 0; color: var(--muted); }
.xr-note { margin: 0; padding: 6px 10px; background: rgba(116, 216, 93, 0.18); border-radius: 8px; color: var(--ink); font-size: 13px; }
.xr-toggle { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; padding-top: 12px; border-top: 1px solid var(--border); }
.xr-toggle input { width: 18px; height: 18px; accent-color: var(--deep); }
.xr-btn { width: 100%; min-height: 38px; margin-top: 10px; border: 1px solid var(--outline); border-radius: 10px; background: var(--white); color: var(--ink-2); font: inherit; font-weight: 600; cursor: pointer; }
.xr-event { border-radius: 8px; background: var(--paper); padding: 7px 10px; }
.xr-event summary { cursor: pointer; display: flex; justify-content: space-between; gap: 12px; font-weight: 600; list-style: none; }
.xr-event summary::-webkit-details-marker { display: none; }
.xr-ev-name { font-family: 'IBM Plex Mono', monospace; font-size: 12px; font-weight: 400; color: var(--deep); direction: ltr; }
.xr-json { direction: ltr; text-align: left; background: var(--white); border-radius: 8px; padding: 8px; margin: 6px 0 0; font-family: 'IBM Plex Mono', monospace; font-size: 11px; line-height: 1.5; overflow-x: auto; max-height: 200px; }
.xr-more summary { cursor: pointer; font-size: 13px; color: var(--muted); font-weight: 600; }
.xr-more[open] summary { margin-bottom: 6px; }

/* على الشاشات الواسعة الصفحة بتوسّع مكان للوحة بدل ما اللوحة تغطي المحتوى */
@media (min-width: 1100px) {
  .xray-open main > .wrap, .xray-open main.wrap, .xray-open .site-head .wrap, .xray-open .site-foot .wrap { padding-left: 360px; max-width: 1460px; }
}

@media (max-width: 860px) {
  .product, .details, .checkout { grid-template-columns: 1fr; gap: 28px; }
  .details { margin-top: 40px; padding-top: 28px; }
  .summary { position: static; order: -1; }
  .nav { display: none; }
}
@media (max-width: 640px) {
  .cart-row { grid-template-columns: auto 1fr auto; row-gap: 14px; }
  .cart-row .qty { grid-column: 1 / 3; justify-self: start; }
  .cart-line { grid-column: 3; grid-row: 1; }
}
@media (max-width: 520px) {
  .two { grid-template-columns: 1fr; gap: 0; }
  .buy { grid-template-columns: 1fr; }
  .qty { justify-content: space-between; }
  .thumb { width: 64px; height: 64px; }
  main { padding-bottom: 96px; }
}
