/* 
 * Video Highlight Slider - Elementor Integration 
 * Version 2.1.0 (Refactored)
 */

/* =========================================
   1. Base Containers & Layout
   ========================================= */

.elementor-widget-video-highlight-slider .highlight-slider,
.highlight-slider {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding: 4rem 0;
  background: transparent;
  isolation: isolate;
  z-index: 1;
  box-sizing: border-box;
}

/* Track */
.elementor-widget-video-highlight-slider .highlight-track,
.highlight-track {
  display: flex;
  transition: transform 0.8s cubic-bezier(0.77, 0, 0.175, 1);
  will-change: transform;
  gap: 2rem;
  padding: 0 2rem;
  justify-content: flex-start;
  scroll-snap-type: x mandatory;
  overflow-x: auto;
  -ms-overflow-style: none; /* IE/Edge */
  scrollbar-width: none;    /* Firefox */
  cursor: grab;
  box-sizing: border-box;
}

.elementor-widget-video-highlight-slider .highlight-track:active,
.highlight-track:active {
  cursor: grabbing;
}

.elementor-widget-video-highlight-slider .highlight-track::-webkit-scrollbar,
.highlight-track::-webkit-scrollbar {
  display: none;
}

/* Slide Item */
.highlight-slide {
  flex: 0 0 60%;
  max-width: 60%; /* Default Desktop */
  transition: transform 0.4s ease, opacity 0.4s ease;
  opacity: 0.4;
  transform: scale(0.9);
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  scroll-snap-align: center;
  user-select: none;
}

.highlight-slide.active {
  flex: 0 0 70%;
  max-width: 70%;
  opacity: 1;
  transform: scale(1);
}

/* Content Wrapper */
.highlight-content {
  position: relative;
  overflow: hidden;
  width: var(--vhs-content-width, 100%);
  height: auto;
  color: white;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: transparent;
  aspect-ratio: var(--vhs-aspect-ratio, 16 / 9);
  isolation: isolate;
}

.highlight-slider[data-height-mode="fixed"] .highlight-content {
  height: var(--vhs-content-height, auto);
}

/* =========================================
   2. Video Elements
   ========================================= */

.highlight-content .highlight-thumbnail {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  z-index: 0;
  transition: opacity 0.4s ease;
}

.highlight-content .highlight-thumbnail.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.elementor-widget-video-highlight-slider .highlight-content video,
.elementor-widget-video-highlight-slider .highlight-content iframe,
.highlight-content video,
.highlight-content iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
  border-radius: inherit; /* Sync with container */
}

/* Iframe Specifics */
.elementor-widget-video-highlight-slider .highlight-content iframe,
.highlight-content iframe {
  border: none;
  pointer-events: none; /* Interact via API only */
  object-position: center;
}

/* =========================================
   3. Aspect Ratios
   ========================================= */

/* 16:9 */
.elementor-widget-video-highlight-slider.aspect-ratio-16-9 .highlight-content,
.aspect-ratio-16-9 .highlight-content { --vhs-aspect-ratio: 16/9; }

/* 4:3 */
.elementor-widget-video-highlight-slider.aspect-ratio-4-3 .highlight-content,
.aspect-ratio-4-3 .highlight-content { --vhs-aspect-ratio: 4/3; }

/* 21:9 */
.elementor-widget-video-highlight-slider.aspect-ratio-21-9 .highlight-content,
.aspect-ratio-21-9 .highlight-content { --vhs-aspect-ratio: 21/9; }

/* 1:1 */
.elementor-widget-video-highlight-slider.aspect-ratio-1-1 .highlight-content,
.aspect-ratio-1-1 .highlight-content { --vhs-aspect-ratio: 1/1; }

/* Custom */
.elementor-widget-video-highlight-slider.aspect-ratio-custom .highlight-content,
.aspect-ratio-custom .highlight-content { --vhs-aspect-ratio: auto; }

/* Fallbacks for older browsers */
@supports not (aspect-ratio: 16/9) {
  .aspect-ratio-16-9 .highlight-content::before { content: ''; display: block; padding-top: 56.25%; }
  .aspect-ratio-4-3 .highlight-content::before { content: ''; display: block; padding-top: 75%; }
  .aspect-ratio-21-9 .highlight-content::before { content: ''; display: block; padding-top: 42.86%; }
  .aspect-ratio-1-1 .highlight-content::before { content: ''; display: block; padding-top: 100%; }
  .aspect-ratio-custom .highlight-content::before { content: none; display: none; }
}

/* =========================================
   4. Typography
   ========================================= */

.highlight-content h2,
.highlight-content p {
  position: relative;
  z-index: 1;
  margin: 0;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.highlight-content h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.highlight-content p {
  font-size: 1.2rem;
  line-height: 1.6;
  font-weight: 400;
}

/* =========================================
   5. Controls (Audio & Dots)
   ========================================= */

/* Audio Toggle */
.highlight-slider .highlight-content .audio-toggle {
  position: absolute;
  z-index: 999;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  user-select: none;
  outline: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  /* Resets */
  margin: 0 !important;
  padding: 0 !important;
  text-decoration: none !important;
  line-height: 1 !important;
  appearance: none !important;
  /* Elementor controlled: top, right, width, height, bg, border */
}

.highlight-slider .highlight-content .audio-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.highlight-slider .highlight-content .audio-toggle:active {
  transform: scale(0.95);
}

.highlight-slider .highlight-content .audio-toggle .audio-icon,
.highlight-slider .highlight-content .audio-toggle .play-icon,
.highlight-slider .highlight-content .audio-toggle .pause-icon,
.highlight-slider .highlight-content .audio-toggle .stop-icon {
  display: none !important;
  font-family: "Font Awesome 6 Free" !important;
  font-weight: 900;
  /* Elementor controlled: color, font-size */
}

/* Audio/Playback Icon States */
.highlight-slider .highlight-content .audio-toggle[data-icon="muted"] .audio-off { display: block !important; }
.highlight-slider .highlight-content .audio-toggle[data-icon="unmuted"] .audio-on { display: block !important; }
.highlight-slider .highlight-content .audio-toggle[data-icon="play"] .play-icon { display: block !important; }
.highlight-slider .highlight-content .audio-toggle[data-icon="pause"] .pause-icon { display: block !important; }
.highlight-slider .highlight-content .audio-toggle[data-icon="stop"] .stop-icon { display: block !important; }

/* Tooltip for extended controls */
.highlight-slider .highlight-content .audio-toggle::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  pointer-events: none;
  z-index: 1000;
}

.highlight-slider .highlight-content .audio-toggle:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Dots Navigation */
.highlight-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
}

.highlight-dots button {
  border-radius: 50%;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  /* Resets */
  font-size: 0;
  appearance: none;
  /* Elementor controlled: width, height, color */
  background: rgba(255, 255, 255, 0.4);
  width: 10px;
  height: 10px;
}

.highlight-dots button.active {
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.highlight-dots button:hover {
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

/* =========================================
   6. Responsive Breakpoints
   ========================================= */

/* Tablet (max 1024px) */
@media (max-width: 1024px) {
  .highlight-track { gap: 1.5rem; padding: 0 1.5rem; }
}

/* Mobile (max 768px) */
@media (max-width: 768px) {
  .highlight-track { gap: 1rem; padding: 0 1rem; }
}

/* Small Mobile (max 480px) */
@media (max-width: 480px) {
  .highlight-track { padding: 0 0.5rem; }
}
