/* ===== KHOUT3D v17: CSS كامل لقالب أنجز ===== */

/* ألوان الهوية: مصدر واحد (نفس قيم الجافاسكربت) */
:root{
  --kx-ink:#1b1430;
  --kx-ink-2:#2e2250;
  --kx-primary:#5b3cc4;
  --kx-primary-dark:#4a2fa3;
  --kx-tint:#ece4fb;
  --kx-line:#ddd2ee;
  --kx-muted:#5a4b6e;
  --kx-bg:#faf6ee;
  --kx-accent:#ff7a1a;
  --kx-accent-2:#ffb066;
  --kx-accent-text:#c2410c; /* برتقالي غامق للنصوص على الخلفيات الفاتحة (تباين 5.2) */
}

:root, html body, body.theme-anjiz{
  --color-primary:var(--kx-primary) !important;
  --color-primary-dark:var(--kx-primary-dark) !important;
  --color-primary-light:var(--kx-tint) !important;
  --color-primary-reverse:#ffffff !important;
}
body{background-color:var(--kx-bg);}

/* ===== شاشة التحميل (CSS فقط): تظهر من أول رسم قبل أي إعادة ترتيب، فلا وميض =====
   الجافاسكربت يضيف kx-ready على html لما تجهز الواجهة. وإذا تعطل الجافاسكربت تختفي وحدها بعد 6 ثواني. */
body.is-home::before{
  content:"";position:fixed;top:0;right:0;bottom:0;left:0;z-index:100000;
  background:linear-gradient(160deg,var(--kx-bg),var(--kx-tint));
  opacity:1;visibility:visible;
  transition:opacity .35s ease,visibility .35s ease;
  animation:kx-auto .01s linear 6s forwards;
}
body.is-home::after{
  content:"";position:fixed;top:50%;left:50%;z-index:100001;
  width:46px;height:46px;margin:-23px 0 0 -23px;box-sizing:border-box;
  border:4px solid var(--kx-line);border-top-color:var(--kx-primary);border-radius:50%;
  opacity:1;visibility:visible;
  transition:opacity .35s ease,visibility .35s ease;
  animation:kx-spin .9s linear infinite,kx-auto .01s linear 6s forwards;
}
html.kx-ready body.is-home::before,
html.kx-ready body.is-home::after{opacity:0;visibility:hidden;pointer-events:none;}
@keyframes kx-spin{to{transform:rotate(360deg);}}
@keyframes kx-auto{to{opacity:0;visibility:hidden;}}
@media(prefers-reduced-motion:reduce){
  body.is-home::before,body.is-home::after{transition:none;}
  body.is-home::after{animation:kx-auto .01s linear 6s forwards;}
}

/* حجز مساحة شريط التصنيفات (جوال/تابلت) حتى لا تنزلق الصفحة لما يظهر. ينتهي لما يضيف الجافاسكربت kx-cb */
@media(max-width:991px){
  html:not(.kx-cb) .anjiz-header{margin-bottom:60px;animation:kx-unreserve .01s linear 4s forwards;}
}
@keyframes kx-unreserve{to{margin-bottom:0;}}
::selection{background:var(--kx-tint);color:var(--kx-ink);}

/* الهيدر: بنفسجي فاتح */
.anjiz-header,
.store-header,
.main-nav-container{
  background:var(--kx-tint) !important;
  box-shadow:0 1px 0 #cfc2ee;
  position:sticky; top:0; z-index:60;
}
.anjiz-header a,
.anjiz-header button,
.anjiz-header i,
.anjiz-header svg,
.store-header a,
.store-header svg{color:var(--kx-ink) !important;}
.anjiz-header img,
.store-header img{filter:none !important;opacity:1 !important;}
.anjiz-header a:hover,
.store-header a:hover{color:var(--kx-primary) !important;}

/* الهيرو + إصلاح التداخل مع البانر */
body.theme-anjiz .anjiz-hero{
  margin-top:0 !important;
  position:relative;
  z-index:1;
  min-height:0 !important;
  height:auto !important;
  padding-top:24px !important;
  padding-bottom:28px !important;
}
body.theme-anjiz .anjiz-hero__grid{
  min-height:0 !important;
  height:auto !important;
  padding-top:0 !important;
  align-items:flex-start !important;
}
.anjiz-hero__media:empty,
.anjiz-hero__art:empty,
.anjiz-hero__visual:empty,
.anjiz-hero__image:empty{display:none !important;}
.kp-banner,
.kc-strip{position:relative;z-index:2;}

/* أزرار الهيرو */
.k-actions{display:flex;flex-wrap:wrap;gap:10px;justify-content:center;}
.k-button{
  display:inline-flex;align-items:center;justify-content:center;
  min-height:46px;padding:0 22px;border-radius:10px;
  font-weight:700;text-decoration:none;
  background:var(--kx-accent);color:var(--kx-ink);border:2px solid var(--kx-accent);
  transition:background-color .2s ease,border-color .2s ease,color .2s ease;
}
.k-button:hover{background:var(--kx-accent-2);border-color:var(--kx-accent-2);}
.k-button.secondary{
  background:transparent;color:#fff;
  border-color:rgba(255,255,255,.75);
}
.k-button.secondary:hover{background:#fff;color:var(--kx-primary);border-color:#fff;}
@media(prefers-reduced-motion:reduce){.k-button{transition:none;}}

/* الأزرار */
.btn--primary,
.s-button-primary,
.s-button-solid.s-button-primary,
salla-add-product-button button,
.s-add-product-button-main button{
  background-color:var(--kx-primary) !important;
  border-color:var(--kx-primary) !important;
  color:#fff !important;
}
.btn--primary:hover,
.s-button-primary:hover,
salla-add-product-button button:hover{
  background-color:var(--kx-primary-dark) !important;
  border-color:var(--kx-primary-dark) !important;
}
/* حالة التعطيل (نفدت الكمية / لم يُختر خيار) تبقى واضحة */
.btn--primary[disabled],
.s-button-primary[disabled],
salla-add-product-button button[disabled],
.s-add-product-button-main button[disabled]{
  background-color:#b9aec9 !important;
  border-color:#b9aec9 !important;
  cursor:not-allowed;
}
.s-button-outline,
.btn--outline{
  border-color:var(--kx-primary) !important;
  color:var(--kx-primary) !important;
}
.s-button-outline:hover,
.btn--outline:hover{
  background-color:var(--kx-primary) !important;
  color:#fff !important;
}

/* مسار التنقل */
.breadcrumbs a,
.s-breadcrumb a,
.breadcrumb a,
nav[aria-label*="breadcrumb" i] a{color:var(--kx-primary) !important;}

/* القوائم المنسدلة */
.anjiz-header .sub-menu a:hover,
.anjiz-header .sub-menu li:hover > a,
.anjiz-header .dropdown-menu a:hover,
.anjiz-header .mega-menu a:hover,
.anjiz-header ul ul li:hover > a,
.anjiz-header ul ul a:hover{
  background-color:var(--kx-tint) !important;
  color:var(--kx-primary) !important;
}

/* الأسعار والشارات (النص بالبرتقالي الغامق لقراءة أوضح) */
.s-product-card-sale-price h4,
.s-product-card-sale-price span{color:var(--kx-accent-text);}
.s-product-card-promotion-title,
.s-product-card-badge{
  background-color:var(--kx-accent) !important;
  color:var(--kx-ink) !important;
}
/* وسوم صفحة المنتج (بدون المساس بعناوين حقول الخيارات والنماذج) */
body.product-single main a[class*="tag"],
body.product-single main span[class*="tag"],
body.product-single main a[class*="badge"],
body.product-single main span[class*="badge"],
body.product-single main a[class*="label"]:not([class*="form"]):not([class*="option"]):not([class*="input"]),
body.product-single main span[class*="label"]:not([class*="form"]):not([class*="option"]):not([class*="input"]){
  background-color:var(--kx-tint) !important;
  color:var(--kx-primary) !important;
  border-color:var(--kx-primary) !important;
}

/* صور المنتجات: مربعة بحجم موحّد في كل أنواع البطاقات.
   القاعدة تعتمد على وسم الصورة نفسه بدل أسماء كلاسات القالب، فلا تفوّت بطاقات القالب المخصصة.
   للتحكم بالتبديل: --kx-img-fit:contain (الصورة كاملة بدون قص) أو cover (تملأ المربع وتقص الأطراف).
   --kx-img-pad هو الهامش حول الصورة، بنسبة من عرض البطاقة فيبقى متناسقاً في الجوال والكمبيوتر. */
:root{--kx-img-fit:contain;--kx-img-pad:4%;}
:is(.s-product-card-entry,.s-product-card-vertical,.product-entry,custom-salla-product-card) :is([class*="image"],[class*="img"],[class*="media"],[class*="thumb"],[class*="photo"]):not(img):not(svg):not(i):not(button){
  height:auto !important;
  max-height:none !important;
  aspect-ratio:1 / 1 !important;
  overflow:hidden !important;
  background:#fff !important;
}
:is(.s-product-card-entry,.s-product-card-vertical,.product-entry,custom-salla-product-card) img:not([class*="icon"]):not([class*="logo"]):not([class*="badge"]):not([class*="flag"]){
  display:block !important;
  width:100% !important;
  height:100% !important;
  aspect-ratio:1 / 1 !important;
  object-fit:var(--kx-img-fit) !important;
  object-position:center !important;
  padding:var(--kx-img-pad) !important;
  box-sizing:border-box !important;
  background:#fff !important;
}

/* هامش جانبي للأقسام */
.kx-sec{box-sizing:border-box;padding-inline:8px !important;}

/* شرائط التنبيه: الأخطاء والتحذيرات وشريط الإعلان فقط
   (رسائل النجاح والمعلومات تبقى بألوانها حتى لا يضيع معناها، وأخطاء النماذج تبقى حمراء) */
.s-alert-danger:not(form *),
.s-alert-error:not(form *),
.s-alert-warning:not(form *),
.alert-danger:not(form *),
[class*="announcement"],
[class*="top-alert"]{
  background-color:var(--kx-ink-2) !important;
  color:#fff !important;
  border:0 !important;
  border-bottom:3px solid var(--kx-accent) !important;
}
.s-alert-danger:not(form *) *,
.s-alert-error:not(form *) *,
.s-alert-warning:not(form *) *,
.alert-danger:not(form *) *,
[class*="announcement"] *,
[class*="top-alert"] *{color:#fff !important;}

/* التركيز */
input:focus,
textarea:focus,
select:focus{
  border-color:var(--kx-primary) !important;
  box-shadow:0 0 0 3px rgba(91,60,196,.18) !important;
}
/* مؤشر التركيز بالكيبورد: بنفسجي على الخلفيات الفاتحة (تباين 5.9+)، وبرتقالي فاتح على الداكنة */
a:focus-visible,
button:focus-visible{
  outline:3px solid var(--kx-primary);
  outline-offset:2px;
}
footer :is(a,button):focus-visible,
.store-footer :is(a,button):focus-visible,
.anjiz-footer :is(a,button):focus-visible,
#kx-catbar :is(a,button):focus-visible,
.kc-strip:focus-visible{
  outline-color:var(--kx-accent-2);
}

/* الفوتر */
footer,
.store-footer,
.anjiz-footer{
  background:linear-gradient(180deg,var(--kx-primary) 0%,var(--kx-ink-2) 45%,var(--kx-ink) 100%) !important;
  border-top:3px solid var(--kx-accent);
}
footer :is(p,li,span,small,address,strong,b,label,h1,h2,h3,h4,h5,h6),
.store-footer :is(p,li,span,small,address,strong,b,label,h1,h2,h3,h4,h5,h6),
.anjiz-footer :is(p,li,span,small,address,strong,b,label,h1,h2,h3,h4,h5,h6){
  color:#f4eefb !important;
}
footer a,
.store-footer a,
.anjiz-footer a{
  color:#fff !important;
  text-decoration:none;
  opacity:1 !important;
}
footer a:hover,
.store-footer a:hover,
.anjiz-footer a:hover{
  color:var(--kx-accent-2) !important;
  text-decoration:underline;
}
footer svg,
.store-footer svg,
.anjiz-footer svg{color:#fff;}

/* فئات الصفحة الرئيسية */
.anjiz-cats__tile:hover{
  border-color:var(--kx-primary);
  background-color:var(--kx-tint);
}
.anjiz-cats__icon{color:var(--kx-primary);}