/* YouTube Video Embedding Styles */

/* Responsive video container */
.video-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  max-width: 100%;
  margin: var(--space-6) 0;
  background-color: #000;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

/* Video wrapper with caption */
.video-wrapper {
  margin: var(--space-8) 0;
}

.video-caption {
  margin-top: var(--space-3);
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  font-style: italic;
}

/* Loading state */
.video-container.loading {
  background-color: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-container.loading::before {
  content: "جاري تحميل الفيديو...";
  color: var(--text-light);
  font-size: var(--font-size-sm);
}

[dir="ltr"] .video-container.loading::before {
  content: "Loading video...";
}

/* Lazy loading placeholder */
.video-placeholder {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  background-color: var(--bg-secondary);
  cursor: pointer;
  border-radius: var(--radius-md);
  margin: var(--space-6) 0;
}

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

.video-placeholder .play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 48px;
  background-color: rgba(23, 23, 23, 0.8);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.video-placeholder:hover .play-button {
  background-color: #cc181e;
}

.video-placeholder .play-icon {
  width: 0;
  height: 0;
  border-left: 20px solid white;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  margin-left: 4px;
}

/* Mobile optimization */
@media (max-width: 767px) {
  .video-container,
  .video-placeholder {
    margin: var(--space-4) 0;
  }
  
  .video-caption {
    font-size: var(--font-size-xs);
    padding: 0 var(--space-3);
  }
}

/* Print styles */
@media print {
  .video-container,
  .video-placeholder {
    display: none;
  }
  
  .video-wrapper::after {
    content: "[فيديو: " attr(data-video-title) "]";
    display: block;
    padding: var(--space-4);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-align: center;
    font-style: italic;
  }
}

/* Privacy notice */
.video-privacy-notice {
  background-color: var(--bg-tertiary);
  padding: var(--space-4);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-3);
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  text-align: center;
}

.video-privacy-notice a {
  color: var(--primary-color);
  text-decoration: underline;
}

/* Multiple videos in a row */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-4);
  margin: var(--space-6) 0;
}

.video-grid .video-container {
  margin: 0;
}

/* Playlist container */
.playlist-container {
  display: flex;
  gap: var(--space-4);
  margin: var(--space-6) 0;
}

.playlist-main {
  flex: 1;
}

.playlist-sidebar {
  width: 300px;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  max-height: 500px;
  overflow-y: auto;
}

@media (max-width: 991px) {
  .playlist-container {
    flex-direction: column;
  }
  
  .playlist-sidebar {
    width: 100%;
    max-height: none;
  }
}