/* صفحة المنتج + المفضلة والمقارنة + النجوم */
.stars { position: relative; display: inline-block; font-size: 16px; line-height: 1; letter-spacing: 2px; color: #d6dbe1; white-space: nowrap; vertical-align: middle; }
.stars::before { content: "★★★★★"; }
.stars > i { position: absolute; inset-block: 0; inset-inline-start: 0; width: var(--p); overflow: hidden; color: #f59e0b; }
.stars > i::before { content: "★★★★★"; }
.prate { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.prate .stars { font-size: 13px; letter-spacing: 1px; }
.pprice small { font-size: 12px; font-weight: 600; color: var(--muted); }
.muted { color: var(--muted); }

.pp-wrap { padding-block: 8px 30px; }
.pp-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 36px; align-items: start; }

/* المعرض */
.pp-main { position: relative; display: block; width: 100%; aspect-ratio: var(--img-ar); border-radius: var(--img-r); overflow: hidden; background: #eee; cursor: zoom-in; padding: 0; }
.pp-main img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.pp-main:hover img { transform: scale(1.04); }
.pp-main .pb { position: absolute; top: 14px; inset-inline-start: 14px; }
.pp-zoom { position: absolute; bottom: 12px; inset-inline-end: 12px; display: inline-flex; align-items: center; gap: 6px; background: rgba(16,24,32,.72); color: #fff; font-size: 12px; padding: 5px 12px; border-radius: 999px; }
.pp-thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.pp-thumbs button { width: 78px; aspect-ratio: var(--img-ar); border-radius: calc(var(--img-r) / 1.6); overflow: hidden; border: 2px solid transparent; padding: 0; background: #eee; opacity: .75; transition: .15s; }
.pp-thumbs button.on, .pp-thumbs button:hover { border-color: var(--primary); opacity: 1; }
.pp-thumbs img { width: 100%; height: 100%; object-fit: cover; }

/* المعلومات */
.pp-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pp-brand { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--primary-ink, var(--primary)); }
.pp-brand:hover { text-decoration: underline; }
.vb { color: #2563eb; display: inline-flex; }
.pp-icons { display: flex; gap: 8px; }
.pp-icons button { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--line); display: grid; place-items: center; color: var(--muted); transition: .15s; }
.pp-icons button:hover { color: var(--primary-ink, var(--primary)); border-color: var(--primary); }
.pp-icons button.on { color: #e11d48; border-color: #e11d48; background: #fff1f3; }
.pp-icons button.on svg { fill: currentColor; }
.pp-info h1 { font-size: 28px; line-height: 1.3; margin: 8px 0 8px; }
.pp-rate { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 10px; }
.pp-rate span { color: var(--muted); }
.pp-rate:hover span { text-decoration: underline; }
.pp-price { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.pp-price b { font-size: 34px; font-weight: 800; color: var(--primary-ink, var(--primary)); }
.pp-price s { color: var(--muted); font-size: 18px; }
.save { background: #dcfce7; color: var(--ok); font-weight: 800; font-size: 13px; padding: 3px 12px; border-radius: 999px; }
.pp-tax { color: var(--muted); font-size: 13px; margin-top: 2px; }
.pp-avail { margin: 10px 0 14px; }
.pst.ok { color: var(--ok); font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
.pst { font-size: 14px; }

/* الخيارات */
.opts { margin-bottom: 14px; display: flex; flex-direction: column; gap: 14px; }
.opt-h { margin-bottom: 8px; font-size: 15px; }
.opt-h span { color: var(--muted); }
.opt-v { display: flex; flex-wrap: wrap; gap: 8px; }
.ob { min-width: 54px; padding: 9px 16px; border-radius: var(--btn-r); border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; transition: .15s; }
.ob:hover { border-color: var(--primary); }
.ob.on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); color: var(--primary-ink, var(--primary)); box-shadow: 0 0 0 1px var(--primary); }
.ob.out { color: var(--muted); text-decoration: line-through; background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(0,0,0,.04) 6px 12px); }
.sw { width: 38px; height: 38px; border-radius: 50%; background: var(--c); border: 3px solid var(--surface); box-shadow: 0 0 0 1.5px var(--line); transition: .15s; position: relative; }
.sw:hover { box-shadow: 0 0 0 2px var(--primary); }
.sw.on { box-shadow: 0 0 0 2.5px var(--primary); }
.sw.out::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: linear-gradient(135deg, transparent 46%, #b91c1c 47% 53%, transparent 54%); }
.sw.out { opacity: .55; }
.opt-warn { color: var(--danger); font-size: 14px; font-weight: 700; }

/* الشراء */
.buybox { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.qrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: var(--btn-r); overflow: hidden; background: var(--surface); }
.qty button { width: 40px; height: 40px; font-size: 20px; }
.qty button:disabled { opacity: .3; cursor: not-allowed; }
.qty button:hover:not(:disabled) { background: var(--bg); }
.qty b { min-width: 38px; text-align: center; }
.qnote { color: #c2410c; font-size: 13px; font-weight: 700; }
.tot { margin: 12px 0; }
.tot b { font-size: 24px; color: var(--primary-ink, var(--primary)); }
.brow { display: flex; gap: 10px; }
.brow .btn { flex: 1; }
.btn.big { padding: 14px 18px; font-size: 16px; }
.outbox { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; border-radius: var(--r); padding: 14px 16px; font-weight: 700; }
.outbox.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.outbox a { color: var(--primary-ink, var(--primary)); text-decoration: underline; cursor: pointer; }
.notify { margin-top: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.notify h4 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 15px; }
.nf-row { display: flex; gap: 8px; }
.nf-row input { flex: 1; min-width: 0; border: 1.5px solid var(--line); border-radius: var(--btn-r); padding: 10px 12px; background: var(--bg); color: var(--text); }
.nf-ok { color: var(--ok); font-size: 14px; margin-top: 8px; display: flex; gap: 6px; align-items: center; font-weight: 700; }
.nf-err { color: var(--danger); font-size: 14px; margin-top: 8px; }
.trust { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 16px; font-size: 13px; color: var(--muted); }
.trust li { display: inline-flex; align-items: center; gap: 6px; }
.trust .ic { color: var(--primary-ink, var(--primary)); }
.pp-pay { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pp-pay i { font-style: normal; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: 12px; }

/* التبويبات */
.pp-tabs { margin-top: 34px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.tabsbar { display: flex; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabsbar button { padding: 14px 24px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabsbar button:hover { color: var(--text); }
.tabsbar button.on { color: var(--primary-ink, var(--primary)); border-color: var(--primary); }
.tabbody { padding: 22px; }
.tabbody .desc { line-height: 2; white-space: pre-line; max-width: 80ch; }
.spec-t { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; max-width: 720px; }
.spec-t div { display: flex; justify-content: space-between; gap: 16px; padding: 11px 16px; }
.spec-t div:nth-child(odd) { background: var(--bg); }
.spec-t span { color: var(--muted); }
.pol { display: flex; flex-direction: column; gap: 18px; max-width: 760px; }
.pol li { display: flex; gap: 14px; align-items: flex-start; }
.pol .ic { color: var(--primary-ink, var(--primary)); margin-top: 3px; }
.pol p { color: var(--muted); margin-top: 2px; }

/* التقييمات */
.rv-top { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 18px; }
.rv-sum { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.rv-avg { text-align: center; }
.rv-avg b { display: block; font-size: 46px; line-height: 1; font-weight: 800; }
.rv-avg small { display: block; color: var(--muted); margin-top: 4px; }
.rv-dist { min-width: 240px; display: flex; flex-direction: column; gap: 5px; }
.rv-bar { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.rv-bar span { width: 32px; color: var(--muted); }
.rv-bar i { flex: 1; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.rv-bar u { display: block; height: 100%; background: #f59e0b; border-radius: 4px; }
.rv-bar em { width: 22px; font-style: normal; color: var(--muted); text-align: end; }
.rv-none p { font-weight: 700; }
.rv-thanks { background: #dcfce7; color: var(--ok); border-radius: var(--r); padding: 12px 16px; font-weight: 700; display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.rv-form { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 18px; display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.rv-form label > span, .rv-st > span { display: block; font-weight: 700; margin-bottom: 6px; font-size: 14px; }
.rv-form input[type=text], .rv-form input:not([type]), .rv-form textarea { width: 100%; border: 1.5px solid var(--line); border-radius: var(--btn-r); padding: 10px 12px; background: var(--surface); color: var(--text); resize: vertical; }
.star-in { display: inline-flex; gap: 4px; direction: ltr; }
[dir=rtl] .star-in { direction: rtl; }
.star-in button { font-size: 32px; line-height: 1; color: #d6dbe1; transition: transform .1s; }
.star-in button.on { color: #f59e0b; }
.star-in button:hover { transform: scale(1.15); }
.rv-ph { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ph { position: relative; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph button { position: absolute; top: 3px; inset-inline-end: 3px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; display: grid; place-items: center; }
.rv-list { display: flex; flex-direction: column; }
.rv { padding-block: 18px; border-top: 1px solid var(--line); }
.rv:first-child { border-top: 0; }
.rv-h { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.rv-h > .stars { margin-inline-start: auto; }
.rv-h small { display: block; color: var(--muted); font-size: 12px; }
.av { width: 40px; height: 40px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 800; flex: none; }
.rv p { line-height: 1.8; white-space: pre-line; }
.rv-imgs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.rv-imgs button { width: 84px; height: 84px; border-radius: 10px; overflow: hidden; padding: 0; }
.rv-imgs img { width: 100%; height: 100%; object-fit: cover; }
.rv-reply { margin-top: 12px; margin-inline-start: 24px; background: color-mix(in srgb, var(--primary) 8%, var(--surface)); border-inline-start: 3px solid var(--primary); border-radius: 10px; padding: 10px 14px; }
.rv-reply b { color: var(--primary-ink, var(--primary)); display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
.rv-reply p { margin-top: 2px; font-size: 14px; }

/* الأقسام السفلية */
.pp-sec { margin-top: 10px; }
.pp-sec .sh { display: flex; margin: 30px 0 14px; }
.pp-sec .sh h2 { font-size: 22px; font-weight: 800; }
.alts-out { background: color-mix(in srgb, var(--primary) 6%, var(--bg)); border: 2px dashed color-mix(in srgb, var(--primary) 40%, transparent); border-radius: var(--r); padding: 4px 16px 18px; margin-top: 24px; }
.bundle { display: flex; align-items: center; gap: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; flex-wrap: wrap; }
.bl { display: flex; align-items: center; gap: 10px; flex: 1; flex-wrap: wrap; }
.bi { position: relative; width: 132px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; cursor: pointer; border: 2px solid var(--line); border-radius: var(--r); padding: 8px; background: var(--bg); }
.bi.on { border-color: var(--primary); background: var(--surface); }
.bi.fixed { cursor: default; }
.bi input { position: absolute; top: 12px; inset-inline-start: 12px; width: 18px; height: 18px; accent-color: var(--primary); z-index: 2; }
.bi img { aspect-ratio: var(--img-ar); width: 100%; object-fit: cover; border-radius: calc(var(--img-r) / 2); }
.bi b { font-weight: 600; line-height: 1.3; }
.bi small { color: var(--muted); }
.bi span { color: var(--primary-ink, var(--primary)); font-weight: 800; }
.plus { font-size: 22px; color: var(--muted); font-weight: 700; }
.bs { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 190px; }
.bs .price { font-size: 24px; font-weight: 800; color: var(--primary-ink, var(--primary)); }

/* شريط الشراء الثابت */
.stickybuy { position: fixed; inset-inline: 0; bottom: 0; z-index: 70; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(0,0,0,.1); transform: translateY(110%); transition: transform .25s; }
.stickybuy.show { transform: none; }
.sb-in { display: flex; align-items: center; gap: 14px; padding-block: 10px; }
.sb-in img { width: 48px; height: 48px; border-radius: calc(var(--img-r) / 2); object-fit: cover; }
.sb-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sb-t b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-t small { color: var(--muted); }
.sb-p { font-weight: 800; color: var(--primary-ink, var(--primary)); font-size: 18px; white-space: nowrap; }

/* لوحة أُضيف للعربة */
.cpanel { position: fixed; top: 0; inset-inline: 0; z-index: 130; background: var(--surface); box-shadow: 0 14px 40px rgba(0,0,0,.25); padding: 16px 20px 18px; animation: cp-in .3s ease; max-width: 760px; margin-inline: auto; border-radius: 0 0 var(--r) var(--r); }
@keyframes cp-in { from { transform: translateY(-100%); } to { transform: none; } }
.cpanel h3 { display: flex; align-items: center; gap: 8px; color: var(--ok); margin-bottom: 12px; }
.cp-x { position: absolute; top: 12px; inset-inline-end: 14px; color: var(--muted); }
.cp-body { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.cp-body img { width: 64px; height: 64px; border-radius: calc(var(--img-r) / 2); object-fit: cover; }
.cp-i { flex: 1; min-width: 160px; }
.cp-v { color: var(--muted); font-size: 14px; }
.cp-act { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.cp-n { font-size: 13px; color: var(--muted); }

/* المعرض المكبّر */
.lb { position: fixed; inset: 0; z-index: 200; background: rgba(8,12,18,.92); display: grid; place-items: center; }
.lb img { max-width: min(92vw, 860px); max-height: 86vh; border-radius: var(--img-r); background: #fff; }
.lb-x { position: absolute; top: 18px; inset-inline-end: 22px; color: #fff; }
.lb-n { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.18); color: #fff; display: grid; place-items: center; }
.lb-n:hover { background: rgba(255,255,255,.3); }
.lb-prev { inset-inline-start: 22px; }
.lb-next { inset-inline-end: 22px; }
[dir=ltr] .lb-prev .ic { transform: rotate(90deg); } [dir=ltr] .lb-next .ic { transform: rotate(-90deg); }
[dir=rtl] .lb-prev .ic { transform: rotate(-90deg); } [dir=rtl] .lb-next .ic { transform: rotate(90deg); }
.lb-c { position: absolute; bottom: 20px; color: #fff; font-size: 14px; }

/* المفضلة والمقارنة */
.lpage { padding-block: 6px 20px; }
.cmp-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.cmp { border-collapse: collapse; width: 100%; min-width: 640px; }
.cmp th, .cmp td { padding: 14px 16px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; font-size: 14px; }
.cmp th { background: var(--bg); width: 150px; color: var(--muted); font-weight: 700; position: sticky; inset-inline-start: 0; z-index: 1; }
.cmp tr:last-child th, .cmp tr:last-child td { border-bottom: 0; }
.cmp-h { position: relative; min-width: 190px; }
.cmp-h img { width: 120px; aspect-ratio: var(--img-ar); object-fit: cover; border-radius: calc(var(--img-r) / 1.5); margin-bottom: 8px; }
.cmp-h b { display: block; }
.cmp-x { position: absolute; top: 8px; inset-inline-end: 8px; width: 26px; height: 26px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; color: var(--muted); }
.cmp-x:hover { background: #fee2e2; color: var(--danger); }
.cmp-p { color: var(--primary-ink, var(--primary)); font-size: 18px; }
.cmp s { color: var(--muted); margin-inline-start: 6px; font-size: 12px; }

@media (max-width: 900px) {
  .pp-grid { grid-template-columns: 1fr; gap: 20px; }
  .pp-info h1 { font-size: 23px; }
  .pp-price b { font-size: 28px; }
  .brow { flex-direction: column; }
  .tabbody { padding: 16px; }
  .tabsbar button { padding: 12px 16px; }
  .rv-sum { gap: 16px; }
  .rv-dist { min-width: 0; flex: 1; }
  .sb-in img, .sb-t small { display: none; }
  .cpanel { border-radius: 0; }
  .cp-act { align-items: stretch; width: 100%; }
}
@media (max-width: 560px) {
  .pp-thumbs button { width: 64px; }
  .bi { width: 112px; }
  .lb-n { width: 42px; height: 42px; }
}

/* الدردشة ترتفع فوق شريط الشراء الثابت */
body:has(.stickybuy.show) .chat-fab { inset-block-end: 90px; }
body:has(.stickybuy.show) .chat-panel { inset-block-end: 160px; }

/* تقليل الفراغات: صفحة المنتج + صندوق الشراء */
.pp-grid { gap: 28px; }
.pp-info h1 { margin: 6px 0 4px; }
.pp-rate { margin-bottom: 6px; }
.pp-avail { margin: 6px 0 10px; }
.opts { margin-bottom: 10px; gap: 10px; }
.buybox { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.buybox .tot { margin: 0; }
.trust { margin-top: 10px; }
.pp-pay { margin-top: 8px; }
.pp-tabs { margin-top: 24px; }
.pp-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.pp-main { max-height: 560px; }
.pp-grid > :first-child { max-width: 560px; width: 100%; }
@media (max-width: 900px) {
  .pp-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .pp-grid > :first-child { max-width: none; }
  .pp-main { max-height: none; }
}

.opt-av { margin: 6px 0 0; font-size: 13px; color: var(--muted); } .opt-av b { color: var(--text); font-weight: 700; }
/* اللون المختار: حلقة واضحة + علامة ✓ */
.sw.on { box-shadow: 0 0 0 3px var(--primary), 0 4px 10px rgba(0,0,0,.2); transform: scale(1.1); }
.sw.on::before { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 18px; text-shadow: 0 0 3px rgba(0,0,0,.85), 0 0 1px #000; }
.sw.on { box-shadow: 0 0 0 2px #fff, 0 0 0 5px var(--text), 0 5px 12px rgba(0,0,0,.22); transform: scale(1.1); }
.ob.on { border-color: var(--text); box-shadow: 0 0 0 1px var(--text); background: color-mix(in srgb, var(--text) 8%, var(--surface)); color: var(--text); font-weight: 800; }

.nf-tip { margin: 8px 0 0; font-size: 13px; color: var(--muted); line-height: 1.7; background: color-mix(in srgb, var(--accent, #14b8a6) 9%, var(--surface)); border-radius: 10px; padding: 8px 12px; }
.nf-tip.ok { color: #166534; background: #f0fdf4; }
.nf-tip a { color: var(--text); font-weight: 700; text-decoration: underline; }
