/* --- Стили для сетки галереи --- */
.video-thumbnail {
  position: relative;
  cursor: pointer;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transition: transform 0.3s, box-shadow 0.3s;
  aspect-ratio: 16 / 9;
  background-color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-thumbnail:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.video-thumbnail img.video-poster-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-thumbnail .video-thumbnail-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s;
  z-index: 2;
}

.video-thumbnail .play-icon {
  width: 60px;
  height: 60px;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
  padding: 12px;
  filter: invert(0);
}

/* --- Стили для модального окна (создаваемого JS) --- */
.video-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.7);
  z-index: 1040;
  opacity: 0;
  transition: opacity 0.2s;
}

.video-modal-backdrop.show {
  opacity: 1;
}

.video-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.video-modal.show {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.video-modal-content {
  background-color: #181818;
  border-radius: 12px;
  /* Уменьшаем ширину окна */
  width: 100%; 
  /* Уменьшаем максимальную ширину для больших экранов */
  max-width: 800px; 
  box-shadow: 0 5px 25px rgba(0,0,0,0.3);
}

.video-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  color: #fff;
  border-bottom: 1px solid #333;
}

.video-modal-header h5 {
  margin: 0;
  font-size: 1.2rem;
}

.video-modal-header .btn-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
}
.video-modal-header .btn-close:hover {
  opacity: 1;
}

.video-modal-body {
  padding: 0;
}


/* --- Стили для кастомного плеера --- */
.custom-video-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}

.custom-video-player video {
  width: 100%;
  height: 100%;
}

.custom-video-player .controls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(24,24,24,0.85);
  padding: 0.5rem 1rem;
  transition: opacity 0.4s;
}

.custom-video-player .controls button {
  background: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.custom-video-player .controls img {
  width: 24px;
  height: 24px;
}

.custom-video-player .controls .timer {
  font-size: 0.9em;
  color: #fff;
  white-space: nowrap;
}

.custom-video-player .controls .seekbar,
.custom-video-player .controls .volume {
  accent-color: #1976d2;
}

.custom-video-player .controls .seekbar { flex-grow: 1; }
.custom-video-player .controls .volume { max-width: 80px; }


/* --- Адаптивность для мобильных устройств --- */
@media (max-width: 576px) {
  /* Общий контейнер контролов - делаем компактнее */
  .custom-video-player .controls {
    gap: 0.5rem; /* Уменьшаем отступы между элементами */
    padding: 0.5rem;
  }
  
  /* Прячем ползунок громкости, он занимает много места */
  .custom-video-player .controls .volume {
    display: none;
  }
  
  /* Немного уменьшаем таймер, чтобы он не переносился */
  .custom-video-player .controls .timer {
    font-size: 0.85em;
  }

  /* Делаем ползунок перемотки чуть тоньше */
  .custom-video-player .controls .seekbar {
    height: 3px;
  }

  /* Можно сделать иконки чуть меньше, если нужно еще место */
  .custom-video-player .controls img {
    width: 22px;
    height: 22px;
  }
}