/* Add custom CSS styles below */ /document.addEventListener("DOMContentLoaded", function () {

  var messages = [
    "توصيل مجاني لأي طلب فوق 249 ريال",
    "خصم 10% على جميع المنتجات",
    "قطع غيار أصلية لجميع الأجهزة",
    "شحن سريع لجميع مناطق المملكة",
    "جودة مضمونة على جميع المنتجات",
  ];

  var style = document.createElement("style");
  style.innerHTML = `
    @import url('https://fonts.googleapis.com/css2?family=Cairo:wght@500;600&display=swap');

    .sfx-ticker-bar {
      background-color: #0d1b4b !important;
      overflow: hidden !important;
      height: 40px !important;
      display: flex !important;
      align-items: center !important;
      width: 100% !important;
      position: relative !important;
      z-index: 99999 !important;
    }

    .sfx-ticker-track {
      display: inline-flex !important;
      align-items: center !important;
      white-space: nowrap !important;
      animation: sfx-marquee 40s linear infinite !important;
      font-family: 'Cairo', sans-serif !important;
      font-size: 13.5px !important;
      font-weight: 600 !important;
      color: #ffffff !important;
      direction: rtl !important;
    }

    .sfx-ticker-track .sfx-item {
      display: inline-flex !important;
      align-items: center !important;
      gap: 10px !important;
      padding: 0 28px !important;
    }

    .sfx-ticker-track .sfx-dot {
      width: 6px !important;
      height: 6px !important;
      background: #ffffff !important;
      border-radius: 50% !important;
      display: inline-block !important;
      opacity: 0.7 !important;
      flex-shrink: 0 !important;
    }

    @keyframes sfx-marquee {
      0%   { transform: translateX(0); }
      100% { transform: translateX(-50%); }
    }

    .sfx-wa-bar {
      background-color: #0d1b4b !important;
      direction: rtl !important;
      width: 100% !important;
      padding: 0 20px !important;
      height: 52px !important;
      display: flex !important;
      align-items: center !important;
      justify-content: space-between !important;
      border-top: 1px solid rgba(255,255,255,0.08) !important;
      z-index: 99999 !important;
      font-family: 'Cairo', sans-serif !important;
    }

    .sfx-wa-right {
      display: flex !important;
      align-items: center !important;
      gap: 10px !important;
    }

    .sfx-live-badge {
      background-color: #1565c0 !important;
      color: #fff !important;
      font-family: 'Cairo', sans-serif !important;
      font-size: 12px !important;
      font-weight: 700 !important;
      padding: 4px 12px !important;
      border-radius: 4px !important;
      white-space: nowrap !important;
    }

    .sfx-wa-msg {
      color: #e8edf8 !important;
      font-size: 13px !important;
      font-family: 'Cairo', sans-serif !important;
    }

    .sfx-wa-msg b { color: #fff !important; }

    .sfx-wa-btn {
      background-color: #25d366 !important;
      color: #fff !important;
      border-radius: 6px !important;
      padding: 7px 16px !important;
      font-family: 'Cairo', sans-serif !important;
      font-size: 13px !important;
      font-weight: 700 !important;
      text-decoration: none !important;
      display: flex !important;
      align-items: center !important;
      gap: 7px !important;
      white-space: nowrap !important;
    }

    .sfx-wa-btn:hover { background-color: #1ebe5d !important; }
    .sfx-wa-btn svg { width: 17px !important; height: 17px !important; }

    @media(max-width: 600px) {
      .sfx-wa-msg { display: none !important; }
    }
  `;
  document.head.appendChild(style);

  // ===== شريط النص المتحرك =====
  var tickerBar = document.createElement("div");
  tickerBar.className = "sfx-ticker-bar";

  var track = document.createElement("div");
  track.className = "sfx-ticker-track";

  // مضاعفة النصوص لضمان الاستمرارية
  var allMsgs = messages.concat(messages).concat(messages).concat(messages);
  allMsgs.forEach(function(msg) {
    var item = document.createElement("span");
    item.className = "sfx-item";

    var dot = document.createElement("span");
    dot.className = "sfx-dot";

    var text = document.createTextNode(msg);

    item.appendChild(dot);
    item.appendChild(document.createTextNode(" "));
    item.appendChild(document.createTextNode(msg));
    // إعادة بناء صحيحة
    item.innerHTML = '<span class="sfx-dot"></span> ' + msg;

    track.appendChild(item);
  });

  tickerBar.appendChild(track);

  // ===== شريط الواتساب =====
  var waBar = document.createElement("div");
  waBar.className = "sfx-wa-bar";
  waBar.innerHTML = `
    <div class="sfx-wa-right">
      <span class="sfx-live-badge">خدمة العملاء المباشرة</span>
      <span class="sfx-wa-msg"><b>عزيزي العميل</b> إذا لم تجد قطعة جهازك تواصل معنا واتساب وسيتم خدمتك بأسرع وقت</span>
    </div>
    <a href="https://wa.me/966509941827" target="_blank" class="sfx-wa-btn">
      <svg viewBox="0 0 24 24" fill="white" xmlns="http://www.w3.org/2000/svg">
        <path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z(function() {
  const style = document.createElement('style');
  style.innerHTML = `
    .shifex-badge {
      position: absolute;
      top: 10px;
      right: 10px;
      background-color: #1a6b3a;
      color: #ffffff;
      padding: 5px 10px;
      border-radius: 6px;
      font-size: 12px;
      font-weight: bold;
      z-index: 10;
      font-family: 'Cairo', sans-serif;
    }

    .product-item,
    .product-card,
    [class*="product"] {
      position: relative !important;
    }
  `;
  document.head.appendChild(style);

  function addBadges() {
    const products = document.querySelectorAll(
      '.product-item, .product-card, [class*="product-item"], [class*="product-card"]'
    );

    products.forEach(function(product) {
      if (!product.querySelector('.shifex-badge')) {
        const badge = document.createElement('div');
        badge.className = 'shifex-badge';
        badge.textContent = 'شيفكس ستور';
        product.appendChild(badge);
      }
    });
  }

  addBadges();

  // للصفحات التي تحمّل المنتجات بشكل ديناميكي
  const observer = new MutationObserver(addBadges);
  observer.observe(document.body, { childList: true, subtree: true });
})();
      </svg>
      تواصل معنا الآن
    </a>
  `;

  // إضافة الشريطين في أعلى الصفحة
  document.body.insertBefore(waBar, document.body.firstChild);
  document.body.insertBefore(tickerBar, document.body.firstChild);

});(function() {
  const style = document.createElement('style');
  style.innerHTML = `
    .shifex-shipping {
      display: flex;
      align-items: center;
      gap: 6px;
      background-color: #f0f0f0;
      border: 1px solid #ddd;
      border-radius: 8px;
      padding: 6px 10px;
      margin-top: 8px;
      font-size: 12px;
      font-weight: bold;
      color: #333;
      font-family: 'Cairo', sans-serif;
      direction: rtl;
    }
    .shifex-shipping span.icon {
      font-size: 16px;
    }
  `;
  document.head.appendChild(style);

  function addShipping() {
    const products = document.querySelectorAll(
      '.product-item, .product-card, [class*="product-item"], [class*="product-card"]'
    );

    products.forEach(function(product) {
      if (!product.querySelector('.shifex-shipping')) {
        const shipping = document.createElement('div');
        shipping.className = 'shifex-shipping';
        shipping.innerHTML = `<span class="icon">🚚</span> الشحن 12 ريال لجميع مناطق المملكة`;
        product.appendChild(shipping);
      }
    });
  }

  addShipping();

  const observer = new MutationObserver(addShipping);
  observer.observe(document.body, { childList: true, subtree: true });
})();