/**
 * Product Video Styles
 * استایل‌های ویدیو محصول - سازگار با FlexSlider ووکامرس
 */

/* استایل ویدیو در گالری FlexSlider */
.product-video-gallery-item {
  position: relative;
  cursor: pointer;
}

.product-video-gallery-item .product-video-link {
  display: block;
  position: relative;
}

.product-video-gallery-item img {
  width: 100%;
  height: auto;
}

/* اضافه کردن pointer-events برای اطمینان از کلیک‌پذیری */
.product-video-gallery-item,
.product-video-gallery-item a,
.product-video-gallery-item img,
.video-thumb-trigger,
.video-thumb-trigger a,
.video-thumb-trigger img {
  pointer-events: auto !important;
  cursor: pointer !important;
}

/* آیکون play روی تصویر ویدیو در نمایش بزرگ */
.video-play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  width: 70px;
  height: 70px;
  background: var(--color-gold, #d4af37);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
  pointer-events: none;
}

.video-play-overlay svg {
  width: 28px;
  height: 28px;
  fill: var(--color-dark, #1a1a1a);
  margin-right: -4px;
}

.product-video-gallery-item:hover .video-play-overlay {
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 6px 30px rgba(212, 175, 55, 0.6);
}

/* استایل برای حالت active/tap در موبایل */
.product-video-gallery-item:active .video-play-overlay,
.video-thumb-trigger:active .video-play-overlay {
  transform: translate(-50%, -50%) scale(0.95);
  background: var(--color-light-gold, #e8c547);
}

/* استایل thumbnail ویدیو در لیست کوچک */
.flex-control-thumbs .product-video-thumb {
  position: relative;
  cursor: pointer;
}

.flex-control-thumbs .product-video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-thumb-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  background: var(--color-gold, #d4af37);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.video-thumb-icon svg {
  width: 12px;
  height: 12px;
  fill: var(--color-dark, #1a1a1a);
  margin-right: -2px;
}

/* Video Story Modal */
.video-story-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.video-story-modal.active {
  opacity: 1;
  visibility: visible;
}

/* Modal backdrop */
.video-story-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
}

/* Modal container - Story style */
.video-story-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  height: 90vh;
  max-height: 750px;
  background: #000;
  border-radius: 20px;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.video-story-modal.active .video-story-container {
  transform: scale(1);
}

/* Story header */
.video-story-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px 20px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.video-story-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.video-story-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--color-gold, #d4af37);
  object-fit: cover;
}

.video-story-title {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-story-subtitle {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  margin: 0;
}

/* Close button - دکمه بستن بزرگتر و مرئی‌تر با رنگ طلایی */
.video-story-close {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--color-gold, #d4af37);
  color: var(--color-dark, #1a1a1a);
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.video-story-close:hover {
  background: var(--color-light-gold, #e8c547);
  transform: scale(1.05);
}

.video-story-close svg {
  width: 16px;
  height: 16px;
  stroke: var(--color-dark, #1a1a1a);
}

.close-text {
  display: inline-block;
  font-weight: 600;
}

/* Video content */
.video-story-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.video-story-content video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-story-content iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Progress bar at top */
.video-story-progress {
  position: absolute;
  top: 8px;
  left: 16px;
  right: 16px;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  z-index: 11;
  overflow: hidden;
}

.video-story-progress-bar {
  height: 100%;
  background: #fff;
  border-radius: 3px;
  width: 0;
  transition: width 0.1s linear;
}

/* Mute button */
.video-story-mute {
  position: absolute;
  bottom: 100px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10;
}

.video-story-mute:hover {
  background: rgba(255, 255, 255, 0.2);
}

.video-story-mute svg {
  width: 24px;
  height: 24px;
  fill: #fff;
}

/* View product button */
.video-story-cta {
  position: absolute;
  bottom: 30px;
  left: 20px;
  right: 20px;
  z-index: 10;
}

.video-story-cta a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  background: var(--color-gold, #d4af37);
  color: var(--color-dark, #1a1a1a);
  text-decoration: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.3s ease;
}

.video-story-cta a:hover {
  background: var(--color-light-gold, #e8c547);
  transform: translateY(-2px);
}

.video-story-cta svg {
  width: 18px;
  height: 18px;
}

/* Loading spinner */
.video-story-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
}

.video-story-loading::after {
  content: "";
  display: block;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--color-gold, #d4af37);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsive */
@media (max-width: 768px) {
  /* کوچک کردن مودال در موبایل - 30 درصد کوچکتر */
  .video-story-container {
    max-width: 70%;
    height: 60vh;
    max-height: 500px;
    border-radius: 16px;
  }

  /* کوچک کردن المان‌های داخلی متناسب با سایز جدید */
  .video-story-header {
    padding: 12px 14px;
  }

  .video-story-avatar {
    width: 32px;
    height: 32px;
  }

  .video-story-title {
    font-size: 12px;
    max-width: 120px;
  }

  .video-story-subtitle {
    font-size: 10px;
  }

  /* دکمه بستن کوچکتر در موبایل */
  .video-story-close {
    padding: 6px 10px;
    font-size: 11px;
    gap: 4px;
  }

  .video-story-close svg {
    width: 14px;
    height: 14px;
  }

  .close-text {
    display: none;
  }

  .video-story-mute {
    width: 36px;
    height: 36px;
    bottom: 70px;
    right: 14px;
  }

  .video-story-mute svg {
    width: 18px;
    height: 18px;
  }

  .video-story-cta {
    bottom: 16px;
    left: 14px;
    right: 14px;
  }

  .video-story-cta a {
    padding: 10px 14px;
    font-size: 13px;
    border-radius: 10px;
  }

  .video-story-cta svg {
    width: 14px;
    height: 14px;
  }

  .video-story-progress {
    left: 12px;
    right: 12px;
    top: 6px;
    height: 2px;
  }

  .video-play-overlay {
    width: 55px;
    height: 55px;
  }

  .video-play-overlay svg {
    width: 22px;
    height: 22px;
  }
}
