/**************************************
  1) تنسيق الـ Overlay 
***************************************/

.modal-overlay {
  position: fixed;
  top: 0; 
  left: 0;
  width: 100%;
  height: 100%;
  
  display: none; /* افتراضي إخفاء */
  justify-content: center;
  align-items: center;
  z-index: 9998;
}

/* عند إظهار المودال */
.modal-overlay.show {
  display: flex;
}


/**************************************
  2) حاوية المودال (#red-castle-modal)
***************************************/
#red-castle-modal.red-castle-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 95%;
  max-width: 450px;
  height: 95vh;
  max-height: 850px;
  background-color: #ffffff;
  border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  display: block;
  overflow: hidden; 
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* عند تفعيل المودال (مثلاً بإضافة كلاس .active)، 
   يمكننا إظهار الحاوية بتغيير opacity */
#red-castle-modal.active {
  opacity: 1;
}

/**************************************
  3) الطبقة الداخلية (layer)
***************************************/
#red-castle-modal .red-castle-layer {
  position: absolute;
  top: 0; 
  left: 0;
  width: 100%; 
  height: 100%;
  background-color: #ffffff;
  border-radius: 20px;
  overflow: hidden;
}

#red-castle-modal .red-castle-layer.active {
  display: block;
  opacity: 1;
}

/**************************************
  4) المحتوى الداخلي 
***************************************/
/* نقلنا overflow-y: auto هنا لكي نفعِّل التمرير عند زيادة المحتوى */
#red-castle-modal .red-castle-content-wrapper {
  width: 100%;
  height: 100%;
  padding: 8px; /* تقليل الحشو */
  overflow-y: auto;
  overflow-x: hidden;
}

#red-castle-modal .red-castle-content {
  position: relative;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 8px;
  gap: 12px;
  overflow: hidden;
}




.red-castle-left-column {
  width: 15%;
  min-width: 45px;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.red-castle-center-column {
  width: 85%;
  height: 100%;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* للشاشات المتوسطة الصغيرة */
@media screen and (max-width: 480px) {
  .red-castle-left-column {
    width: 18%;
    min-width: 40px;
  }
  
  .red-castle-center-column {
    width: 82%;
  }
  
  .red-castle-size-container {
    width: 100%;
    padding: 3px;
  }
}

/* للشاشات الصغيرة جداً */
@media screen and (max-width: 360px) {
  .red-castle-left-column {
    width: 18%;
  }
  
  .red-castle-center-column {
    width: 82%;
  }
  
  .red-castle-size-container {
    width: 100%;
    padding: 2px;
  }
}

/**************************************
  5) العناصر الداخلية بتنسيق معقول
***************************************/
#red-castle-modal .red-castle-top-bar {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
}

#red-castle-modal .red-castle-brand-logo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  height: 60px;
  width: auto;
  object-fit: contain;
}

/* الأزرار العلوية */
#red-castle-modal .red-castle-back-button,
#red-castle-modal .red-castle-cart-button {
  background-color: #fff !important;
  color: #000 !important;
  border: 1px solid #ccc;
  width: 40px;
  height: 40px;
  cursor: pointer;
}

#red-castle-modal .red-castle-back-button:hover,
#red-castle-modal .red-castle-cart-button:hover {
  background-color: #f2f2f2 !important;
  color: #000 !important;
}

#red-castle-modal .red-castle-product-info {
  text-align: left;
  padding: 8px 15px; /* تقليل padding */
  margin-top: 6px;   /* مسافة بسيطة */
}

#red-castle-modal .red-castle-title {
  Display: flex;
  font-size: 1.4rem;  /* تقليل طفيف لتناسق الشاشات الأصغر */
  font-weight: 700;
  margin-bottom: 4px;
  color: #111;
  justify-content: center;
  align-items: center;
  text-align: center;

}

#red-castle-modal .red-castle-subtitle {
  font-size: 0.9rem; /* خفن قليلًا */
  color: #555;
  margin: 0;
  text-align: center;
}

/* حاوية الصورة */
#red-castle-modal .red-castle-image-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  max-height: 50vh;
}

#red-castle-modal .red-castle-image-container img {
  max-width: 85%;
  max-height: 45vh;
  object-fit: contain;
  margin: 0 auto;
}

/* تنظيم الشريط الأفقي */
.red-castle-horizontal-bar {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background-color: white;
  margin-bottom: 20px;
  z-index: 5;
}

/* تنسيق حاوية السعر */
.red-castle-price-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 80px; /* تحديد عرض ثابت */
}

/* تنسيق حاوية السوايب */
.red-castle-swipe-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1; /* يأخذ المساحة المتبقية */
  justify-content: center; /* توسيط أفقي */
  z-index: 10;
}

/* تنسيق حاوية 3D */
.red-castle-3d-container {
  width: 80px; /* تحديد عرض ثابت */
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

/* تنسيق زر السوايب */
.red-castle-swipe-button-container {
  position: relative;
  width: 45px;
  height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: #000;
  border-radius: 25px;
  overflow: hidden;
  cursor: pointer;
  touch-action: none; /* منع سلوك اللمس الافتراضي */
  user-select: none; /* منع تحديد النص */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* تنسيق أيقونة السلة */
.swipe-icon {
  color: white;
  font-size: 20px;
  position: relative;
  z-index: 2;
  margin-top: 15px;
  transition: transform 0.3s ease;
  pointer-events: none; /* منع التفاعل المباشر مع الأيقونة */
}

/* مسار السحب */
.red-castle-swipe-track {
  position: absolute;
  top: 45px; /* بعد الأيقونة */
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: 1px;
}

/* حاوية الأسهم */
.red-castle-swipe-arrows-container {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

/* تنسيق الأسهم */
.red-castle-swipe-arrow {
  width: 8px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  opacity: 0.5;
  animation: arrowPulse 1.5s infinite;
}

/* حركة نبض الأسهم */
@keyframes arrowPulse {
  0%, 100% { 
    opacity: 0.3; 
    transform: rotate(45deg) translateY(0);
  }
  50% { 
    opacity: 1;
    transform: rotate(45deg) translateY(3px);
  }
}

/* تأخير حركة كل سهم */
.red-castle-swipe-arrow:nth-child(1) {
  animation-delay: 0s;
}

.red-castle-swipe-arrow:nth-child(2) {
  animation-delay: 0.2s;
}

.red-castle-swipe-arrow:nth-child(3) {
  animation-delay: 0.4s;
}

/* إخفاء عنوان السوايب إذا كنت تريد تقليل الارتفاع أكثر */
.red-castle-swipe-label {
  display: none;
}

/* تنسيق عنوان السوايب */
.red-castle-swipe-label {
  font-size: 12px;
  margin-bottom: 8px;
}

/* تنسيق عناوين السعر */
.red-castle-price-value {
  font-weight: bold;
  font-size: 18px;
}

.red-castle-price-label {
  font-size: 12px;
}

/* تسمية السوايب */
.red-castle-swipe-label-container {
  display: flex;
  justify-content: center;
  margin-bottom: 5px;
}

.red-castle-swipe-label {
  display: block;
  font-size: 12px;
  color: #666;
  text-align: center;
}

.red-castle-icon-background {
  display: none;
}


/* تعديل حاوية المقاسات */
.red-castle-size-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 5px;
  min-width: 35px;
  max-height: 280px;
  position: relative;
  margin-top: -10px; /* إضافة margin سالب للأعلى */
}

.red-castle-size-label-container {
  text-align: center;
  margin-bottom: 8px;
}

.red-castle-size-label {
  font-size: 0.8rem;
  color: #666;
}

/* تنظيم أزرار المقاسات */
.red-castle-size-buttons-vertical {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  align-items: center;
}

.red-castle-size-btn-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 40px; /* إضافة ارتفاع ثابت */
}

.red-castle-size-btn {
  width: 45px;
  height: 45px;
  border: 1px solid #ccc;
  border-radius: 50%;
  background-color: #ffffff;
  color: #000000;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  margin: 4px 0;
}

.red-castle-size-btn.selected {
  background-color: #000000;
  color: #ffffff;
  border-color: #000000;
}

.red-castle-size-btn:hover {
  background-color: #f5f5f5;
  transform: scale(1.05);
}

.red-castle-size-btn.active {
  background-color: #000;
  color: #fff;
  transform: scale(1.05);
}

.red-castle-size-btn:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

.red-castle-size-btn.active:hover {
  background-color: #000 !important;
}

/* حاوة الصندوق باسل */
.red-castle-box-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1;
  pointer-events: none;
}

.red-castle-box-animation {
  position: relative;
  width: 200px;
  height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.box-state {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.3s ease;
  object-fit: contain;
}

.box-state[data-state="closed"] {
  opacity: 1;
}

/**************************************
  6) Media Queries للشاشات الأصغر 
***************************************/
/* Media Queries للشاشات الأصغر */
@media (max-width: 600px) {
  #red-castle-modal.red-castle-container {
    width: 95%;
    max-width: 350px;
    height: 85vh;
  }
  
  #red-castle-modal .red-castle-title {
    font-size: 1.2rem;
  }
  
  #red-castle-modal .red-castle-subtitle {
    font-size: 0.8rem;
  }
  
  #red-castle-modal .red-castle-top-bar {
    padding: 8px 12px;
  }
  
  #red-castle-modal .red-castle-product-info {
    padding: 6px 12px;
  }
  
  /* تعديل أزرار المقاسات */
  .red-castle-size-btn {
    width: 36px;
    height: 36px;
    font-size: 13px;
    line-height: 34px;
  }
  
  /* تعديل الشريط الأفقي */
  #red-castle-modal .red-castle-horizontal-bar {
    padding: 6px 12px;
  }
}

/* Media Queries للشاشات فائقة الصغيرة */
@media (max-width: 400px) {
  #red-castle-modal.red-castle-container {
    width: 100%;
    max-width: 300px;
    height: 80vh;
  }
  
  #red-castle-modal .red-castle-title {
    font-size: 1rem;
  }
  
  #red-castle-modal .red-castle-subtitle {
    font-size: 0.7rem;
  }
  
  #red-castle-modal .red-castle-top-bar {
    padding: 6px 10px;
  }
  
  #red-castle-modal .red-castle-product-info {
    padding: 4px 10px;
  }
  
  /* تعديل أزرار المقاسات */
  .red-castle-size-btn {
    width: 34px;
    height: 34px;
    font-size: 12px;
    line-height: 32px;
  }
  
  /* تعديل الشريط الأفقي */
  #red-castle-modal .red-castle-horizontal-bar {
    padding: 4px 10px;
  }
}

/* تعديل حجم Modal */
.red-castle-layer {
  height: 100%;
  max-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* تنظيم المحتوى الرئيسي */
.red-castle-content-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 95vh;
  padding: 10px;
}

/* تعديل الشريط العلوي */
.red-castle-top-bar {
  height: 40px;
  min-height: 40px;
  margin-bottom: 5px;
}

/* تعديل معلومات النتج */
.red-castle-product-info {
  margin: 5px 0;
}

.red-castle-title {
  font-size: 1.2rem;
  margin: 0;
}

.red-castle-subtitle {
  font-size: 0.9rem;
  margin: 2px 0;
}

/* تعديل المحتوى الريسي */
.red-castle-content {
  flex: 1;
  min-height: 0;
  position: relative;
  margin: 5px 0;
  height: auto;
}

/* تعديل حجم الصورة المركزية */
.red-castle-center-column {
  height: 100%;
  max-height: 45vh;
}

.red-castle-image-container img {
  max-height: 40vh;
  width: auto;
}

/* تعديل أزرار المقاسات */
.red-castle-size-container {
  top: 50%;
  transform: translateY(-50%);
}

.red-castle-size-buttons-vertical {
  gap: 8px;
}

.red-castle-size-btn {
  padding: 8px;
  font-size: 0.9rem;
}

/* تعديل الشريط الأفقي */
.red-castle-horizontal-bar {
  min-height: 60px;
  margin: 5px 0;
  padding: 10px;
}

/* تعديل حجم صورة الصندوق */
.red-castle-box-container {
  height: 80px;
  min-height: 80px;
  margin: 5px 0;
}

.red-castle-box-container img {
  max-height: 70px;
  width: auto;
}

/* تعديلات للشاشات المتوسطة */
@media screen and (max-height: 800px) {
  .red-castle-content-wrapper {
    max-height: 98vh;
  }
  
  .red-castle-center-column {
    max-height: 35vh;
  }
  
  .red-castle-image-container img {
    max-height: 30vh;
  }
  
  .red-castle-box-container {
    height: 60px;
    min-height: 60px;
  }
  
  .red-castle-box-container img {
    max-height: 50px;
  }
  
  .red-castle-horizontal-bar {
    min-height: 50px;
  }
  
  .red-castle-size-buttons-vertical {
    gap: 6px;
  }
  
  .red-castle-size-btn {
    padding: 6px;
  }
}

/* تعديلات إضافية للشاشات الصغر */
@media screen and (max-height: 620px) {
  .red-castle-title {
    font-size: 1rem;
  }
  
  .red-castle-subtitle {
    font-size: 0.8rem;
  }
  
  .red-castle-center-column {
    max-height: 30vh;
  }
  
  .red-castle-image-container img {
    max-height: 25vh;
  }
  
  .red-castle-size-container {
    width: 40px;
  }
  
  .red-castle-size-btn {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
  }
  
  .red-castle-size-buttons-vertical {
    gap: 8px;
  }
}

/* تأكيد عدم تأثر العناصر الأخرى في الشريط الأفقي */
.red-castle-price-container,
.red-castle-3d-container {
  position: relative;
  z-index: 1;
}

/* تنسيق حاوية عرض الشرائح */
.red-castle-images-slider {
    position: relative;
    width: 100%;
    height: 100%;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    z-index: 10;
}

/* تنسيق حاوية الصور */
.red-castle-image-container {
    position: relative;
    overflow: hidden;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    display: none;
}

.red-castle-image-container:first-child {
    display: flex;
}

.red-castle-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 1;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* حالة التكبير */
.red-castle-image-container.zoomed {
    overflow: scroll;
    -webkit-overflow-scrolling: touch;
}

.red-castle-image-container.zoomed img {
    transform-origin: 0 0;
}

/* مؤشر التمرير العمودي */
.vertical-scroll-indicator {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.scroll-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.scroll-dots {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.dot.active {
    background-color: #000;
    transform: scale(1.2);
}

.fas.fa-chevron-up,
.fas.fa-chevron-down {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.6);
}

/* تحريك السهم العلوي */
@keyframes moveUp {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* حريك السهم السفلي */
@keyframes moveDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(3px); }
}

.fa-chevron-up {
    animation: moveUp 1.5s infinite;
}

.fa-chevron-down {
    animation: moveDown 1.5s infinite;
}

/* مؤشر الإرشا */
.scroll-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.scroll-guide.hide {
    opacity: 0;
    pointer-events: none;
}

.scroll-guide-icon {
    color: rgba(255, 255, 255, 0.8);
    font-size: 32px;
}

.scroll-guide-icon .fa-hand-pointer {
    transform-origin: center;
    transform: rotate(45deg);
    animation: dragAnimation 2.5s 6;
    filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.3));
}

/* حركة السحب من الأسفل إلى الأعلى */
@keyframes dragAnimation {
    0% {
        transform: translateY(100px) rotate(45deg);
        opacity: 0;
    }
    20% {
        transform: translateY(100px) rotate(45deg);
        opacity: 1;
    }
    80% {
        transform: translateY(-100px) rotate(45deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(45deg);
        opacity: 0;
    }
}

/* حركة تغيير الصور */
@keyframes zoomInFade {
    0% {
        opacity: 0;
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes zoomOutFade {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* تطبيق الحركات */
.red-castle-image-container.slide-in {
    animation: zoomInFade 0.3s ease forwards;
}

.red-castle-image-container.slide-out {
    animation: zoomOutFade 0.3s ease forwards;
}

/* الأنماط الافتراضية */

/* شرط للشاشات بحجم 753 × 619 */
@media screen and (width: 753px) and (height: 619px) {
    .red-castle-image-container img {
        max-width: 75%; /* تعديل عرض الصورة */
        max-height: 40vh; /* تعديل ارتفاع الصورة */
    }

    /* يمكن إضافة المزيد من التعديلات هنا */
}

/* يمكن إضافة شروط أخرى للأحجام المختلفة */
@media screen and (max-width: 752px) {
    /* للشاشات الأصغر */
}

@media screen and (min-width: 754px) {
    /* للشاشات الأكبر */
}

/* التنسيقات الأساسية */
.red-castle-image-container {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    will-change: transform, opacity;
}

.red-castle-image-container img {
    width: 90%;
    max-width: 600px;
    height: auto;
    max-height: 600px;
    object-fit: contain;
    pointer-events: none;
}

/* للشاشات الصغيرة جداً */
@media screen and (max-width: 360px) {
    .red-castle-image-container img {
        max-width: 350px;
        max-height: 350px;
        width: 98%;
    }
}

/* للشاشات الصغيرة */
@media screen and (max-width: 480px) {
    .red-castle-image-container img {
        max-width: 400px;
        max-height: 400px;
        width: 95%;
    }
}

/* للأجهزة المتوسطة */
@media screen and (min-width: 481px) and (max-width: 768px) {
    .red-castle-image-container img {
        max-width: 85%;
        max-height: 45vh;
    }
}

/* للشاشات المنخفضة */
@media screen and (max-height: 600px) {
    .red-castle-image-container img {
        max-height: 38vh;
    }
}

/* لشاشات iPhone SE وما شابهها */
@media screen and (width: 375px) and (height: 667px) {
    .red-castle-image-container img {
        max-width: 88%;
        max-height: 40vh;
    }
}

/* للشاشات الصغيرة مع نسبة عرض إلى ارتفاع مختلفة */
@media screen and (max-width: 480px) and (max-height: 800px) {
    .red-castle-center-column {
        height: 100%;
        display: flex;
        align-items: center;
    }

    .red-castle-image-container {
        height: auto;
    }

    .red-castle-image-container img {
        max-height: 35vh;
    }
}

/* للشاشات ذات الارتفاع المنخفض جداً */
@media screen and (max-height: 500px) {
    .red-castle-image-container img {
        max-height: 32vh;
    }
}

/* تنسيق عداد السلة */
.cart-counter {
    position: absolute;
    top: -8px;
    left: -8px;
    background-color: #ff4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
    z-index: 1000;
}

.cart-counter.show {
    opacity: 1;
    transform: scale(1);
}

/* تعديل حركة السحب */
.swipe-icon {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.red-castle-cart-button-container {
    position: relative;
}

.red-castle-cart-button {
    position: relative;
}

.cart-counter {
    position: absolute;
    top: -8px;
    left: -8px;
    background-color: #ff4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
    z-index: 1000;
}

.cart-counter.show {
    opacity: 1;
    transform: scale(1);
}

/* تعديل للشاشات الصغيرة */
@media screen and (max-width: 480px) {
    .red-castle-size-container {
        width: 25%;
        padding: 3px;
    }
    
    .red-castle-center-column {
        width: 75%;
    }
}

/* للشاشات المتوسطة */
@media screen and (max-height: 800px) {
    .red-castle-size-container {
        margin-bottom: 50px;
        max-height: calc(100% - 70px);
    }
}

/* للشاشات الصغيرة */
@media screen and (max-height: 620px) {
    .red-castle-size-container {
        margin-bottom: 40px;
        max-height: calc(100% - 60px);
    }
}

/* للشاشات الصغيرة جداً */
@media screen and (max-width: 400px) {
    .red-castle-size-container {
        margin-bottom: 30px;
        max-height: calc(100% - 50px);
        width: 15%;
        min-width: 35px;
    }
    
    .red-castle-size-btn {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }
}

/* للشاشات المنخفضة */
@media screen and (max-height: 500px) {
    .red-castle-size-container {
        margin-bottom: 25px;
        max-height: calc(100% - 40px);
    }
}

/* لشاشات iPhone SE وما شابهها */
@media screen and (width: 375px) and (height: 667px) {
    .red-castle-size-container {
        margin-bottom: 35px;
        width: 15%;
    }
}

/* للشاشات المتوسطة والصغيرة */
@media screen and (max-width: 480px) {
    .red-castle-size-container {
        width: 25%;
        margin-bottom: min(40px, 12%);
        padding: 3px;
    }
    
    .red-castle-center-column {
        width: 75%;
    }
}

/* للشاشات الصغيرة جداً */
@media screen and (max-width: 360px) {
    .red-castle-size-container {
        width: 20%;
        margin-bottom: min(30px, 10%);
        padding: 2px;
    }
    
    .red-castle-size-btn {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }
}

/* للشاشات المنخفضة */
@media screen and (max-height: 500px) {
    .red-castle-size-container {
        margin-bottom: min(25px, 8%);
    }
}

/* للشاشات المتوسطة والصغيرة */
@media screen and (max-width: 480px) {
    .red-castle-content {
        gap: 15px;
    }
    
    .red-castle-size-container {
        width: 20%;
    }
    
    .red-castle-center-column {
        width: 75%;
    }
}

/* للشاشات المتوسطة */
@media screen and (max-height: 800px) {
    .red-castle-size-container {
        max-height: 240px;
    }
    
    .red-castle-size-buttons-vertical {
        gap: 10px;
    }
}

/* للشاشات الصغيرة */
@media screen and (max-height: 620px) {
    .red-castle-left-column {
        padding-top: 15px;
    }
    
    .red-castle-size-container {
        max-height: 200px;
    }
    
    .red-castle-size-buttons-vertical {
        gap: 8px;
    }
}

/* للشاشات الصغيرة جداً */
@media screen and (max-width: 360px) {
    .red-castle-left-column {
        padding-top: 10px;
    }
    
    .red-castle-size-container {
        max-height: 180px;
    }
    
    .red-castle-size-buttons-vertical {
        gap: 6px;
    }
    
    .red-castle-size-btn {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }
}

/* للشاشات المتوسطة */
@media screen and (max-height: 800px) {
    .red-castle-left-column {
        padding-top: 8px;
    }
    
    .red-castle-size-container {
        max-height: 240px;
    }
}

/* للشاشات الصغيرة */
@media screen and (max-height: 620px) {
    .red-castle-left-column {
        padding-top: 5px;
    }
    
    .red-castle-size-container {
        max-height: 200px;
    }
}

/* للشاشات الصغيرة */
@media screen and (max-height: 620px) {
    .red-castle-size-btn-container {
        height: 35px;
    }
    
    .red-castle-size-btn {
        width: 30px;
        height: 30px;
    }
}

@media screen and (max-height: 700px) {
    #red-castle-modal .red-castle-content {
        padding: 5px;
        gap: 10px;
        height: calc(100% - 40px);
    }

    #red-castle-modal .red-castle-horizontal-bar {
        min-height: 40px;
        padding: 5px;
        margin: 2px 0;
    }
}

@media screen and (max-height: 600px) {
    #red-castle-modal .red-castle-content {
        height: calc(100% - 35px);
    }

    #red-castle-modal .red-castle-horizontal-bar {
        min-height: 35px;
        padding: 3px;
        margin: 1px 0;
    }
}

@media screen and (max-height: 500px) {
    #red-castle-modal .red-castle-content {
        height: calc(100% - 30px);
    }

    #red-castle-modal .red-castle-horizontal-bar {
        min-height: 30px;
        padding: 2px;
        margin: 0;
    }
}

@media screen and (max-height: 700px) {
    .red-castle-size-container {
        max-height: 200px;
        padding: 2px;
    }

    .red-castle-size-buttons-vertical {
        gap: 6px;
    }

    .red-castle-size-btn {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }

    .red-castle-size-label {
        font-size: 0.7rem;
        margin-bottom: 4px;
    }
}

@media screen and (max-height: 600px) {
    .red-castle-size-container {
        max-height: 180px;
        padding: 1px;
    }

    .red-castle-size-buttons-vertical {
        gap: 4px;
    }

    .red-castle-size-btn {
        width: 26px;
        height: 26px;
        font-size: 0.65rem;
    }
}

@media screen and (max-height: 500px) {
    .red-castle-size-container {
        max-height: 160px;
        padding: 0;
    }

    .red-castle-size-buttons-vertical {
        gap: 3px;
    }

    .red-castle-size-btn {
        width: 24px;
        height: 24px;
        font-size: 0.6rem;
    }
}

@media screen and (max-height: 700px) {
    .red-castle-left-column {
        padding: 0;
        margin: 0;
    }
}

@media screen and (max-height: 600px) {
    .red-castle-left-column {
        padding: 0;
        margin: 0;
    }
}

/* تعديل الحاوية الرئيسية */
#red-castle-modal.red-castle-container {
    width: 95%;
    max-width: 450px;
    height: 95vh;
    max-height: 850px;
}

/* تعديل المحتوى */
#red-castle-modal .red-castle-content {
    padding: 8px;
    gap: 12px;
}

/* تعديل العمود الأيسر */
.red-castle-left-column {
    width: 15%;
    min-width: 45px;
    padding: 0;
    margin: 0;
}

/* تعديل العمود المركزي */
.red-castle-center-column {
    width: 85%;
    height: 100%;
    position: relative;
}

/* تعديل حاوية الصور */
.red-castle-images-slider {
    width: 100%;
    height: 100%;
    position: relative;
}

.red-castle-image-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.red-castle-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-height: 70vh;
}

/* للشاشات المتوسطة */
@media screen and (max-height: 800px) {
    #red-castle-modal.red-castle-container {
        height: 92vh;
        max-height: 800px;
    }
    
    .red-castle-image-container img {
        max-height: 65vh;
    }
}

/* للشاشات الصغيرة */
@media screen and (max-height: 700px) {
    #red-castle-modal.red-castle-container {
        height: 90vh;
        max-height: 700px;
    }
    
    .red-castle-image-container img {
        max-height: 60vh;
    }
}

/* للشاشات الصغيرة جداً */
@media screen and (max-width: 480px) {
    .red-castle-left-column {
        width: 18%;
        min-width: 40px;
    }
    
    .red-castle-center-column {
        width: 82%;
    }
    
    .red-castle-image-container img {
        max-height: 55vh;
    }
}

/* للشاشات المنخفضة */
@media screen and (max-height: 600px) {
    #red-castle-modal.red-castle-container {
        height: 88vh;
    }
    
    .red-castle-image-container img {
        max-height: 50vh;
    }
}

/* تعديلات خاصة للمتصفحات في الهواتف */
@supports (-webkit-touch-callout: none) {
    #red-castle-modal.red-castle-container {
        height: -webkit-fill-available;
        max-height: -webkit-fill-available;
        position: fixed;
        top: 0;
        left: 0;
        transform: none;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
    }

    .red-castle-content-wrapper {
        height: -webkit-fill-available;
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .red-castle-top-bar {
        padding-top: max(15px, env(safe-area-inset-top));
    }

    .red-castle-horizontal-bar {
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }
}

/* تعديلات خاصة للمتصفحات في الأندرويد */
@supports not (-webkit-touch-callout: none) {
    @media screen and (max-width: 480px) {
        #red-castle-modal.red-castle-container {
            height: 100vh;
            max-height: 100vh;
            position: fixed;
            top: 0;
            left: 0;
            transform: none;
            width: 100%;
            max-width: 100%;
            border-radius: 0;
        }
    }
}

/* حاوية الصورة المكبرة */
.red-castle-enlarged-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 999999;
}

.red-castle-enlarged-view.active {
    display: flex !important;
}

.red-castle-enlarged-view img {
    max-width: 95%;
    max-height: 95vh;
    object-fit: contain;
}

.red-castle-close-enlarged {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    z-index: 100001;
}

.red-castle-close-enlarged:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* تعديل مؤشر الماوس للصور */
.red-castle-image-container img {
    cursor: zoom-in;
}

/* إضافة خلفية الشعار للمودال بأكمله */
#red-castle-modal .red-castle-layer::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(90deg);
    width: 800px;
    height: 600px;
    background-image: url('./images/brand-logo.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.03;
    pointer-events: none;
    z-index: 1;
}

/* تعديل z-index لجميع العناصر الداخلية */
#red-castle-modal .red-castle-content,
#red-castle-modal .red-castle-left-column,
#red-castle-modal .red-castle-center-column,
#red-castle-modal .red-castle-image-container,
#red-castle-modal .red-castle-top-bar {
    position: relative;
    z-index: 2;
}

/* تعديل خاص للشريط الأفقي */
#red-castle-modal .red-castle-horizontal-bar {
    position: relative;
    background-color: rgba(255, 255, 255, 0.85);
    z-index: 0;
}

.red-castle-image-container {
    position: relative;
    overflow: hidden;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    display: none;
}

.red-castle-image-container:first-child {
    display: flex;
}

.red-castle-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 1;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.red-castle-image-container img[style*="scale"] {
    transition: transform 0.05s linear;
}

.red-castle-image-container.zoomed-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.red-castle-image-container img.zoomed {
    max-width: 95%;
    max-height: 95vh;
    object-fit: contain;
    cursor: zoom-out;
}

#red-castle-modal .red-castle-price-value {
    font-size: 2.5rem;  /* تكبير حجم الخط */
    font-weight: 700;   /* جعل الخط سميك */
    color: #000;        /* لون أسود للنص */
    display: inline-block;
    margin: 10px 0;     /* إضافة هامش */
}

#red-castle-modal .red-castle-price-currency {
    font-size: 1.8rem;  /* حجم أصغر قليلاً لعلامة الدولار */
    font-weight: 700;
    color: #000;
}

/* تحسين تفاعلية زر السلة */
.red-castle-cart-button {
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.red-castle-cart-button:hover {
    transform: scale(1.05);
}

.red-castle-cart-button:active {
    transform: scale(0.95);
}

/* تحسين تجربة المستخدم على الأجهزة المحمولة */
@media (hover: none) {
    .red-castle-cart-button:hover {
        transform: none;
    }
}

