/* ====================== */
/* SWIPER CORE STYLES */
/* ====================== */
.swiper {
  --swiper-navigation-size: 48px;
  --swiper-pagination-bullet-size: 12px;
  --swiper-pagination-bullet-horizontal-gap: 6px;
  --slide-min-height: 400px;
  --slide-border-radius: 0px;
  --slide-box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  --slide-content-padding: 2rem;
  --swiper-arrow-offset: 20px; /* New variable for consistency */
  
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  /* RTL-safe containment */
  isolation: isolate;
}

.swiper-wrapper {
  display: flex;
  width: 100%;
  height: 100%;
  /* RTL consistency */
  flex-direction: inherit;
}

.swiper-slide {
  flex-shrink: 0;
  width: 100%;
  height: 100%;
  position: relative;
  transition: all 0.5s ease;
  /* Force LTR layout inside slides */
  direction: ltr;
  /* Prevent layout shifts */
  contain: layout;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.drop-zone.border-danger {
  border-color: #dc3545 !important;
  background-color: rgba(220, 53, 69, 0.05);
  transition: all 0.3s ease;
}

/* ====================== */
/* NAVIGATION ARROWS */
/* ====================== */
.swiper-button-prev,
.swiper-button-next {
  --arrow-bg-opacity: 0.9;
  --arrow-icon-color: white;
  --arrow-border-width: 2px;
  --arrow-color-rgb: 59, 130, 246;
  
  width: var(--swiper-navigation-size, 48px);
  height: var(--swiper-navigation-size, 48px);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: calc(var(--swiper-navigation-size, 48px) * 0.42);
  transition: all 0.3s ease;
  z-index: 10;
  cursor: pointer;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  /* RTL protection */
  margin: 0;
}

/* Base positioning */
.swiper-button-prev {
  left: var(--swiper-arrow-offset);
  right: auto;
}

.swiper-button-next {
  right: var(--swiper-arrow-offset);
  left: auto;
}

/* RTL support - icon swap only */
[dir="rtl"] .swiper-button-prev::after {
  content: 'next';
}

[dir="rtl"] .swiper-button-next::after {
  content: 'prev';
}

/* Hover states */
.swiper-button-prev:hover,
.swiper-button-next:hover {
  --arrow-bg-opacity: 1;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
}

/* Disabled state */
.swiper-button-disabled {
  opacity: 0.35 !important;
  cursor: auto;
  pointer-events: none;
  transform: translateY(-50%) !important;
}

/* Icon Styling */
.swiper-button-prev::after,
.swiper-button-next::after {
  filter: 
    drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3))
    drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
  transition: filter 0.2s ease;
  /* RTL protection */
  display: block;
}

/* Active State */
.swiper-button-prev:active,
.swiper-button-next:active {
  transform: translateY(-50%) scale(0.95);
}

/* Focus State */
.swiper-button-prev:focus,
.swiper-button-next:focus {
  outline: 2px solid rgba(var(--arrow-color-rgb), 0.5);
  outline-offset: 2px;
}

/* ARROW STYLE TYPES */
.arrow-type-fill {
  background-color: rgba(var(--arrow-color-rgb), var(--arrow-bg-opacity)) !important;
  border: var(--arrow-border-width) solid rgba(var(--arrow-color-rgb), var(--arrow-bg-opacity)) !important;
  color: var(--arrow-icon-color) !important;
}

.arrow-type-outline {
  background-color: transparent !important;
  border: var(--arrow-border-width) solid rgba(var(--arrow-color-rgb), var(--arrow-bg-opacity)) !important;
  color: rgba(var(--arrow-color-rgb), var(--arrow-bg-opacity)) !important;
}

/* ARROW SHAPE MODIFIERS */
.arrow-shape-circle {
  border-radius: 50% !important;
}

.arrow-shape-square {
  border-radius: 0 !important;
}

.arrow-shape-rounded {
  border-radius: 8px !important;
}

.arrow-shape-pill {
  border-radius: 999px !important;
}

/* COMBINED ARROW STYLES */
.arrow-circle {
  border-radius: 50% !important;
  background-color: rgba(var(--arrow-color-rgb), var(--arrow-bg-opacity)) !important;
  border: var(--arrow-border-width) solid rgba(var(--arrow-color-rgb), var(--arrow-bg-opacity)) !important;
  color: var(--arrow-icon-color) !important;
}

.arrow-square {
  border-radius: 0 !important;
  background-color: rgba(var(--arrow-color-rgb), var(--arrow-bg-opacity)) !important;
  border: var(--arrow-border-width) solid rgba(var(--arrow-color-rgb), var(--arrow-bg-opacity)) !important;
  color: var(--arrow-icon-color) !important;
}

.arrow-rounded {
  border-radius: 8px !important;
  background-color: rgba(var(--arrow-color-rgb), var(--arrow-bg-opacity)) !important;
  border: var(--arrow-border-width) solid rgba(var(--arrow-color-rgb), var(--arrow-bg-opacity)) !important;
  color: var(--arrow-icon-color) !important;
}

.arrow-pill {
  border-radius: 999px !important;
  background-color: rgba(var(--arrow-color-rgb), var(--arrow-bg-opacity)) !important;
  border: var(--arrow-border-width) solid rgba(var(--arrow-color-rgb), var(--arrow-bg-opacity)) !important;
  color: var(--arrow-icon-color) !important;
}

/* Outline Rounded */
.arrow-outline {
  border-radius: 8px !important;
  background-color: transparent !important;
  border: var(--arrow-border-width) solid rgba(var(--arrow-color-rgb), var(--arrow-bg-opacity)) !important;
  color: rgba(var(--arrow-color-rgb), var(--arrow-bg-opacity)) !important;
}

/* ARROW COLOR MODIFIERS */
.arrow-color-orange { 
  --arrow-color-rgb: 249, 115, 22 !important;
  --arrow-icon-color: white !important;
}

.arrow-color-red { 
  --arrow-color-rgb: 239, 68, 68 !important;
  --arrow-icon-color: white !important;
}

.arrow-color-black { 
  --arrow-color-rgb: 0, 0, 0 !important;
  --arrow-icon-color: white !important;
}

.arrow-color-green { 
  --arrow-color-rgb: 34, 197, 94 !important;
  --arrow-icon-color: black !important;
}

.arrow-color-blue { 
  --arrow-color-rgb: 59, 130, 246 !important;
  --arrow-icon-color: white !important;
}

/* ========================= */
/* BULLET PAGINATION SYSTEM */
/* ========================= */
.swiper-pagination {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 20;
  align-items: center;
  justify-content: center;
  /* RTL protection */
  padding: 0;
}

/* Center pagination bullets both horizontally and vertically */
.preview-swiper .swiper-pagination {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

/* Base bullet */
.swiper-pagination-bullet {
  width: var(--swiper-pagination-bullet-size);
  height: var(--swiper-pagination-bullet-size);
  border-radius: 50%;
  opacity: 0.5;
  background-color: currentColor;
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  /* RTL protection */
  margin: 0;
}

.swiper-pagination-bullet:hover {
  opacity: 0.8;
  transform: scale(1.1);
}

.swiper-pagination-bullet-active {
  opacity: 1;
  transform: scale(1.2);
  border-color: rgba(255,255,255,0.8);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
}

/* Shapes */
.bullet-circle .swiper-pagination-bullet {
  border-radius: 50%;
}

.bullet-square .swiper-pagination-bullet {
  border-radius: 0;
}

/* Number style */
.bullet-number .swiper-pagination-bullet {
  width: 20px;
  height: 20px;
  font-size: 12px;
  font-weight: bold;
  color: inherit;
  background-color: currentColor;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
}

/* Actual number inside */
.bullet-number .swiper-pagination-bullet::after {
  content: attr(data-bullet-number);
  color: inherit;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* COLORS */
.bullet-orange { color: #f97316; }
.bullet-red    { color: #ef4444; }
.bullet-black  { color: #000000; }
.bullet-green  { color: #22c55e; }
.bullet-blue   { color: #3b82f6; }

/* TEXT CONTRAST FIXES FOR GREEN */
.bullet-number.bullet-green .swiper-pagination-bullet::after {
  color: #000 !important;
}
.bullet-number .swiper-pagination-bullet::after {
  content: attr(data-bullet-number);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  text-align: center;
  line-height: 1;
}

/* ====================== */
/* SLIDE CONTENT STYLES */
/* ====================== */
.swiper-slide {
  position: relative;
  overflow: hidden;
  border-radius: var(--slide-border-radius);
  background: #f5f5f5;
  box-shadow: var(--slide-box-shadow);
  transition: transform 0.5s ease, opacity 0.5s ease, box-shadow 0.3s ease;
  min-height: var(--slide-min-height);
  display: flex;
  justify-content: center;
  align-items: center;
}

.slide-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  right: 0; /* RTL protection */
  margin: 0;
}

[dir="rtl"] .slide-image {
  left: 0;
  right: auto;
}

.slide-content {
  position: relative;
  z-index: 2;
  padding: var(--slide-content-padding);
  text-align: center;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* RTL protection */
  margin: 0;
}

/* ====================== */
/* SLIDE OVERLAY STYLES */
/* ====================== */
.slide-title {
  font-size: var(--title-font-size, 1.5rem);
  padding: var(--title-padding, 0.75rem 1.5rem);
  border-radius: var(--title-border-radius, 2px);
  margin-bottom: 0.5rem;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
  display: inline-block;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s ease;
}

.slide-subtitle {
  font-size: var(--subtitle-font-size, 1.1rem);
  padding: var(--subtitle-padding, 0.5rem 1rem);
  border-radius: var(--subtitle-border-radius, 4px);
  max-width: 100%;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
  display: inline-block;
  line-height: 1.4;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s ease;
}

.slide-content.text-left   { text-align: left; align-items: flex-start; }
.slide-content.text-right  { text-align: right; align-items: flex-end; }
.slide-content.text-center { text-align: center; align-items: center; }

/* ====================== */
/* TRANSITION EFFECTS */
/* ====================== */
/* Fade Effect */
.swiper-fade .swiper-slide {
  opacity: 0 !important;
  transition-property: opacity !important;
}

.swiper-fade .swiper-slide-active,
.swiper-fade .swiper-slide-duplicate-active {
  opacity: 1 !important;
}

/* Zoom Effect */
.swiper-effect-zoom .swiper-slide {
  transition: transform 0.5s ease, opacity 0.5s ease;
}

.swiper-effect-zoom .swiper-slide-active {
  transform: scale(1.1);
  z-index: 1;
}

.swiper-effect-zoom .swiper-slide-prev,
.swiper-effect-zoom .swiper-slide-next {
  opacity: 0.7;
  transform: scale(0.9);
}

/* Push Effect */
.swiper-effect-push .swiper-slide-prev {
  transform: translateX(-100%) scale(0.8);
  opacity: 0.5;
}

.swiper-effect-push .swiper-slide-next {
  transform: translateX(100%) scale(0.8);
  opacity: 0.5;
}

/* Wipe Effect */
.swiper-effect-wipe .swiper-slide-prev {
  clip-path: inset(0 100% 0 0);
}

.swiper-effect-wipe .swiper-slide-next {
  clip-path: inset(0 0 0 100%);
}

/* Stack Effect */
.swiper-effect-stack .swiper-slide-prev {
  transform: scale(0.8) translateY(-10%) rotate(-3deg);
  opacity: 0.6;
  z-index: 0;
}

.swiper-effect-stack .swiper-slide-next {
  transform: scale(1) translateY(0) rotate(0deg);
  z-index: 1;
}

/* Flip Effect */
.swiper-effect-flip .swiper-slide {
  backface-visibility: hidden;
  transform-style: preserve-3d;
}

.swiper-effect-flip .swiper-slide-prev {
  transform: rotateY(180deg);
  opacity: 0;
}

.swiper-effect-flip .swiper-slide-next {
  transform: rotateY(-180deg);
  opacity: 0;
}

/* ====================== */
/* UTILITY CLASSES */
/* ====================== */
.has-arrows .swiper-button-prev,
.has-arrows .swiper-button-next {
  display: flex !important;
}

.no-arrows .swiper-button-prev,
.no-arrows .swiper-button-next {
  display: none !important;
}

.has-bullets .swiper-pagination {
  display: flex !important;
}

.no-bullets .swiper-pagination {
  display: none !important;
}

/* ====================== */
/* MODAL STYLES */
/* ====================== */
#slidePreviewModal .modal-dialog {
  max-width: 90%;
  margin: 1rem auto;
}

#slidePreviewModal .modal-content {
  background: transparent;
  border: none;
}

.preview-swiper {
  width: 100%;
  height: 70vh;
}

/* ====================== */
/* RESPONSIVE ADJUSTMENTS */
/* ====================== */
@media (max-width: 992px) {
  .swiper {
    --swiper-navigation-size: 42px;
    --swiper-arrow-offset: 18px;
    --slide-min-height: 350px;
  }
}

@media (max-width: 768px) {
  .swiper {
    --swiper-navigation-size: 36px;
    --swiper-pagination-bullet-size: 10px;
    --swiper-pagination-bullet-horizontal-gap: 5px;
    --slide-min-height: 300px;
    --slide-content-padding: 1.5rem;
    --swiper-arrow-offset: 15px;
  }
  
  .swiper-button-prev {
    left: var(--swiper-arrow-offset);
  }
  
  .swiper-button-next {
    right: var(--swiper-arrow-offset);
  }
  
  .slide-title {
    --title-font-size: 1.2rem;
    --title-padding: 0.5rem 1rem;
  }
  
  .slide-subtitle {
    --subtitle-font-size: 0.9rem;
    --subtitle-padding: 0.3rem 0.6rem;
  }
}

@media (max-width: 576px) {
  .swiper {
    --swiper-navigation-size: 32px;
    --swiper-pagination-bullet-size: 8px;
    --swiper-pagination-bullet-horizontal-gap: 4px;
    --slide-min-height: 250px;
    --slide-content-padding: 1rem;
    --swiper-arrow-offset: 10px;
  }
  
  .swiper-button-prev {
    left: var(--swiper-arrow-offset);
  }
  
  .swiper-button-next {
    right: var(--swiper-arrow-offset);
  }
  
  .bullet-number .swiper-pagination-bullet {
    width: 16px;
    height: 16px;
    font-size: 8px;
  }
}

/* ====================== */
/* RTL/LTR PARITY ENFORCEMENT */
/* ====================== */
[dir="rtl"] .swiper-slide,
[dir="rtl"] .swiper-wrapper,
[dir="rtl"] .slide-content {
  /* Reset all directional properties */
  text-align: inherit;
  float: none;
  transform: none;
  margin: 0;
  padding: 0;
}

[dir="rtl"] .swiper-button-prev {
  left: var(--swiper-arrow-offset);
  right: auto;
}

[dir="rtl"] .swiper-button-next {
  right: var(--swiper-arrow-offset);
  left: auto;
}

[dir="rtl"] .swiper-slide img {
  transform: none !important;
}

/* ====================== */
/* PRINT STYLES */
/* ====================== */
@media print {
  .swiper-button-prev,
  .swiper-button-next,
  .swiper-pagination {
    display: none !important;
  }
  
  .swiper-slide {
    min-height: auto !important;
    page-break-inside: avoid;
  }
  
  .swiper-wrapper {
    display: block;
    height: auto;
  }
}