/** Shopify CDN: Minification failed

Line 16:0 Unexpected "<"
Line 324:0 Unexpected "<"
Line 326:1 Expected identifier but found "%"
Line 327:0 Unexpected "{"
Line 327:1 Expected identifier but found "%"
Line 329:0 Unexpected "<"
Line 334:9 Expected identifier but found "%"
Line 335:10 Unexpected "<"
Line 341:9 Expected identifier but found "%"
Line 342:6 Unexpected "<"
... and 53 more hidden warnings

**/
<style>
  .dz-product-wrap{
    max-width: 1280px;
    margin: 40px auto;
    padding: 0 20px;
    direction: rtl;
  }

  .dz-product-grid{
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 40px;
    align-items: start;
  }

  .dz-gallery-main{
    background: #f7f7f7;
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid #ececec;
  }

  .dz-gallery-main img{
    width: 100%;
    display: block;
    object-fit: cover;
  }

  .dz-thumbs{
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-top: 14px;
  }

  .dz-thumb{
    border: 1px solid #e6e6e6;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    transition: 0.25s ease;
    padding: 0;
  }

  .dz-thumb:hover,
  .dz-thumb.active{
    border-color: #0f2747;
    transform: translateY(-2px);
  }

  .dz-thumb img{
    width: 100%;
    display: block;
    aspect-ratio: 1/1;
    object-fit: cover;
  }

  .dz-info{
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.04);
    position: sticky;
    top: 20px;
  }

  .dz-badge{
    display: inline-block;
    background: #0f2747;
    color: #fff;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    margin-bottom: 14px;
  }

  .dz-title{
    font-size: 34px;
    line-height: 1.2;
    margin: 0 0 10px;
    color: #111;
    font-weight: 800;
  }

  .dz-subtitle{
    color: #555;
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 18px;
  }

  .dz-price-row{
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    flex-wrap: wrap;
  }

  .dz-price{
    font-size: 30px;
    font-weight: 800;
    color: #111;
  }

  .dz-compare{
    font-size: 18px;
    color: #8b8b8b;
    text-decoration: line-through;
  }

  .dz-option-group{
    margin-bottom: 18px;
  }

  .dz-option-label{
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 700;
    color: #222;
  }

  .dz-swatch-list{
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .dz-swatch input{
    display: none;
  }

  .dz-swatch span{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    height: 44px;
    padding: 0 16px;
    border: 1px solid #dcdcdc;
    border-radius: 14px;
    cursor: pointer;
    background: #fff;
    color: #111;
    font-size: 14px;
    font-weight: 600;
    transition: 0.25s ease;
  }

  .dz-swatch input:checked + span{
    background: #0f2747;
    color: #fff;
    border-color: #0f2747;
  }

  .dz-qty-wrap{
    margin: 22px 0;
  }

  .dz-qty-box{
    width: 140px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #dcdcdc;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
  }

  .dz-qty-box button{
    width: 42px;
    height: 42px;
    border: none;
    background: #fff;
    cursor: pointer;
    font-size: 20px;
  }

  .dz-qty-box input{
    width: 56px;
    border: none;
    text-align: center;
    font-size: 16px;
    background: transparent;
  }

  .dz-add-btn{
    width: 100%;
    height: 56px;
    border: none;
    border-radius: 16px;
    background: #0f2747;
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.25s ease;
    box-shadow: 0 10px 24px rgba(15,39,71,0.18);
  }

  .dz-add-btn:hover{
    transform: translateY(-2px);
    opacity: 0.96;
  }

  .dz-trust{
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 18px 0 8px;
  }

  .dz-trust-item{
    padding: 12px 14px;
    border: 1px solid #ececec;
    border-radius: 14px;
    background: #fafafa;
    font-size: 14px;
    color: #222;
  }

  .dz-acc{
    margin-top: 22px;
    border-top: 1px solid #ededed;
    padding-top: 10px;
  }

  .dz-acc details{
    border-bottom: 1px solid #ededed;
    padding: 14px 0;
  }

  .dz-acc summary{
    cursor: pointer;
    font-weight: 700;
    color: #111;
    list-style: none;
  }

  .dz-acc summary::-webkit-details-marker{
    display: none;
  }

  .dz-acc-content{
    color: #555;
    line-height: 1.9;
    font-size: 14px;
    padding-top: 10px;
  }

  .dz-bundles{
    margin-top: 30px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }

  .dz-bundle{
    border: 1px solid #ececec;
    border-radius: 18px;
    padding: 18px;
    text-align: center;
    background: #fff;
  }

  .dz-bundle strong{
    display: block;
    font-size: 16px;
    margin-bottom: 6px;
    color: #111;
  }

  .dz-bundle span{
    display: block;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
  }

  .dz-whatsapp{
    margin-top: 20px;
    display: inline-block;
    text-decoration: none;
    color: #0f2747;
    font-weight: 700;
  }

  @media (max-width: 989px){
    .dz-product-grid{
      grid-template-columns: 1fr;
    }
    .dz-info{
      position: static;
    }
    .dz-title{
      font-size: 28px;
    }
    .dz-thumbs{
      grid-template-columns: repeat(4, 1fr);
    }
    .dz-bundles{
      grid-template-columns: 1fr;
    }
  }
</style>

{% assign current_variant = product.selected_or_first_available_variant %}
{% assign current_media = current_variant.featured_media | default: product.featured_media %}

<section class="dz-product-wrap">
  <div class="dz-product-grid">
    
    <div class="dz-gallery">
      <div class="dz-gallery-main">
        {% if current_media %}
          <img
            id="dzMainImage"
            src="{{ current_media | image_url: width: 1400 }}"
            alt="{{ product.title | escape }}"
            loading="eager"
          >
        {% endif %}
      </div>

      <div class="dz-thumbs">
        {% for media in product.media limit: 6 %}
          {% if media.media_type == 'image' %}
            <button
              class="dz-thumb{% if forloop.first %} active{% endif %}"
              type="button"
              data-image="{{ media | image_url: width: 1400 }}"
            >
              <img
                src="{{ media | image_url: width: 300 }}"
                alt="{{ product.title | escape }}"
                loading="lazy"
              >
            </button>
          {% endif %}
        {% endfor %}
      </div>
    </div>

    <div class="dz-info">
      <span class="dz-badge">الدفع عند الاستلام متوفر</span>

      <h1 class="dz-title">{{ product.title }}</h1>

      <div class="dz-subtitle">
        جينز رجالي أنيق ومريح للاستعمال اليومي، بخامة ممتازة ولمسة فخمة تناسب الخروج والعمل.
      </div>

      <div class="dz-price-row">
        <div class="dz-price" id="dzPrice">
          {{ current_variant.price | money_without_trailing_zeros }}
        </div>
        {% if current_variant.compare_at_price > current_variant.price %}
          <div class="dz-compare" id="dzCompare">
            {{ current_variant.compare_at_price | money_without_trailing_zeros }}
          </div>
        {% else %}
          <div class="dz-compare" id="dzCompare" style="display:none;"></div>
        {% endif %}
      </div>

      {% form 'product', product, id: 'dzProductForm' %}
        <input type="hidden" name="id" id="dzVariantId" value="{{ current_variant.id }}">

        {% for option in product.options_with_values %}
          {% assign option_index = forloop.index0 %}
          <div class="dz-option-group">
            <label class="dz-option-label">{{ option.name }}</label>
            <div class="dz-swatch-list" data-option-index="{{ option_index }}">
              {% for value in option.values %}
                <label class="dz-swatch">
                  <input
                    type="radio"
                    name="option-{{ option_index }}"
                    value="{{ value | escape }}"
                    {% if option.selected_value == value %}checked{% endif %}
                  >
                  <span>{{ value }}</span>
                </label>
              {% endfor %}
            </div>
          </div>
        {% endfor %}

        <div class="dz-qty-wrap">
          <label class="dz-option-label">الكمية</label>
          <div class="dz-qty-box">
            <button type="button" id="dzMinus">−</button>
            <input type="number" id="dzQty" name="quantity" min="1" value="1">
            <button type="button" id="dzPlus">+</button>
          </div>
        </div>

        <button
          type="submit"
          class="dz-add-btn"
          id="dzAddBtn"
          {% unless current_variant.available %}disabled{% endunless %}
        >
          {% if current_variant.available %}اطلب الآن{% else %}غير متوفر حالياً{% endif %}
        </button>
      {% endform %}

      <div class="dz-trust">
        <div class="dz-trust-item">الدفع عند الاستلام</div>
        <div class="dz-trust-item">توصيل سريع 1–2 يوم</div>
        <div class="dz-trust-item">تبديل المقاس خلال 7 أيام</div>
      </div>

      <div class="dz-acc">
        <details open>
          <summary>تفاصيل المنتج</summary>
          <div class="dz-acc-content">
            خامة مريحة، قصّة مرتبة، ولمسة أنيقة تناسب اللبس اليومي والخروج. مناسب للرجل الذي يبحث عن ستايل نظيف بدون مبالغة.
          </div>
        </details>

        <details>
          <summary>دليل المقاسات</summary>
          <div class="dz-acc-content">
            32: جسم نحيف<br>
            33: نحيف إلى متوسط<br>
            34: متوسط<br>
            36: متوسط إلى كبير<br>
            38: كبير<br>
            40: كبير ومريح<br><br>
            إذا كنت بين مقاسين، اختر المقاس الأكبر لراحة أكثر.
          </div>
        </details>

        <details>
          <summary>الشحن والتوصيل</summary>
          <div class="dz-acc-content">
            التوصيل متوفر إلى معظم الولايات داخل الجزائر. مدة التوصيل غالباً من 1 إلى 2 يوم حسب الولاية وشركة التوصيل.
          </div>
        </details>

        <details>
          <summary>التبديل والاسترجاع</summary>
          <div class="dz-acc-content">
            في حال وجود مشكلة في المقاس، نوفر تبديل المقاس خلال 7 أيام حسب التوفر.
          </div>
        </details>
      </div>

      <div class="dz-bundles">
        <div class="dz-bundle">
          <strong>قطعة واحدة</strong>
          <span>اختيار ممتاز إذا حاب تجرب الجودة أولاً</span>
        </div>
        <div class="dz-bundle">
          <strong>عرض قطعتين</strong>
          <span>أفضل قيمة لمن يريد أكثر من لون</span>
        </div>
        <div class="dz-bundle">
          <strong>عرض 3 قطع</strong>
          <span>أفضل سعر للطلبية الكبيرة</span>
        </div>
      </div>

      <a class="dz-whatsapp" href="https://wa.me/213000000000" target="_blank">
        تحتاج مساعدة في المقاس؟ تواصل معنا عبر واتساب
      </a>
    </div>
  </div>
</section>

<script>
  document.addEventListener('DOMContentLoaded', function () {
    const mainImage = document.getElementById('dzMainImage');
    const thumbs = document.querySelectorAll('.dz-thumb');

    thumbs.forEach(btn => {
      btn.addEventListener('click', function () {
        const image = this.getAttribute('data-image');
        if (mainImage && image) mainImage.src = image;
        thumbs.forEach(t => t.classList.remove('active'));
        this.classList.add('active');
      });
    });

    const qtyInput = document.getElementById('dzQty');
    const minusBtn = document.getElementById('dzMinus');
    const plusBtn = document.getElementById('dzPlus');

    if (minusBtn && plusBtn && qtyInput) {
      minusBtn.addEventListener('click', function () {
        const current = parseInt(qtyInput.value || '1', 10);
        qtyInput.value = Math.max(1, current - 1);
      });

      plusBtn.addEventListener('click', function () {
        const current = parseInt(qtyInput.value || '1', 10);
        qtyInput.value = current + 1;
      });
    }

    const variants = [
      {% for v in product.variants %}
        {
          id: {{ v.id }},
          available: {{ v.available | json }},
          options: {{ v.options | json }},
          price: {{ v.price | money_without_trailing_zeros | json }},
          compare_at_price: {{ v.compare_at_price | money_without_trailing_zeros | json }},
          image: {{ v.featured_media | image_url: width: 1400 | json }}
        }{% unless forloop.last %},{% endunless %}
      {% endfor %}
    ];

    const optionGroups = document.querySelectorAll('[data-option-index]');
    const variantIdInput = document.getElementById('dzVariantId');
    const priceBox = document.getElementById('dzPrice');
    const compareBox = document.getElementById('dzCompare');
    const addBtn = document.getElementById('dzAddBtn');

    function getSelectedOptions() {
      const values = [];
      optionGroups.forEach(group => {
        const checked = group.querySelector('input[type="radio"]:checked');
        if (checked) values.push(checked.value);
      });
      return values;
    }

    function updateVariant() {
      const selected = getSelectedOptions();
      const matched = variants.find(v => JSON.stringify(v.options) === JSON.stringify(selected));

      if (!matched) return;

      if (variantIdInput) variantIdInput.value = matched.id;
      if (priceBox) priceBox.textContent = matched.price;

      if (compareBox) {
        if (matched.compare_at_price && matched.compare_at_price !== matched.price) {
          compareBox.style.display = 'block';
          compareBox.textContent = matched.compare_at_price;
        } else {
          compareBox.style.display = 'none';
        }
      }

      if (addBtn) {
        addBtn.disabled = !matched.available;
        addBtn.textContent = matched.available ? 'اطلب الآن' : 'غير متوفر حالياً';
      }

      if (matched.image && mainImage) {
        mainImage.src = matched.image;
      }
    }

    document.querySelectorAll('.dz-swatch input').forEach(input => {
      input.addEventListener('change', updateVariant);
    });

    updateVariant();
  });
</script>