/**
 * CloudGuard Portfolio - YouTube Thumbnail Styles
 * Compact card layout — fits within page flow
 */

/* ── VIDEO SECTION ── */
.video-section {
  padding: 2rem 0;
  background: transparent;
  position: relative;
}

.video-section .section-title {
  display: none;
}

/* ── THUMBNAIL WRAPPER — compact card ── */
.youtube-thumbnail-wrapper {
  max-width: 680px;
  margin: 0 auto;
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #0a0f1e;
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow:
    0 0 0 1px rgba(99, 102, 241, 0.08),
    0 8px 32px rgba(0, 0, 0, 0.45),
    0 0 40px rgba(99, 102, 241, 0.07);
  transition: box-shadow 0.35s ease, transform 0.25s ease;
}

.youtube-thumbnail-wrapper:hover {
  box-shadow:
    0 0 0 1px rgba(99, 102, 241, 0.45),
    0 12px 40px rgba(0, 0, 0, 0.55),
    0 0 60px rgba(99, 102, 241, 0.14);
  transform: translateY(-2px);
}

/* Animated top border */
.youtube-thumbnail-wrapper::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #6366f1, #a78bfa, #6366f1, transparent);
  background-size: 200% 100%;
  animation: videoTopScan 3s linear infinite;
  z-index: 10;
}

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

/* ── THUMBNAIL LINK ── */
.youtube-thumbnail-link {
  display: block;
  position: relative;
  width: 100%;
  overflow: hidden;
  text-decoration: none;
}

.youtube-thumbnail-link:hover {
  transform: none;
  box-shadow: none;
}

/* ── THUMBNAIL CONTAINER — standard 16:9 ratio ── */
.youtube-thumbnail-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: #000;
  overflow: hidden;
}

.youtube-thumbnail-image {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease, filter 0.3s ease;
  filter: brightness(0.78) saturate(1.1);
}

.youtube-thumbnail-link:hover .youtube-thumbnail-image {
  transform: scale(1.03);
  filter: brightness(0.88) saturate(1.2);
}

/* ── PLAY BUTTON ── */
.youtube-play-button {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  transition: transform 0.3s ease, filter 0.3s ease;
  filter: drop-shadow(0 0 14px rgba(255, 0, 0, 0.55));
}

.youtube-thumbnail-link:hover .youtube-play-button {
  transform: translate(-50%, -50%) scale(1.12);
  filter: drop-shadow(0 0 22px rgba(255, 0, 0, 0.85));
}

.youtube-play-button svg {
  width: 60px;
  height: 42px;
}

/* ── OVERLAY ── */
.youtube-thumbnail-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(10, 15, 30, 0.92) 0%, rgba(10, 15, 30, 0.4) 55%, transparent 100%);
  padding: 1.25rem 1.5rem 1rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 3;
}

.youtube-thumbnail-link:hover .youtube-thumbnail-overlay {
  opacity: 1;
}

.youtube-thumbnail-overlay i {
  font-size: 1.8rem;
  color: #ff0000;
  filter: drop-shadow(0 0 6px rgba(255,0,0,0.5));
}

.youtube-thumbnail-overlay span {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ── CORNER BADGE ── */
.youtube-thumbnail-container::after {
  content: 'TUTORIAL';
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(10, 15, 30, 0.85);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #a78bfa;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 3px 8px;
  border-radius: 50px;
  z-index: 5;
  backdrop-filter: blur(6px);
}

/* ── VIDEO INFO PANEL ── */
.youtube-video-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1.25rem;
  background: rgba(255,255,255,0.03);
  border-top: 1px solid rgba(99, 102, 241, 0.15);
  gap: 0.75rem;
}

.youtube-video-info h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.youtube-video-info h4::before {
  content: '';
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #ff0000;
  box-shadow: 0 0 5px rgba(255,0,0,0.7);
  animation: livePulse 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.45; transform: scale(0.75); }
}

.youtube-video-info .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 50px;
  text-decoration: none;
  transition: all 0.25s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.youtube-video-info .btn-primary {
  background: linear-gradient(135deg, #ff0000, #cc0000);
  color: #fff;
  border: none;
  box-shadow: 0 3px 10px rgba(255, 0, 0, 0.28);
}

.youtube-video-info .btn-primary:hover {
  background: linear-gradient(135deg, #ff2222, #ee0000);
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(255, 0, 0, 0.45);
}

/* ── PLACEHOLDER (before JS loads) ── */
.video-container[data-youtube-url]:not(.youtube-loaded) {
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a0f1e 0%, #1e1b4b 100%);
  border-radius: 14px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  position: relative;
  max-width: 680px;
  margin: 0 auto;
}

.video-container[data-youtube-url]:not(.youtube-loaded)::after {
  content: 'Loading video...';
  position: absolute;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.35);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.05em;
}

.video-placeholder {
  display: none;
}

.youtube-loaded .video-placeholder {
  display: none !important;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .youtube-thumbnail-wrapper {
    max-width: 100%;
    border-radius: 10px;
  }

  .youtube-video-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
  }

  .youtube-video-info h4 {
    white-space: normal;
  }

  .youtube-play-button svg {
    width: 48px;
    height: 34px;
  }

  .youtube-thumbnail-overlay {
    padding: 0.85rem 1rem 0.75rem;
  }
}
