/* =========================================================================
   SABRI TEXTILDRUCK CONFIGURATOR - CORE CSS (Proportional Layout Fix)
   ========================================================================= */
/* استيراد الخطوط الـ 10 من جوجل مباشرة داخل ملف CSS */
@import url("https://fonts.googleapis.com/css2?family=Bangers&family=Bebas+Neue&family=Lobster&family=Montserrat:wght@900&family=Open+Sans:wght@800&family=Oswald:wght@700&family=Pacifico&family=Permanent+Marker&family=Playfair+Display:ital,wght@1,900&family=Righteous&display=swap");

/* باقي كود التنسيق الخاص بك يكمل هنا... */
/* الحاوية الرئيسية (Flexbox) */
.sabri-textil-configurator {
  display: flex;
  flex-wrap: wrap; /* للسماح للقسم الأيمن بالانزلاق في الجوال */
  gap: 30px; /* تضييق المسافة بين العمودين قليلاً لزيادة المساحة للـ Canvas */
  width: 100%;
  max-width: 1280px; /* زيادة العرض الأقصى قليلاً لإعطاء مساحة للـ Canvas الكبير */
  margin: 30px auto; /* التوسيط في منتصف الصفحة */
  font-family: inherit;
  box-sizing: border-box;
}
/* =========================================================================
   القسم الأيسر: المعاينة الثابتة والكبيرة (Dominant Sticky Preview)
   ق منا بتكبير هذا القسم ليأخذ حوالي 65% من العرض
   ========================================================================= */
.textil-sticky-preview-column {
  /* 🔴 التغيير الأساسي: 65% للمعاينة بدلاً من 50% */
  flex: 0 0 calc(60% - 15px); /* flex-grow:0, flex-shrink:0, base-width:65% */
  width: calc(60% - 15px);

  position: sticky; /* جعل العمود ثابتاً */
  top: 200px; /* مسافة من أعلى الصفحة (يجب مراعاة ارتفاع الـ Header لديك) */
  height: fit-content; /* مهم جداً لكي يعمل التثبيت بشكل صحيح */
  display: flex;
  flex-direction: column;
}

/* تنسيق حاوية الـ Canvas */
.canvas-container-wrapper {
  background-color: #f1f1f1;
  border: 1px solid #861e38;
  border-radius: 8px;
  padding: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* جعل الـ Canvas متجاوباً ليملأ حاويته الجديدة الكبيرة */
#textil-canvas {
  max-width: 100%;
  height: auto !important; /* السماح للمتصفح بحساب الارتفاع تلقائياً بناءً على العرض الجديد */
}

/* أزرار الواجهات */
.textil-view-buttons {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.view-btn {
  background-color: #fff;
  border: 1px solid #ccc;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: #333;
  transition: all 0.2s ease;
}

.view-btn:hover {
  background-color: #f5f5f5;
}

.view-btn.active {
  background-color: #861e38; /* لونك المميز */
  color: #fff;
}

/* =========================================================================
   القسم الأيمن: لوحة الخيارات القابلة للتمرير (Scrolling Column)
   قمنا بتنحيف هذا القسم ليأخذ حوالي 35% من العرض
   ========================================================================= */
.textil-scroll-options-column {
  /* 🔴 التغيير الأساسي: 35% للخيارات بدلاً من 50% */
  flex: 0 0 calc(40% - 15px);
  width: calc(40% - 15px);

  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
/* =========================================================================
   تنسيق شبكة أزرار الفئات (Herren, Damen, Jungen, Mädchen)
   ========================================================================= */

/* التصميم الأساسي للجوال (زرين في كل سطر 2x2) */
.category-buttons {
  display: grid !important;
  grid-template-columns: repeat(
    2,
    1fr
  ) !important; /* يجبر الأزرار على الانقسام لعمودين متساويين */
  gap: 10px; /* المسافة بين الأزرار */
  width: 100%;
}

/* للشاشات الأكبر (الكمبيوتر والتابلت: 4 أزرار في سطر واحد) */
@media (min-width: 600px) {
  .category-buttons {
    grid-template-columns: repeat(
      4,
      1fr
    ) !important; /* 4 أعمدة متساوية في سطر واحد */
  }
}
/* عنوان المنتج */
.textil-product-header {
  margin-bottom: 20px; /* تقليل المسافة قليلاً للتصميم الأنحف */
}

.textil-product-title {
  font-size: 28px; /* تصغير حجم الخط قليلاً ليتناسب مع القائمة الأنحف */
  font-weight: bold;
  color: #861e38;
  margin: 0 0 5px 0;
}

.textil-product-subtitle {
  font-size: 14px;
  color: #666;
  margin: 0;
}

/* =========================================================================
   صندوق السعر الشامل (Zusammenfassung & Sticky Price)
   ========================================================================= */
.textil-total-price-box {
  background-color: #f9f9f9;
  border: 1px solid #861e38;
  border-radius: 8px;
  padding: 15px;
  text-align: right;
  margin-bottom: 25px;

  /* 🔴 التثبيت في الكمبيوتر من الأعلى 🔴 */
  position: sticky;
  top: 200px; /* يثبت في أعلى الشاشة عند النزول */
  z-index: 99;

  /* حركة التلاشي الناعمة */
  transition:
    opacity 0.4s ease,
    visibility 0.4s ease,
    transform 0.4s ease;
  opacity: 1;
  visibility: visible;
}

/* كلاس الإخفاء عند الوصول للملخص (Fade out) */
.textil-total-price-box.price-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translateY(-15px) !important; /* يرتفع قليلاً عند الاختفاء */
  pointer-events: none;
}

/* =========================================================================
   تعديلات الجوال للسعر والمعاينة
   ========================================================================= */
@media (max-width: 900px) {
  /* 1. حالة تثبيت السعر في الجوال (يتم تفعيلها برمجياً عند النزول) */
  .textil-total-price-box.is-fixed-mobile {
    position: fixed !important;
    top: 80px !important;
    left: 0;
    width: 100%;
    margin: 0;
    padding: 0px 15px;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    border-bottom: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000 !important; /* يجب أن يكون فوق المعاينة وكل شيء */
    text-align: center;
  }

  /* 2. زيادة المسافة للمعاينة المصغرة لكي لا يغطيها السعر */
  .textil-sticky-preview-column.is-minimized {
    top: 178px !important; /* 🔴 هذا هو الـ top abstand الذي طلبته */
  }
}

/* =========================================================================
   تنسيق محتويات صندوق السعر الجديد (مضغوط ومحاذى لليمين)
   ========================================================================= */

.textil-total-price-box {
  background-color: #f9f9f9;
  border: 1px solid #861e38;
  border-radius: 8px;
  padding: 10px 15px; /* 🔴 قللنا الحشو الداخلي لتصغير ارتفاع الصندوق بالكامل */
  margin-bottom: 20px;

  position: sticky;
  top: 200px;
  z-index: 100;

  transition:
    opacity 0.4s ease,
    visibility 0.4s ease,
    transform 0.4s ease;
  opacity: 1;
  visibility: visible;
}

/* السطر الأول: الكلمة يساراً والسعر يميناً */
.price-box-main-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* 🔴 تمت إزالة الخط الفاصل من هنا */
  margin-bottom: 5px; /* 🔴 تقليل المسافة السفلية */
}

.price-box-label {
  font-size: 15px;
  color: #333;
  font-weight: bold;
}

.price-box-value {
  color: #861e38;
  font-size: 26px; /* 🔴 تصغير حجم الخط قليلاً لتوفير المساحة */
  font-weight: bold;
  margin: 0;
}

/* السطور الفرعية والشحن (كلها بدون خطوط ومحاذاة لليمين) */
.price-box-sub-row,
.price-box-shipping-row {
  font-size: 14px; /* 🔴 زيادة الحجم للكمبيوتر (كان 10px) */
  color: #666;
  margin-bottom: 2px;
  text-align: right;
  border: none;
  padding: 0;
}

.price-box-sub-row span {
  font-weight: bold;
  color: #444;
}

/* سطر الشحن المجاني */
.price-box-shipping-row {
  font-weight: bold;
  color: #e67e22;
  margin-top: 0px; /* 🔴 مسافة صغيرة جداً لفصله عن الباقي */
}

.price-box-shipping-row.free-shipping-reached {
  color: #27ae60 !important;
}
/* =========================================================================
   تنسيق محتويات صندوق السعر الجديد 
   ========================================================================= */

/* 1. تكبير الخطوط في شاشة الكمبيوتر (PC) */
.price-box-sub-row,
.price-box-shipping-row {
  font-size: 14px; /* 🔴 زيادة الحجم للكمبيوتر (كان 10px) */
  color: #666;
  margin-bottom: 2px;
  text-align: right;
  border: none;
  padding: 0;
}

/* سطر الشحن المجاني */
.price-box-shipping-row {
  font-weight: bold;
  color: #e67e22;
  margin-top: 4px;
}

/* =========================================================================
   تعديلات الجوال (Mobile)
   ========================================================================= */
@media (max-width: 900px) {
  /* تصغير الخطوط قليلاً في الجوال فقط لتناسب المساحة */
  .price-box-sub-row,
  .price-box-shipping-row {
    font-size: 11px;
  }

  /* 2. الحركة الديناميكية لعمود المعاينة المصغرة */
  .textil-sticky-preview-column.is-minimized {
    top: 178px !important; /* الوضع الطبيعي عندما يكون السعر موجوداً */
    transition: top 0.4s ease !important; /* 🔴 إضافة حركة ناعمة جداً للانزلاق */
  }

  /* 🔴 السطر السحري: هذا الكلاس سنضيفه بالـ JS لرفع المعاينة عندما يختفي السعر */
  .textil-sticky-preview-column.is-minimized.price-is-faded {
    top: 80px !important;
  }
}
/* =========================================================================
   مجموعات الخيارات (متطابقة 100% مع تصميم Aufkleber)
   ========================================================================= */
/* 1. المسافة الكبيرة بين كل صندوق والصندوق الذي يليه (مثلاً بين 3 و 4) */
.textil-config-groups-wrapper {
  display: flex;
  flex-direction: column;
  gap: 15px; /* 🔴 غير هذا الرقم لتكبير أو تصغير المسافة بين الصناديق الرئيسية (جرب 10px أو 25px) */
}

/* 2. المسافة الداخلية للصندوق (لتقريب المحتوى من الحدود الخارجية) */
.config-group {
  padding: 15px 20px; /* 🔴 الرقم الأول (15px) للمسافة العلوية والسفلية، والثاني (20px) لليمين واليسار */
  margin-bottom: 0;
  border-radius: 8px;
  background-color: #fff;
  border-color: #d3d3d3;
}

.config-group legend {
  margin-bottom: 0px !important; /* 🔴 إزالة المسافة تحت كلمة "Druckoptionen" مثلاً */
  padding-bottom: 0px !important;
  font-weight: 600;
  font-size: 1.1em; /* نفس حجم الخط */
  padding: 0 10px;
  margin-left: 0;
  color: #861e38;
  display: flex;
  align-items: center;
  text-transform: none; /* إزالة التكبير ليتطابق مع الملصقات */
}

/* 3. المسافة بين عنوان الصندوق (Legend) وأول عنصر داخله (مثل Hinweis) */
.group-content {
  margin-top: 0px !important; /* 🔴 هذا الرقم يتحكم بالفراغ تحت العنوان (مثلاً 4. Druckoptionen). جرب 0px إذا أردته قريباً جداً */
  font-size: 14px;
  color: #555;
}
.config-group-Pflegehinweise {
  padding: 10px 15px !important; /* 5px للأعلى والأسفل و 2px لليمين واليسار */
  margin: 0; /* تأكد من عدم وجود مسافات خارجية إضافية */
  border-radius: 8px;
  border-color: #d3d3d3;
  background-color: #efefef;
}
/* 4. مسافة التنبيه (Hinweis) عن الأزرار التي تحته */
.print-general-hint {
  margin-bottom: 15px; /* 🔴 صغر هذا الرقم (مثلاً 5px) لتقريب الأزرار من صندوق التنبيه الملون */
  padding: 10px;
  background-color: #f9f9f9;
  border-left: 3px solid #861e38;
  border-radius: 4px;
}
.config-group-Pflegehinweise-label {
  margin-top: 0px !important;
  font-size: medium;
  font-weight: bold;
  display: block; /* يجعل النص في سطر مستقل */
  margin-bottom: 10px; /* هذه هي المسافة الصغيرة التي طلبتها (يمكنك تغيير 5 إلى 2 أو 8) */
  margin-top: 0px !important; /* اختياري: إذا أردت مسافة بسيطة من الأعلى أيضاً */
}
/* =========================================================================
   Option Buttons (جنباً إلى جنب)
   ========================================================================= */
.step-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #555;
  font-size: 14px;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px; /* المسافة بين الأزرار */
}

.option-btn {
  /* 🔴 التعديل هنا: الأزرار ستأخذ نصف المساحة لتكون بجانب بعضها (زرين في كل صف) */
  flex: 1 1 calc(25% - 10px);

  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px 10px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  transition: all 0.05s ease-in-out;
  text-align: center;
  position: relative;
}

.option-btn:hover {
  background-color: #555;
  border-color: #f3f3f3;
}

.option-btn.selected {
  background-color: #861e38;
  color: #ffffff;
  box-shadow: 0 0 8px rgba(219, 219, 219, 0.2);
  outline: none;
}
/* =========================================================================
   تنسيق دوائر الألوان (Color Swatches)
   ========================================================================= */
.color-options-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  margin-bottom: 10px;
}

.color-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid #e0e0e0;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  padding: 0;
  outline: none;
  box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.1); /* ظل داخلي خفيف لتبدو مجسمة */
}

.color-btn:hover {
  transform: scale(1.15); /* تكبير عند مرور الماوس */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.color-btn.selected {
  border: 3px solid #fff; /* إطار أبيض يفصل اللون عن حلقة التحديد */
  box-shadow: 0 0 0 3px #861e38; /* حلقة عنابية خارجية دلالة على الاختيار */
  transform: scale(1.1);
}

.selected-color-name {
  font-size: 13px;
  color: #555;
  margin-top: 8px;
}

.selected-color-name strong {
  color: #861e38; /* تمييز اسم اللون بالعنابي */
}

/* =========================================================================
   تنسيق شبكة المقاسات والكميات (Size & Quantity Grid)
   ========================================================================= */
.size-grid {
  display: grid;
  /* سيقوم بتوزيع المقاسات بجوار بعضها تلقائياً بناءً على العرض المتاح */
  grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
  gap: 10px;
}

.size-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px 5px;
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

/* تلوين حواف المقاس بالعنابي عند اختيار كمية منه */
.size-item:hover,
.size-item.active-qty {
  border-color: #861e38;
  box-shadow: 0 2px 6px rgba(134, 30, 56, 0.15);
}

.size-item label {
  font-weight: bold;
  color: #333;
  margin-bottom: 8px;
  font-size: 14px;
}

/* تنسيق حقل الأرقام ليكون واضحاً والأسهم على اليمين */
.size-qty-input {
  width: 100%;
  max-width: 60px !important; /* عرضناه قليلاً لتظهر الأرقام بوضوح */
  text-align: left !important; /* الرقم على اليسار لترك مساحة للأسهم على اليمين */
  padding: 8px 5px !important;
  font-size: 16px !important;
  font-weight: bold;
  border: 1px solid #ccc;
  border-radius: 4px;
  outline: none;
  box-sizing: border-box;
}

/* إجبار الأسهم (Spinners) على الظهور دائماً في المتصفحات وتكبيرها */
.size-qty-input::-webkit-inner-spin-button,
.size-qty-input::-webkit-outer-spin-button {
  opacity: 1 !important;
  height: 35px;
  cursor: pointer;
}

/* زر علامة الاستفهام (?) */
.size-chart-btn {
  background-color: #fff;
  color: #555;
  border: 2px solid #ddd;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
  outline: none;
}

.size-chart-btn:hover {
  background-color: #861e38;
  color: #fff;
  border-color: #861e38;
}

/* تنسيق عداد الكمية الإجمالية */
.total-qty-display {
  margin-top: 15px;
  font-size: 14px;
  color: #444;
  text-align: right;
  padding-top: 10px;
  border-top: 1px dashed #ccc;
}

.total-qty-display span {
  font-weight: bold;
  color: #861e38;
  font-size: 18px;
}
/* =========================================================================
   التجاوب مع الجوال (Mobile Responsiveness) - النسخة الآمنة والمستقرة
   ========================================================================= */
@media (max-width: 900px) {
  .sabri-textil-configurator {
    /* وضع المعاينة في الأعلى والخيارات في الأسفل */
    flex-direction: column !important;
    gap: 20px;
    padding: 0 15px;
  }

  /* جعل المعاينة ثابتة (Sticky) في الجوال بشكل آمن */
  .textil-sticky-preview-column {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;

    position: sticky !important; /* تفعيل التثبيت */
    top: 81px !important; /* المسافة التي طلبتها من الأعلى */
    z-index: 99; /* لضمان بقائها فوق الخيارات عند النزول */
    background-color: #fff; /* خلفية بيضاء حتى لا تتداخل النصوص */
    padding-bottom: 10px;
  }

  .textil-scroll-options-column {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* تحديد ارتفاع مناسب وتوسيط الكانفاس في الجوال */
  .canvas-container-wrapper {
    background-color: #f1f1f1;
    border: 2px solid #861e38;
    border-radius: 4px;
    max-height: 30vh;
    display: flex !important;
    justify-content: center !important; /* توسيط أفقي */
    align-items: center !important; /* توسيط عمودي */
    overflow: hidden;
  }

  /* إجبار حاوية Fabric.js الداخلية على البقاء في المنتصف */
  .canvas-container-wrapper .canvas-container {
    margin: 0 auto !important;
  }

  .textil-product-title {
    font-size: 24px;
  }
}
/* =========================================================================
   Wichtig: Pflegehinweise (Care Instructions UI) - NEW STYLE
   ========================================================================= */
.care-instructions-group {
  border: none;
  padding: 0;
  margin-bottom: 25px;
  background: transparent;
}

/* تنسيق الصندوق المنسدل (العلوي) */
.care-accordion {
  border: 1px solid #d3d3d3; /* حدود رمادية فاتحة */
  border-radius: 4px;
  margin-bottom: 15px;
  background-color: #fff;
}

.care-accordion-header {
  padding: 15px;
  cursor: pointer;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #861e38; /* لون النص الأزرق كما في الصورة */
  user-select: none;
  transition: background-color 0.2s;
}

.care-accordion-header:hover {
  background-color: #f9f9f9;
}

.care-icon-svg {
  width: 20px;
  height: 20px;
  margin-right: 10px;
  color: #861e38; /* لون الأيقونة الأزرق */
}

.care-arrow {
  font-size: 14px;
  color: #861e38 !important; /* لون السهم الأزرق */
  transition: transform 0.3s ease;
}

.care-arrow.open {
  transform: rotate(180deg);
}

.care-accordion-content {
  padding: 0 15px 20px 15px;
  background-color: #fff;
  font-size: 14px;
  line-height: 1.6;
  color: #444;
}

/* تنسيق مربع القبول الإلزامي (السفلي) */
.care-checkbox-wrapper {
  background-color: #fff;
  border: 1px solid #f5c6cb; /* حدود حمراء باهتة */
  padding: 15px;
  border-radius: 4px;
  display: flex;
  align-items: center;
}

.care-checkbox-wrapper input[type="checkbox"] {
  margin-right: 12px;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.care-checkbox-wrapper label {
  font-weight: normal;
  color: #000000;
  cursor: pointer;
  margin: 0;
  font-size: 14px;
}

.care-checkbox-wrapper .required {
  font-weight: bold;
  color: #861e38;
  margin-left: 3px;
}
/* =========================================================================
   Zusammenfassungs-Container (صندوق الملخص النهائي)
   ========================================================================= */
.textil-summary-container {
  background-color: #fdfdfd;
  border: 1px solid #861e38;
  border-radius: 8px;
  padding: 20px;
  margin-top: 15px;
  box-shadow: 0 4px 15px rgba(134, 30, 56, 0.08);
}

.summary-title {
  margin-top: 0;
  color: #861e38;
  font-size: 18px;
  font-weight: bold;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.summary-price-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  font-weight: bold;
  color: #333;
  margin-bottom: 20px;
}

.summary-price-row .price-value {
  font-size: 26px;
  color: #861e38;
}

.textil-action-wrapper {
  width: 100%;
}

#textil-add-to-cart-btn {
  width: 100%;
  padding: 15px;
  font-size: 16px;
  font-weight: bold;
  text-transform: uppercase;
  background-color: #861e38;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

#textil-add-to-cart-btn:hover {
  background-color: #601528;
  transform: translateY(-2px);
}
/* تأثيرات الحركة (Transitions) */
.textil-sticky-preview-column {
  transition: all 0.3s ease;
}

/* 1. حالة التصغير (تعديل الارتفاع لتقليل الفراغ) */
.textil-sticky-preview-column.is-minimized {
  height: 170px !important; /* 🔴 تقليل الارتفاع من 20 إلى 15 */
  min-height: 169px !important; /* ; /* 🔴 تقليل الحد الأدنى للارتفاع */
  display: flex;
  flex-direction: row; /* الأزرار بجانب الصورة */
  align-items: center;
  border-bottom: 2px solid #861e38;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  cursor: pointer; /* إشارة للعميل للضغط */
  padding: 5px 10px; /* 🔴 تقليل الحشو من الأعلى والأسفل */
}

.textil-sticky-preview-column.is-minimized .canvas-container-wrapper {
  width: 50% !important;
  height: 170px !important;
  max-height: 171px !important;
  margin: 0;
  padding: 0 !important; /* 🔴 إزالة الحشو الداخلي للكانفاس لتقليص المساحة */
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

.textil-sticky-preview-column.is-minimized .textil-view-buttons {
  width: 45%;
  flex-direction: column; /* الأزرار فوق بعضها */
  margin: 0 0 0 10px;
  gap: 5px; /* 🔴 تقليل المسافة بين الأزرار */
}

/* 🔴 تصغير الأزرار قليلاً لتناسب الارتفاع الجديد */
.textil-sticky-preview-column.is-minimized .view-btn {
  padding: 4px 8px;
  font-size: 11px;
}
/* 🔴 إجبار الموكاب (التيشيرت) على توسط المربع الرمادي تماماً 🔴 */
.textil-sticky-preview-column.is-minimized
  .canvas-container-wrapper
  .canvas-container {
  margin: 0 auto !important; /* توسيط أفقي */
}

/* 2. حالة ملء الشاشة (Fullscreen) */
.textil-sticky-preview-column.is-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 999999 !important;
  background: rgba(255, 255, 255, 0.98);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* 🔴 جعل الكانفاس أطول بكثير في وضع ملء الشاشة لتكبير التيشيرت */
.textil-sticky-preview-column.is-fullscreen .canvas-container-wrapper {
  width: 100% !important;
  height: 75vh !important; /* قمنا بزيادتها لتكبير التيشيرت */
  max-height: 80vh !important;
  padding: 0 !important;
}

/* =======================================================
   حل مشكلة زر ملء الشاشة (الحل النهائي والمستقل)
   ======================================================= */

/* 1. إخفاء الزر افتراضياً في جميع الشاشات (الكمبيوتر) */
#mobile-fullscreen-btn {
  display: none !important;
}

/* 2. إظهار الزر فقط وحصرياً عندما تكون الشاشة 900px أو أصغر (الجوال) */
@media (max-width: 900px) {
  #mobile-fullscreen-btn {
    display: block !important;
    margin-top: 15px !important;
    background-color: #333 !important;
    color: #fff !important;
    border: none !important;
    padding: 8px 10px !important;
    border-radius: 4px !important;
    font-size: 13px !important;
    cursor: pointer !important;
    width: 100% !important;
    text-align: center !important;
  }
}

/* =========================================================================
   تنسيقات أدوات التصميم (Design & Gestaltung)
   ========================================================================= */

/* الأزرار الثلاثة */
.design-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 15px;
}
.design-action-btn {
  padding: 10px 5px;
  font-size: 13px;
  background-color: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  color: #333;
  transition: all 0.2s;
}
.design-action-btn:hover,
.design-action-btn.active {
  background-color: #861e38;
  color: #fff;
  border-color: #861e38;
}

/* =========================================================================
   شريط أدوات النص الحديث وقائمة الخطوط الذكية
   ========================================================================= */

/* =========================================================================
   تنسيق شريط أدوات النص (Toolbar)
   ========================================================================= */

/* حاوية الشريط: لجعل العناصر بجانب بعضها أفقياً */
.text-formatting-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px; /* مسافة أنيقة بين الأزرار */
  margin-top: 10px;
  margin-bottom: 15px;
}

/* الأزرار في الحالة العادية (غير مفعلة) */
.format-btn {
  width: 36px;
  height: 36px;
  background-color: #f8f9fa; /* رمادي فاتح جداً */
  border: 1px solid #ced4da; /* إطار رمادي أنيق */
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #495057; /* لون الأيقونات رمادي داكن */
  transition: all 0.2s ease-in-out;
  padding: 0;
}

/* تأثير مرور الماوس (Hover) */
.format-btn:hover {
  background-color: #e2e6ea;
  border-color: #dae0e5;
}

/* حالة التفعيل (Active) - تظهر باللون العنابي فقط عند اختيارها */
.format-btn.active {
  background-color: #861e38;
  border-color: #861e38;
  color: #ffffff; /* أيقونة بيضاء */
}

/* ضبط حجم أيقونات الـ SVG داخل الأزرار */
.format-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor; /* يأخذ لون الزر تلقائياً */
}

/* الخط الفاصل بين أزرار التنسيق والمحاذاة */
.format-divider {
  width: 1px;
  height: 24px;
  background-color: #ced4da;
  margin: 0 4px;
}

/* القائمة المخصصة للخطوط */
.custom-font-selector {
  position: relative;
  flex-grow: 1;
  min-width: 140px;
  user-select: none;
}
.selected-font {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #f8f8f8;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.selected-font::after {
  content: "▼";
  font-size: 10px;
  margin-left: 8px;
  color: #666;
}
.font-dropdown-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  margin: 4px 0 0 0;
  padding: 0;
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
  z-index: 999;
  display: none;
}
.font-dropdown-list li {
  padding: 10px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  font-size: 18px; /* تكبير الخط قليلاً ليكون واضحاً */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.2s;
}
.font-dropdown-list li:hover {
  background-color: #fceef0;
  color: #861e38;
}
.font-dropdown-list li:last-child {
  border-bottom: none;
}
/* أزرار فئات مكتبة التصاميم */
.motif-cat-btn {
  padding: 6px 12px;
  background: #f1f1f1;
  border: 1px solid #ddd;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.motif-cat-btn.active {
  background: #861e38;
  color: #fff;
  border-color: #861e38;
}

/* منطقة الرفع (Drag & Drop) */
#upload-drop-zone:hover {
  border-color: #861e38;
  background: #f0f8ff;
}
/* قائمة الطبقات (Ebenen) */
.layers-container {
  border-top: 1px dashed #ccc;
  padding-top: 15px;
}
.layers-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.layer-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 5px;
  cursor: pointer;
}
.layer-item.active {
  border-color: #861e38;
  border-width: 2px;
  background: #fff0f0;
}
/* =========================================================================
   تصميم زر الحذف (X) فوق الطبقات (Ebenen)
   ========================================================================= */
.layer-btn-wrapper {
  position: relative;
  display: inline-block;
}

.delete-layer-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  background-color: #dc3545; /* لون أحمر */
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: bold;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 10;
  transition: transform 0.2s;
}

.delete-layer-btn:hover {
  transform: scale(1.1);
  background-color: #c82333;
}
/* =========================================================================
   لوحة الألوان المقسمة (Categorized Swatches)
   ========================================================================= */
.color-categories-wrapper {
  margin-bottom: 15px;
  max-height: 250px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid #eee;
  border-radius: 6px;
  background: #fff;
}
.color-category-title {
  font-size: 13px;
  color: #861e38;
  border-bottom: 1px solid #eee;
  padding-bottom: 5px;
  margin-top: 15px;
  margin-bottom: 10px;
}
.color-category:first-child .color-category-title {
  margin-top: 0;
}
.color-swatches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  gap: 12px 5px;
}
.color-swatch-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.design-color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.design-color-swatch:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}
.design-color-swatch.selected {
  transform: scale(1.15);
  outline: 2px solid #861e38;
  outline-offset: 2px;
}
.color-swatch-name {
  font-size: 9px;
  color: #555;
  margin-top: 5px;
  text-transform: uppercase;
  line-height: 1.1;
  word-wrap: break-word;
  max-width: 50px;
}
/* تصميم أزرار الطبقات (Ebenen) حسب الصورة */
.layer-btn {
  padding: 6px 15px;
  border: 1px solid #861e38;
  border-radius: 6px;
  background-color: #fffafb;
  color: #861e38;
  cursor: pointer;
  font-size: 13px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.layer-btn.active {
  background-color: #861e38;
  color: #fff;
  box-shadow: 0 3px 6px rgba(134, 30, 56, 0.3);
}
.layer-btn:hover:not(.active) {
  background-color: #fceef0;
}
/* تنسيق الزر عندما يحتوي على تصميم (استخدام الـ ID يجعل الأولوية أقوى) */
.position-btn.has-design {
  border-color: #000000 !important; /* إطار أخضر */
  background-color: #861e38 !important; /* خلفية خضراء فاتحة جداً */
  position: relative;
}

/* إضافة علامة صح صغيرة فوق الزر المكتمل */
.position-btn.has-design::after {
  content: "✓";
  position: absolute;
  top: -5px;
  right: -5px;
  background: #28a745;
  color: #861e38;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 11px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
/* غلاف الصورة المصغرة لتمكين التموضع المطلق للزر */
.uploaded-thumb-wrapper {
  position: relative;
  display: inline-block;
}

/* زر الحذف X في معرض الصور */
.remove-thumb-btn {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #dc3545;
  color: white;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border: 1px solid white;
  z-index: 5;
  transition: transform 0.2s;
}

.remove-thumb-btn:hover {
  transform: scale(1.2);
  background: #a71d2a;
}
/* ==========================================
   T-Shirt Configurator - Clean Color Swatches
   ========================================== */
.print-colors-container {
  margin-top: 10px;
}
.color-category {
  margin-top: 5px;
}
.color-category-title {
  font-size: 13px;
  color: #666;
  margin-bottom: 12px;
  font-weight: 600;
}
.color-swatches-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.color-swatch-item {
  text-align: center;
  width: 75px; /* مساحة كافية لاسم اللون */
}
/* تصميم الدائرة الملونة الأساسي */
.design-color-swatch {
  width: 50px;
  height: 30px;
  border-radius: 5px;
  margin: 0 auto;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  border: 1px solid transparent;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
/* تأثير الماوس */
.design-color-swatch:hover {
  transform: scale(1.15);
}
/* تأثير التحديد (علامة الاختيار) */
.design-color-swatch.selected {
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 4px #861e38;
  transform: scale(1.1);
}
/* إضافة إطار رمادي للألوان الفاتحة جداً لتظهر بوضوح */
.design-color-swatch[data-color="#FFFFFF"],
.design-color-swatch[data-color="#F5F5F5"],
.design-color-swatch[data-color="#F5F5DC"],
.design-color-swatch[data-color="#F8F9FA"],
.design-color-swatch[data-color="#FDFD96"],
.design-color-swatch[data-color="#FFF700"] {
  border-color: #d3d3d3;
}
/* تصميم اسم اللون تحت الدائرة */
.color-swatch-name {
  font-size: 11px;
  display: block;
  margin-top: 6px;
  line-height: 1;
  word-wrap: break-word;
  color: #444;
  text-transform: uppercase;
}
/* ==========================================
   T-Shirt Configurator - Pro Motif Library Modal
   ========================================== */
.motif-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px); /* تأثير ضبابي حديث للخلفية */
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
}

.motif-modal-window {
  background: #fff;
  border-radius: 12px;
  width: 95%;
  max-width: 1000px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
}

.motif-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 25px;
  border-bottom: 1px solid #eee;
  background: #fff;
}

.motif-modal-header h3 {
  color: #861e38;
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

/* تقسيم النافذة إلى قسمين */
.motif-modal-body {
  display: flex;
  flex-direction: row;
  flex-grow: 1;
  overflow: hidden;
}

/* 1. الشريط الجانبي للفئات */
.motif-sidebar {
  width: 220px;
  border-right: 1px solid #eee;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  padding: 20px 15px;
  overflow-y: auto;
}

.motif-categories-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.motif-cat-btn {
  padding: 10px 15px;
  border: none;
  background: transparent;
  color: #555;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  font-weight: 500;
}

.motif-cat-btn:hover {
  background: #eee;
}

.motif-cat-btn.active {
  background: #861e38;
  color: #fff;
  box-shadow: 0 4px 10px rgba(134, 30, 56, 0.2);
}

/* 2. قسم المحتوى الرئيسي والصور */
.motif-main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  background: #fff;
}

.motif-search-wrapper {
  margin-bottom: 20px;
}

.motif-search-input {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  background: #f9f9f9;
  transition: border 0.3s;
}

.motif-search-input:focus {
  outline: none;
  border-color: #861e38;
  background: #fff;
}

.motif-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 15px;
  overflow-y: auto;
  padding-right: 5px;
  flex-grow: 1;
  align-content: start;
}

/* ==========================================
   📱 تصميم الجوال (Responsive Mobile)
   ========================================== */
@media (max-width: 768px) {
  .motif-modal-body {
    flex-direction: column; /* تحويل التخطيط ليكون عمودياً */
  }

  .motif-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #eee;
    padding: 15px;
    background: #fff;
    flex-shrink: 0;
  }

  .motif-categories-container {
    flex-direction: row;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 5px;
    gap: 10px;
  }

  .motif-cat-btn {
    text-align: center;
    padding: 8px 16px;
    border: 1px solid #eee;
    white-space: nowrap;
  }

  .motif-main-content {
    padding: 15px;
  }
}
/* إجبار النص على الظهور في شريط بحث التصاميم */
#motif-search-input {
  color: #000000 !important; /* إجبار لون النص ليكون أسود */
  -webkit-text-fill-color: #000000 !important; /* حل مشكلة متصفحات سفاري وكروم */
  background-color: #f9f9f9 !important; /* لون خلفية مريح */
  opacity: 1 !important;
}
/* تنسيق خاص للمقاسات الطويلة (الوسائد والحقائب) */
#custom-product-sizes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)) !important; /* تكبير العرض ليناسب النص */
    gap: 10px;
    margin-top: 10px;
}

#custom-product-sizes .size-item label {
    font-size: 13px !important;
    text-align: center;
    line-height: 1.2;
    height: 30px; /* توحيد الارتفاع */
    display: flex;
    align-items: center;
}
/* --- إخفاء العناصر للمنتجات غير الملابس (وسائد وحقائب) --- */

/* جعل الزر الوحيد يتوسط الصفحة في حال كان للمخدات أو الشنط */
.product-type-kissen .category-buttons, 
.product-type-tasche .category-buttons {
    display: flex;
    justify-content: center;
}

.product-type-kissen .category-buttons .option-btn,
.product-type-tasche .category-buttons .option-btn {
    min-width: 200px; /* جعل الزر عريضاً وواضحاً */
    font-weight: bold;
}

/* 2. إخفاء أزرار الأكمام تحت الكانفاس */
.product-type-kissen .view-btn[data-view*="sleeve"],
.product-type-tasche .view-btn[data-view*="sleeve"] {
    display: none !important;
}

/* 3. إخفاء مقاسات التيشيرتات القديمة (XS, S, M, L...) */
.product-type-kissen #adult-sizes, 
.product-type-kissen #kids-sizes,
.product-type-tasche #adult-sizes, 
.product-type-tasche #kids-sizes,
.product-type-kissen .size-grid:not(#custom-product-sizes),
.product-type-tasche .size-grid:not(#custom-product-sizes) {
    display: none !important;
}

/* 4. إخفاء خيارات الأكمام في قسم "مواضع الطباعة" */
.product-type-kissen #pos-sleeve-left,
.product-type-kissen #pos-sleeve-right,
.product-type-tasche #pos-sleeve-left,
.product-type-tasche #pos-sleeve-right {
    display: none !important;
}
/* إخفاء زر جدول المقاسات (علامة الاستفهام) للوسائد والحقائب */
.product-type-kissen #size-chart-btn,
.product-type-tasche #size-chart-btn {
    display: none !important;
}