/* YouTube Auto Iframe Styles */
/* Styles cho tự động tạo iframe YouTube từ mô tả sản phẩm */

/* Video iframe container trong gallery */
.auto-detected-video {
  position: relative;
  // border: 2px solid #ff0000;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  background: #000;
  margin: 0 auto 10px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auto-detected-video:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 0, 0, 0.3);
}

/* Responsive iframe container */
.auto-detected-video .embed-responsive {
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.auto-detected-video iframe {
  border-radius: 8px;
}

/* Thumbnail slider styles */
.video-thumb {
  position: relative;
  border: 2px solid #ff0000;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
}

.video-thumb:hover {
  border-color: #ff3333;
  transform: scale(1.02);
}

.video-thumb img {
  transition: transform 0.3s ease;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-thumb:hover img {
  transform: scale(1.1);
}

/* Video indicator on thumbnail */
.video-indicator {
  background: rgba(255, 0, 0, 0.9);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: white;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.video-thumb:hover .video-indicator {
  background: rgba(255, 0, 0, 1);
  transform: scale(1.1);
}

/* Badge để phân biệt video tự động detect */
.auto-detected-video::before {
  content: "VIDEO";
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 0, 0, 0.9);
  color: white;
  font-size: 10px;
  font-weight: bold;
  padding: 3px 6px;
  border-radius: 4px;
  z-index: 10;
  pointer-events: none;
}

.video-thumb::before {
  content: "THUMB";
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(255, 0, 0, 0.9);
  color: white;
  font-size: 9px;
  font-weight: bold;
  padding: 2px 4px;
  border-radius: 3px;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.video-thumb:hover::before {
  opacity: 1;
}

/* Video wrapper for responsive iframe */
.youtube-video-wrapper {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  margin: 15px 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  background: #f9f9f9;
  transition: box-shadow 0.3s ease;
}

.youtube-video-wrapper:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.youtube-video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
}

/* Responsive adjustments */
@media (max-width: 991px) {
  .video-indicator {
    width: 26px;
    height: 26px;
    font-size: 11px;
  }
}

@media (max-width: 767px) {
  .video-indicator {
    width: 24px;
    height: 24px;
    font-size: 10px;
  }
  
  .auto-detected-video,
  .video-thumb {
    border-width: 1px;
  }
  
  .auto-detected-video::before {
    font-size: 9px;
    padding: 2px 4px;
    top: 4px;
    right: 4px;
  }
}

/* Integration with existing slick slider */
.slick-slide .auto-detected-video,
.slick-slide .video-thumb {
  margin: 0 2px;
}

/* Loading state */
.youtube-loading {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Animation cho video iframes */
@keyframes slideInVideo {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auto-detected-video,
.video-thumb {
  animation: slideInVideo 0.5s ease-out;
}

/* Focus states for accessibility */
.auto-detected-video:focus-within,
.video-thumb:focus {
  outline: 2px solid #ff0000;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .auto-detected-video,
  .video-thumb {
    border-width: 3px;
    border-color: #ff0000;
  }
  
  .video-indicator {
    background: #ff0000;
    border: 1px solid #ffffff;
  }
}