/* Video Projects Element Styles */

.video-projects-wrapper {
  width: 100%;
  max-width: 100%;
  position: relative;
  margin-bottom: 40px;
}

/* Header */
.video-projects-header {
  margin-bottom: 30px;
}

.video-projects-heading {
  font-size: 28px;
  font-weight: 700;
  color: #168BEF;
  text-align: center;
  position: relative;
  display: inline-block;
  margin-bottom: 0;
}

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

/* Video Grid */
.video-projects-grid {
  display: grid;
  grid-gap: 30px; /* Sửa typo: 30p x -> 30px */
  padding: 40px 20px;
}

.video-projects-wrapper[data-columns="1"] .video-projects-grid {
  grid-template-columns: 1fr;
}

.video-projects-wrapper[data-columns="2"] .video-projects-grid {
  grid-template-columns: repeat(2, 1fr);
}

.video-projects-wrapper[data-columns="3"] .video-projects-grid {
  grid-template-columns: repeat(3, 1fr);
}

.video-projects-wrapper[data-columns="4"] .video-projects-grid {
  grid-template-columns: repeat(4, 1fr);
}

/* Video Project Item */
.video-project-item {
  display: flex;
  flex-direction: column;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: all 0.2s ease; /* Giảm thời gian chuyển đổi từ 0.3s xuống 0.2s */
  position: relative;
}

.video-project-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Thumbnail */
.video-thumbnail-wrapper {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: block; /* Ensure button displays as block */
  width: 100%;
  padding: 0; /* Remove any padding */
  margin: 0; /* Remove any margin */
  border: none; /* Remove any border */
  background: none; /* Remove any background */
  text-align: left; /* Align text left */
  font-family: inherit; /* Use parent font */
  appearance: none; /* Remove default button styling */
  -webkit-appearance: none;
  outline: none; /* Remove outline */
}

.video-thumbnail-wrapper:focus {
  outline: none; /* Remove focus outline */
}

.ratio-16-9 {
  aspect-ratio: 16/9;
}

.ratio-4-3 {
  aspect-ratio: 4/3;
}

.ratio-1-1 {
  aspect-ratio: 1/1;
}

.video-thumbnail {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: transform 0.3s ease; /* Giảm từ 0.5s xuống 0.3s */
  cursor: pointer;
}

.video-thumbnail.default-thumbnail {
  background-color: #eaeaea;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-thumbnail.default-thumbnail:before {
  content: '\f03d';
  font-family: 'Font Awesome 5 Free';
  font-size: 48px;
  color: #999999;
  opacity: 0.5;
}

.video-project-item:hover .video-thumbnail {
  transform: scale(1.05);
}

/* Play Button - Cải thiện hiệu ứng nút */
.video-play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70px;
  height: 70px;
  background-color: rgba(22, 139, 239, 0.9); /* Tăng độ đậm từ 0.85 lên 0.9 */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer !important;
  z-index: 10;
  transition: all 0.2s ease; /* Giảm từ 0.3s xuống 0.2s */
  /* Improve clickability with larger tap target */
  padding: 15px;
  margin: -15px;
  /* Ensure proper pointer cursor */
  -webkit-tap-highlight-color: rgba(22, 139, 239, 0.5);
}

.video-play-button:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9); /* Làm sáng hơn viền */
  animation: pulse 1.2s infinite; /* Giảm thời gian từ 2s xuống 1.2s */
  pointer-events: none; /* Ensure it doesn't block clicks */
}

/* Hiệu ứng pulse nhanh hơn và sáng hơn */
@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.9; /* Tăng từ 0.8 lên 0.9 */
    border-color: rgba(255, 255, 255, 0.9);
  }
  50% { /* Thêm keyframe 50% để làm mượt hơn */
    transform: scale(1.2);
    opacity: 0.5;
    border-color: rgba(255, 255, 255, 0.7);
  }
  100% {
    transform: scale(1.4); /* Tăng từ 1.3 lên 1.4 để hiệu ứng rõ hơn */
    opacity: 0;
    border-color: rgba(255, 255, 255, 0.5);
  }
}

/* Thêm hiệu ứng shine cho nút */
.video-play-button:after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 30%;
  height: 200%;
  opacity: 0;
  transform: rotate(30deg);
  background: rgba(255, 255, 255, 0.5);
  background: linear-gradient(
    to right, 
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.4) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shine 1.5s infinite; /* Hiệu ứng loang sáng */
}

@keyframes shine {
  0% {
    opacity: 0;
    left: -60%;
  }
  30% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    left: 100%;
  }
}

.video-play-button i {
  color: white;
  font-size: 24px;
  margin-left: 5px; /* Small offset to center visually */
  pointer-events: none; /* Ensure it doesn't block clicks */
}

.video-project-item:hover .video-play-button {
  background-color: rgba(22, 139, 239, 1);
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 0 25px rgba(22, 139, 239, 0.7); /* Tăng độ sáng của shadow */
}

/* Hiệu ứng phát sáng khi hover */
.video-project-item:hover .video-play-button:before {
  animation: pulse 0.8s infinite; /* Tăng tốc độ pulse khi hover */
  border-color: rgba(255, 255, 255, 1);
}

/* Content */
.video-project-content {
  padding: 20px;
}

.video-project-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  margin-top: 0;
  margin-bottom: 10px;
  color: #333333;
}

.video-project-description {
  font-size: 14px;
  line-height: 1.5;
  color: #666666;
}

/* Video Modal */
.video-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 999999 !important; /* Ensure it's above everything */
  opacity: 0;
  transition: opacity 0.2s ease; /* Giảm từ 0.3s xuống 0.2s */
  align-items: center;
  justify-content: center;
}

.video-modal.active {
  display: flex !important;
  opacity: 1;
}

.video-modal-content {
  position: relative;
  width: 90%;
  max-width: 900px;
  background-color: #000;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.video-modal-close {
  position: absolute;
  top: -40px;
  right: -10px;
  color: white;
  font-size: 36px;
  cursor: pointer;
  z-index: 10;
  transition: transform 0.2s ease; /* Giảm từ 0.3s xuống 0.2s */
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-modal-close:hover {
  transform: scale(1.2);
}

.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
}

.video-container iframe,
.video-container video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Animation for modal - Tối ưu tốc độ */
@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

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

.video-modal.active .video-modal-content {
  animation: scaleIn 0.2s forwards; /* Giảm từ 0.3s xuống 0.2s */
}

/* Important: prevent body scrolling when modal is open */
body.modal-open {
  overflow: hidden !important;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* Add hover focus styles for better accessibility */
.video-thumbnail-wrapper:focus,
.video-thumbnail-wrapper:active,
.video-play-button:focus,
.video-play-button:active {
  outline: none;
}

.video-thumbnail-wrapper:focus .video-thumbnail {
  transform: scale(1.05);
}

.video-thumbnail-wrapper:focus .video-play-button {
  background-color: rgba(22, 139, 239, 1);
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 0 25px rgba(22, 139, 239, 0.7); /* Tăng độ sáng */
}

/* Fix for both light and dark themes */
.video-modal .video-container iframe {
  background-color: black;
}

/* Responsive */
@media (max-width: 991px) {
  .video-projects-wrapper[data-columns="4"] .video-projects-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .video-projects-heading {
    font-size: 24px;
  }
}

@media (max-width: 767px) {
  .video-projects-wrapper[data-columns="3"] .video-projects-grid,
  .video-projects-wrapper[data-columns="4"] .video-projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .video-projects-heading {
    font-size: 22px;
  }
  
  .video-play-button {
    width: 60px;
    height: 60px;
  }
  
  .video-play-button i {
    font-size: 20px;
  }
}

@media (max-width: 480px) {
  .video-projects-wrapper[data-columns="2"] .video-projects-grid,
  .video-projects-wrapper[data-columns="3"] .video-projects-grid,
  .video-projects-wrapper[data-columns="4"] .video-projects-grid {
    grid-template-columns: 1fr;
  }
  
  .video-play-button {
    width: 50px;
    height: 50px;
  }
  
  .video-play-button i {
    font-size: 18px;
  }
} 