/* ==========================================================================
   NinjaMame Videos Component — nm-videos.css
   ========================================================================== */

:root {
  --nm-yellow: #f5c518;
  --nm-white: #ffffff;
  --nm-card-radius: 18px;
  --nm-play-size: 64px;
  --nm-thumb-ratio: 56.25%;
  --nm-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --nm-peek-width: 120px;
  --nm-slides-per-view: 3;
}

/* --------------------------------------------------------------------------
   Wrapper
   -------------------------------------------------------------------------- */
.nm-videos-wrapper {
  position: relative;
  width: 100%;
}

/* --------------------------------------------------------------------------
   Card
   -------------------------------------------------------------------------- */
.nm-video-card {
  position: relative;
  border-radius: var(--nm-card-radius);
  overflow: hidden;
  background: var(--headings-color);
  cursor: pointer;
  transition:
    transform var(--nm-transition),
    box-shadow var(--nm-transition);
  user-select: none;
  border: 6px solid #fff;
}

.nm-video-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

/* --------------------------------------------------------------------------
   Thumbnail
   -------------------------------------------------------------------------- */
.nm-video-thumb {
  position: relative;
  width: 100%;
  padding-bottom: var(--nm-thumb-ratio);
  overflow: hidden;
  background: #111;
}

.nm-video-thumb img,
.nm-video-thumb__placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition:
    transform var(--nm-transition),
    filter var(--nm-transition);
}

.nm-video-thumb__placeholder {
  background: linear-gradient(135deg, #1a1a2e 0%, #2d3561 100%);
}

.nm-video-card:hover .nm-video-thumb img {
  transform: scale(1.05);
  filter: brightness(0.75);
}

.nm-video-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 30%,
    rgba(26, 26, 46, 0.55) 100%
  );
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Play Button
   -------------------------------------------------------------------------- */
.nm-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: var(--nm-play-size);
  height: var(--nm-play-size);
  border: none;
  background: var(--primary-color);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    transform var(--nm-transition),
    background var(--nm-transition),
    box-shadow var(--nm-transition);
  box-shadow: 0 4px 20px rgba(90, 176, 51, 0.55);
  padding: 0;
}

.nm-play-btn__ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 3px solid var(--primary-color);
  opacity: 0;
  transform: scale(0.85);
  transition:
    opacity var(--nm-transition),
    transform var(--nm-transition);
}

.nm-video-card:hover .nm-play-btn__ring {
  opacity: 0.5;
  transform: scale(1.15);
  animation: nm-ring-pulse 1.6s ease-in-out infinite;
}

@keyframes nm-ring-pulse {
  0%,
  100% {
    opacity: 0.5;
    transform: scale(1.1);
  }
  50% {
    opacity: 0.15;
    transform: scale(1.3);
  }
}

.nm-play-btn__icon {
  width: 28px;
  height: 28px;
  color: var(--nm-white);
  position: relative;
  left: 2px;
  flex-shrink: 0;
}

.nm-video-card:hover .nm-play-btn {
  transform: translate(-50%, -50%) scale(1.12);
  background: var(--nm-yellow);
  box-shadow: 0 6px 28px rgba(245, 197, 24, 0.6);
}

.nm-video-card:hover .nm-play-btn .nm-play-btn__icon {
  color: var(--headings-color);
}

/* --------------------------------------------------------------------------
   Inline Video
   -------------------------------------------------------------------------- */
.nm-video-inline-wrap {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #000;
}

.nm-video-inline-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* --------------------------------------------------------------------------
   Video Title
   -------------------------------------------------------------------------- */
.nm-video-title {
  padding: 12px 16px 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--nm-white);
  line-height: 1.3;
  letter-spacing: 0.01em;
  background: var(--headings-color);
}

/* --------------------------------------------------------------------------
   GRID layout
   -------------------------------------------------------------------------- */
.nm-videos--grid .nm-videos-grid {
  display: grid;
  gap: 24px;
}

.nm-videos--cols-2 .nm-videos-grid {
  grid-template-columns: repeat(2, 1fr);
}
.nm-videos--cols-3 .nm-videos-grid {
  grid-template-columns: repeat(3, 1fr);
}
.nm-videos--cols-4 .nm-videos-grid {
  grid-template-columns: repeat(4, 1fr);
}

/* --------------------------------------------------------------------------
   SLIDER layout
   -------------------------------------------------------------------------- */
.nm-videos--slider .nm-videos-swiper {
  overflow: hidden;
  padding-bottom: 52px;
}

.nm-videos--slider .swiper-wrapper {
  align-items: stretch;
}

.nm-videos--slider .swiper-slide {
  height: auto;
}

/* Navigation Buttons */
.nm-videos-btn {
  position: absolute;
  top: calc(50% - 26px);
  z-index: 10;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--primary-color);
  background: var(--headings-color);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background var(--nm-transition),
    color var(--nm-transition);
  transform: translateY(-50%);
  padding: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.nm-videos-btn svg {
  width: 20px;
  height: 20px;
}

.nm-videos-btn:hover {
  background: var(--primary-color);
  color: var(--nm-white);
}

.nm-videos-btn--prev {
  left: 12px;
}
.nm-videos-btn--next {
  right: 12px;
}

/* Pagination dots */
.nm-videos-pagination {
  bottom: 10px !important;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.nm-videos-pagination .swiper-pagination-bullet {
  width: 8px;
  height: 8px;
  background: rgba(255, 255, 255, 0.35);
  opacity: 1;
  border-radius: 4px;
  transition: all var(--nm-transition);
}

.nm-videos-pagination .swiper-pagination-bullet-active {
  background: var(--primary-color);
  width: 24px;
}

/* --------------------------------------------------------------------------
   PEEK елемент — декоративен, вдясно от Swiper-а
   -------------------------------------------------------------------------- */
.nm-videos--peek {
  display: block;
  position: relative;
  overflow: visible;
}

.nm-videos--peek .nm-videos-swiper {
  overflow: hidden;
}

.nm-videos-peek {
  position: absolute;
  top: 0;
  left: calc(100% + 24px);
  bottom: 52px;
  width: calc(
    (100% - (var(--nm-slides-per-view) - 1) * 24px) / var(--nm-slides-per-view)
  );
  border-radius: var(--nm-card-radius);
  overflow: hidden;
  border: 6px solid #fff;
}

.nm-videos-peek__inner {
  position: absolute;
  inset: 0;
}

.nm-videos-peek__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.nm-videos-peek__placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1a1a2e 0%, #2d3561 100%);
}

/* Fade overlay върху peek — от прозрачно към цвета на фона */
.nm-videos-peek__fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(98, 93, 177, 0) 0%,
    rgba(98, 93, 177, 0.3) 25%,
    rgba(98, 93, 177, 0.7) 55%,
    rgba(98, 93, 177, 0.92) 80%,
    rgba(98, 93, 177, 1) 100%
  );
}

/* --------------------------------------------------------------------------
   Overflow клас (стар подход — запазен за съвместимост)
   -------------------------------------------------------------------------- */
.nm-videos--overflow {
  overflow: hidden;
}
.nm-videos--peek .nm-videos-swiper,
.nm-videos--slider .nm-videos-swiper {
  overflow: visible !important;
}

.nm-videos--slider {
  overflow: hidden;
}

.nm-videos--overflow .nm-videos-swiper {
  overflow: visible;
}

/* --------------------------------------------------------------------------
   LIGHTBOX
   -------------------------------------------------------------------------- */
.nm-lb-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(10, 10, 20, 0.92);
  display: flex !important;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.nm-lb-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.nm-lb-inner {
  position: relative;
  width: min(90vw, 960px);
  animation: nm-lb-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes nm-lb-in {
  from {
    transform: scale(0.88) translateY(24px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.nm-lb-video-wrap {
  position: relative;
  padding-bottom: var(--nm-thumb-ratio);
  border-radius: var(--nm-card-radius);
  overflow: hidden;
  background: #000;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
  border: 3px solid var(--primary-color);
}

.nm-lb-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.nm-lb-close {
  position: absolute;
  top: -52px;
  right: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  background: transparent;
  color: var(--nm-white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background var(--nm-transition),
    border-color var(--nm-transition);
  padding: 0;
}

.nm-lb-close svg {
  width: 18px;
  height: 18px;
}

.nm-lb-close:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .nm-videos-btn--prev {
    left: 8px;
  }
  .nm-videos-btn--next {
    right: 8px;
  }
  .nm-videos--cols-4 .nm-videos-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  :root {
    --nm-peek-width: 60px;
  }
}

@media (max-width: 768px) {
  :root {
    --nm-play-size: 52px;
    --nm-card-radius: 14px;
    --nm-peek-width: 48px;
  }

  .nm-videos-wrapper {
    --nm-thumb-ratio: var(--nm-ratio-mobile) !important;
  }

  .nm-videos--cols-3 .nm-videos-grid,
  .nm-videos--cols-4 .nm-videos-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .nm-videos--cols-2 .nm-videos-grid {
    grid-template-columns: 1fr;
  }

  .nm-videos-btn {
    display: none;
  }

  .nm-lb-inner {
    width: 95vw;
  }
  .nm-lb-close {
    top: -48px;
  }
}

@media (max-width: 480px) {
  .nm-videos--cols-3 .nm-videos-grid,
  .nm-videos--cols-4 .nm-videos-grid {
    grid-template-columns: 1fr;
  }

  /* На мобилни peek се скрива — твърде малко място */
  .nm-videos-peek {
    display: none;
  }
}
