/* ============================================================
   الصفحات الذكية — ستايلات رندر مكعبات اللوحة على الموقع
   ============================================================ */
.sp-page {
  background: var(--sp-bg, #ffffff);
  color: var(--sp-text, #1e293b);
  min-height: 60vh;
}

/* ---------- السلايدر العلوي ---------- */
.sp-hero-slider { position: relative; overflow: hidden; }
.sp-hero-track { display: flex; transition: transform .55s ease; }
.sp-hero-slide {
  position: relative; flex: 0 0 100%; width: 100%;
  height: 230px; background-size: cover; background-position: center;
  display: flex; align-items: flex-end;
}
@media (min-width: 768px) { .sp-hero-slide { height: 340px; } }
.sp-hero-bg { position: absolute; inset: 0; background-size: cover; background-position: center; }
.sp-hero-bg-m { display: none; }
@media (max-width: 767px) {
  .sp-hero-bg-m { display: block; }
  .sp-hero-bg-d { display: none; }
}
.sp-hero-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.6), transparent 70%); }
.sp-hero-content { position: relative; padding: 18px 16px 22px; color: #fff; width: 100%; }
.sp-hero-content h2 { font-size: 1.15rem; margin: 0 0 5px; text-shadow: 0 1px 4px rgba(0,0,0,.45); }
.sp-hero-content p { font-size: .8rem; margin: 0 0 10px; opacity: .92; }
.sp-hero-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.9); color: #1e293b; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.25); padding: 0;
}
.sp-hero-arrow.prev { right: 10px; }
.sp-hero-arrow.next { left: 10px; }
.sp-hero-arrow .material-icons-outlined { font-size: 20px; }
.sp-hero-dots { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; z-index: 3; }
.sp-hero-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.5); cursor: pointer; transition: .25s; }
.sp-hero-dot.active { width: 20px; border-radius: 5px; background: #fff; }

/* ---------- عناوين ---------- */
.sp-title-block { text-align: center; padding: 22px 16px 8px; }
.sp-title-block h2 { font-size: 1.2rem; margin: 0 0 5px; color: var(--sp-text, #1e293b); }
.sp-title-block p { font-size: .8rem; margin: 0; opacity: .75; }

/* ---------- الأزرار ---------- */
.sp-btn {
  display: inline-block; padding: 8px 20px; border-radius: 22px;
  background: var(--sp-primary, #6d28d9); color: #fff;
  font-size: .78rem; font-weight: 700; text-decoration: none;
}

/* ---------- المنتجات ---------- */
.sp-products { padding: 6px 0 4px; }
.sp-products-title { padding: 12px 14px 2px; }
.sp-products-title h3 { font-size: 1rem; margin: 0 0 2px; color: var(--sp-text, #1e293b); }
.sp-products-title p { font-size: .76rem; margin: 0; opacity: .7; }
.sp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 10px 14px 14px; }
@media (min-width: 768px) { .sp-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; } }
.sp-card {
  display: block; text-decoration: none; color: inherit;
  background: #fff; border: 1px solid #eef1f6; border-radius: 14px;
  overflow: hidden; box-shadow: 0 2px 8px rgba(15,23,42,.06);
}
.sp-card img { width: 100%; height: 130px; object-fit: cover; display: block; background: #f1f5f9; }
.sp-card-img-fallback { width: 100%; height: 130px; display: flex; align-items: center; justify-content: center; background: #f1f5f9; color: #cbd5e1; }
.sp-card-body { padding: 8px 10px 10px; }
.sp-card-name {
  font-size: .72rem; color: #475569; min-height: 2.15em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sp-card-price { font-size: .88rem; font-weight: 800; color: var(--sp-primary, #6d28d9); margin-top: 4px; }
.sp-old-price { font-size: .7rem; font-weight: 600; color: #94a3b8; text-decoration: line-through; margin-inline-end: 4px; }
.sp-sale-badge { display: inline-block; background: #ef4444; color: #fff; font-size: .62rem; font-weight: 700; padding: 1px 6px; border-radius: 5px; margin-inline-start: 4px; vertical-align: middle; }
.sp-scroll-row { display: flex; gap: 10px; overflow-x: auto; padding: 10px 14px 14px; scroll-snap-type: x mandatory; }
.sp-scroll-row .sp-card { min-width: 132px; width: 132px; flex-shrink: 0; scroll-snap-align: start; }
.sp-scroll-row::-webkit-scrollbar { display: none; }

/* ---------- إعلانات ---------- */
.sp-ad {
  position: relative; height: 170px; margin: 12px 14px; border-radius: 16px; overflow: hidden;
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
}
@media (min-width: 768px) { .sp-ad { height: 230px; } }
.sp-ad-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.sp-ad-content { position: relative; text-align: center; color: #fff; padding: 14px; max-width: 90%; }
.sp-ad-content h3 { font-size: 1.05rem; margin: 0 0 4px; }
.sp-ad-content p { font-size: .78rem; margin: 0 0 10px; opacity: .92; }

/* ---------- الجزء المميز (Showcase) ---------- */
.sp-showcase {
  position: relative; border-radius: 18px; margin: 12px 14px; overflow: hidden;
  min-height: 250px; background-size: cover; background-position: center;
  display: flex; align-items: flex-end;
}
.sp-showcase-overlay { position: absolute; inset: 0; }
.sp-showcase-content { position: relative; padding: 18px; width: 100%; color: #fff; z-index: 2; display: flex; flex-direction: column; align-items: center; text-align: center; }
.sp-showcase-title { font-size: 1.8rem; font-weight: 900; text-shadow: 0 2px 10px rgba(0,0,0,.5); line-height: 1.25; }
.sp-showcase-sub { font-size: .78rem; margin: 6px 0 0; opacity: .9; max-width: 90%; }
.sp-showcase-swatches { display: flex; margin-top: 12px; justify-content: center; }
.sp-swatch { width: 26px; height: 26px; border-radius: 8px; border: 2px solid rgba(255,255,255,.9); box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.sp-showcase-swatches .sp-swatch + .sp-swatch { margin-inline-start: -10px; }
.sp-showcase-btns { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; justify-content: center; }
.sp-showcase-products { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 220px)); justify-content: center; gap: 10px; width: 100%; margin: 14px 0 0; padding: 0 0 4px; }
.sp-showcase-products::-webkit-scrollbar { display: none; }
.sp-showcase-products .sp-card { min-width: 0; width: auto; }
@media (min-width: 768px) { .sp-showcase-products .sp-card img { height: 150px; } }
@media (max-width: 767px) {
  .sp-showcase-products { display: flex; overflow-x: auto; justify-content: center; scroll-snap-type: x mandatory; }
  .sp-showcase-products .sp-card { min-width: 132px; width: 132px; flex-shrink: 0; scroll-snap-align: start; }
}
.sp-showcase-products .sp-card img { height: 110px; }
.sp-showcase-products .sp-card-name { min-height: 1.9em; font-size: .68rem; }
.sp-smart-cats { display: flex; gap: 12px; overflow-x: auto; padding: 10px 14px 16px; scroll-snap-type: x mandatory; justify-content: center; }
.sp-smart-cats::-webkit-scrollbar { display: none; }
.sp-smart-cat-card {
  position: relative; flex-shrink: 0; scroll-snap-align: start;
  width: 150px; min-height: var(--sp-cat-h, 190px); border-radius: var(--sp-cat-radius, 16px); overflow: hidden;
  text-decoration: none; color: #fff; display: flex; flex-direction: column;
}
.sp-cats-grid {
  display: grid; overflow-x: visible; scroll-snap-type: none; justify-content: stretch;
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  gap: var(--sp-cat-gap, 12px); padding: 10px 14px 16px;
}
@media (min-width: 1024px) { .sp-cats-grid { padding: 12px 24px 22px; } }
.sp-cats-grid .sp-smart-cat-card { width: auto; }
.sp-cat-shadow .sp-smart-cat-card { box-shadow: 0 10px 26px rgba(15, 23, 42, .16); }
.sp-smart-cat-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(15,23,42,.2), rgba(15,23,42,.65)); pointer-events: none; }
.sp-pos-top .sp-smart-cat-content { margin-top: 0; margin-bottom: auto; }
.sp-pos-center .sp-smart-cat-content { margin-top: auto; margin-bottom: auto; }
.sp-cat-zoom .sp-smart-cat-media img { transition: transform .5s ease; }
@media (hover: hover) { .sp-cat-zoom .sp-smart-cat-card:hover .sp-smart-cat-media img { transform: scale(1.08); } }
.sp-cat-zoom .sp-smart-cat-card:active .sp-smart-cat-media img { transform: scale(1.06); }
.sp-products-sub { font-size: .78rem; color: #64748b; margin: 4px 14px 0; }
.sp-smart-cat-icon { position: absolute; top: 42px; left: 50%; transform: translateX(-50%); font-size: 42px; opacity: .9; }
.sp-smart-cat-media { position: absolute; inset: 0; }
.sp-smart-cat-media img { width: 100%; height: 100%; object-fit: cover; }
.sp-smart-cat-content { position: relative; margin-top: auto; padding: 14px; }
.sp-smart-cat-content h3 { font-size: .85rem; margin: 0 0 3px; }
.sp-smart-cat-content p { font-size: .68rem; margin: 0 0 8px; opacity: .85; }
.sp-smart-cat-btn { font-size: .66rem; font-weight: 700; display: inline-flex; align-items: center; gap: 2px; background: rgba(255,255,255,.16); padding: 4px 8px; border-radius: 10px; }
.sp-brands-row { display: flex; gap: 14px; overflow-x: auto; padding: 10px 14px 16px; scroll-snap-type: x mandatory; justify-content: space-around; }
.sp-brands-row::-webkit-scrollbar { display: none; }
.sp-brand-card {
  position: relative;
  flex-shrink: 0; scroll-snap-align: start;
  width: 116px; height: 116px;
  background: #fff; border: 1px solid rgba(15,23,42,.08); border-radius: 18px;
  box-shadow: 0 2px 10px rgba(15,23,42,.07);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.sp-brand-card:hover { transform: translateY(-3px); box-shadow: 0 8px 18px rgba(15,23,42,.13); }
.sp-brand-card .sp-brand-fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem; font-weight: 800;
  color: var(--sp-primary, #6d28d9); opacity: .3;
}
.sp-brand-card img {
  position: relative; z-index: 1;
  max-width: 100%; max-height: 100%;
  width: auto; height: auto; object-fit: contain;
}

/* ---------- كروت المنتجات (بنفس شكل الهوم) ---------- */
.sp-grid .noon-product-card { display: flex; flex-direction: column; }
.sp-scroll-row .noon-product-card {
  min-width: 175px; width: 175px; flex-shrink: 0; scroll-snap-align: start;
}
@media (min-width: 768px) {
  .sp-scroll-row .noon-product-card { min-width: 215px; width: 215px; }
}

/* ---------- كروت الأقسام المصورة ---------- */
.sp-cust-grid { display: grid; grid-template-columns: repeat(var(--mcols, 2), 1fr); gap: var(--cust-gap, 12px); padding: 12px 14px 16px; }
@media (min-width: 768px) { .sp-cust-grid { grid-template-columns: repeat(var(--cols, 3), 1fr); gap: var(--cust-gap, 16px); } }
@media (min-width: 1024px) {
  .sp-cust-grid {
    grid-template-columns: repeat(var(--cols, 3), minmax(0, 360px));
    justify-content: center; gap: var(--cust-gap, 18px); padding: 18px;
  }
}
.sp-cust-card {
  display: block; text-decoration: none; color: inherit;
  background: #fff; border: 1px solid rgba(15,23,42,.07);
  box-shadow: 0 2px 10px rgba(15,23,42,.08); overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.sp-cust-card:hover { transform: translateY(-4px); box-shadow: 0 12px 24px rgba(15,23,42,.16); }
.sp-cust-media { position: relative; width: 100%; overflow: hidden; background-size: cover; }
.sp-cust-media img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transition: transform .4s ease; display: block;
}
.sp-cust-card:hover .sp-cust-media img { transform: scale(1.07); }
.sp-cust-grid.no-zoom .sp-cust-media img, .sp-cust-grid.no-zoom .sp-cust-card:hover .sp-cust-media img { transform: none !important; }
.sp-cust-body { padding: 10px 12px 12px; text-align: center; }
.sp-cust-body h4 { margin: 0 0 4px; font-size: var(--cust-name, .9rem); color: var(--sp-text, #1e293b); }
.sp-cust-hint {
  font-size: .68rem; color: var(--sp-primary, #6d28d9); font-weight: 700;
  display: inline-flex; align-items: center; gap: 3px;
}
.sp-cust-hint .material-icons-outlined { font-size: 12px; }

/* البنر العلوي — سلايدر رفيع بعرض الصفحة */
.sp-cust-banner {
  position: relative; overflow: hidden; border-radius: 14px;
  background: var(--sp-surface, #f1f5f9); margin-bottom: 14px;
}
.sp-cust-banner.h-thin { height: 110px; }
.sp-cust-banner.h-normal { height: 150px; }
.sp-cust-banner.h-big { height: 200px; }
@media (min-width: 768px) {
  .sp-cust-banner.h-thin { height: 260px; }
  .sp-cust-banner.h-normal { height: 340px; }
  .sp-cust-banner.h-big { height: 430px; }
}
@media (max-width: 767px) {
  .sp-cust-banner.h-thin { height: 72px; }
  .sp-cust-banner.h-normal { height: 98px; }
  .sp-cust-banner.h-big { height: 132px; }
}
.sp-cust-bn-track { display: flex; height: 100%; transition: transform .45s ease; }
.sp-cust-bn-slide {
  flex: 0 0 100%; min-width: 100%; height: 100%;
  background-size: contain; background-position: center; background-repeat: no-repeat;
}
.sp-cust-bn-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 32px; height: 32px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.85); color: #1e293b;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.25); opacity: 0;
  transition: opacity .2s, background .2s;
}
.sp-cust-banner:hover .sp-cust-bn-arrow { opacity: 1; }
.sp-cust-bn-arrow:hover { background: #fff; }
.sp-cust-bn-arrow .material-icons-outlined { font-size: 18px; }
.sp-cust-bn-arrow.prev { right: 8px; }
.sp-cust-bn-arrow.next { left: 8px; }
.sp-cust-bn-dots {
  position: absolute; bottom: 7px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 5px; z-index: 3;
}
.sp-cust-bn-dot {
  width: 7px; height: 7px; border-radius: 5px; background: rgba(255,255,255,.55);
  cursor: pointer; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.35);
}
.sp-cust-bn-dot.active { background: #fff; width: 16px; }

/* صندوق الكروت الملوّن */
.sp-cust-box { overflow: hidden; box-shadow: 0 10px 26px rgba(15,23,42,.16); }
.sp-cust-box .sp-cust-grid { padding: 14px; }