/* ============================================================
   MOZDA ACADEMY — CLEAN 3D COVERFLOW VIDEO CAROUSEL UI
   Refined per user instructions:
   - No top header text or subtitle
   - No bottom player bar (controls on the card itself)
   - Zero mouse wobble/tilt (rock-solid stable cards)
   - 100% crystal-clear, sharp, vivid video and poster quality (no blur/dimming)
   ============================================================ */

.code-carousel-wrapper {
  position: relative;
  width: 100%;
  margin: 10px 0 24px 0;
  padding: 0;
  border-radius: 0;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  overflow: visible;
  user-select: none;
  -webkit-user-select: none;
}

/* 3D Coverflow Container */
.coverflow-container {
  position: relative;
  width: 100%;
  max-width: 1080px;
  height: 510px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1000px;
  touch-action: pan-y;
  cursor: grab;
}

.coverflow-container:active {
  cursor: grabbing;
}

/* Ambient Backlight Glow */
.coverflow-ambient-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 440px;
  height: 440px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.5;
  pointer-events: none;
  transition: background 0.6s ease;
  z-index: 1;
}

/* 3D Stage */
.coverflow-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  z-index: 2;
}

/* Individual 3D Card */
.coverflow-card {
  position: absolute;
  width: 260px;
  height: 460px;
  display: flex;
  flex-direction: column;
  transform-origin: center center;
  transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.35, 1),
              opacity 0.4s ease;
  will-change: transform, opacity;
  cursor: pointer;
}

.coverflow-card.is-dragging {
  transition: none !important;
}

/* Card Container */
.card-glass-panel {
  position: relative;
  width: 100%;
  height: 100%;
  background: rgba(20, 27, 23, 0.9);
  border-radius: 22px;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.8),
              inset 0 1px 1px rgba(255, 255, 255, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.coverflow-card.is-active .card-glass-panel {
  border-color: rgba(212, 246, 68, 0.75);
  box-shadow: 0 25px 55px -10px rgba(0, 0, 0, 0.9),
              0 0 35px rgba(212, 246, 68, 0.35),
              inset 0 1px 1.5px rgba(255, 255, 255, 0.3);
}

/* Video / Poster Media Box */
.card-artwork-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 20px;
  overflow: hidden;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Crystal-clear video & poster image */
.card-artwork-img,
.card-artwork-video-active {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  image-rendering: auto;
  filter: none !important; /* Zero blur, 100% crisp */
}

.card-artwork-video-active {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: transparent;
  display: none; /* Hidden until user taps play */
  filter: none !important;
}

/* Top bar badges on the card */
.card-top-bar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 12;
  pointer-events: none;
}

.card-quality-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: rgba(15, 11, 26, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #D4F644;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.card-sound-btn {
  pointer-events: auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(15, 11, 26, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.card-sound-btn:hover {
  background: #D4F644;
  color: #000000;
  transform: scale(1.1);
  border-color: #D4F644;
}

/* Play/Pause Button on the Card — Hidden per user request for 100% unobstructed video view */
.card-center-play-btn,
.card-play-overlay,
.card-hint-badge,
[data-action="toggle-play"],
.play-pause-btn {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Active card playing state border glow */
.coverflow-card.is-video-playing .card-glass-panel {
  border-color: rgba(212, 246, 68, 0.95);
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.9),
              0 0 40px rgba(212, 246, 68, 0.5),
              inset 0 1px 1.5px rgba(255, 255, 255, 0.4);
}

/* Hide play/pause controls and badges on side cards for a clean visual look */
.coverflow-card:not(.is-active) .card-top-bar {
  opacity: 0;
  pointer-events: none;
}

/* Bottom info strip on the card */
.card-bottom-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 14px 14px 14px;
  background: linear-gradient(180deg, transparent 0%, rgba(10, 8, 20, 0.88) 50%, rgba(10, 8, 20, 0.98) 100%);
  z-index: 10;
  pointer-events: none;
}

.card-title-text {
  font-family: var(--font-display, 'Space Grotesk', sans-serif);
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.3;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-sub-text {
  font-size: 11px;
  font-weight: 600;
  color: #A3B1A8;
  margin-top: 3px;
}

/* Side navigation arrows */
.coverflow-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(20, 27, 23, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 30;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
  transition: all 0.22s ease;
}

.coverflow-nav-arrow.prev { left: 18px; }
.coverflow-nav-arrow.next { right: 18px; }

.coverflow-nav-arrow:hover {
  background: #D4F644;
  color: #000000;
  border-color: #D4F644;
  transform: translateY(-50%) scale(1.12);
  box-shadow: 0 0 25px rgba(212, 246, 68, 0.6);
}

/* Carousel Counter indicator below stage */
.coverflow-counter-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 0 4px 0;
  z-index: 10;
  position: relative;
}

.coverflow-counter-badge {
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 0.05em;
}

/* ============================================================
   MOBILE PERFORMANCE & RESPONSIVE ADAPTATION (<= 768px)
   Desktop (>= 769px) styles remain 100% untouched
   ============================================================ */
@media (max-width: 768px) {
  .code-carousel-wrapper {
    margin: 12px 0 24px 0;
    border-radius: 20px;
    padding: 6px 0 10px 0;
  }
  .coverflow-container {
    max-width: 100%;
    height: 400px;
    perspective: 750px;
    touch-action: pan-y;
  }
  .coverflow-ambient-glow {
    width: 280px;
    height: 280px;
    filter: blur(60px);
    opacity: 0.35;
  }
  .coverflow-card {
    width: min(230px, 68vw);
    height: 360px;
    will-change: auto; /* Prevent VRAM layer explosion on mobile */
  }
  .coverflow-card.is-active {
    will-change: transform;
  }
  .card-glass-panel {
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.65);
  }
  .coverflow-card.is-active .card-glass-panel {
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.75), 0 0 24px rgba(123, 69, 255, 0.3);
  }
  .coverflow-nav-arrow {
    width: 42px;
    height: 42px;
  }
  .coverflow-nav-arrow.prev { left: 6px; }
  .coverflow-nav-arrow.next { right: 6px; }
}

@media (max-width: 480px) {
  .coverflow-container {
    height: 365px;
  }
  .coverflow-card {
    width: min(210px, 66vw);
    height: 330px;
  }
  .card-bottom-info {
    padding: 18px 10px 10px 10px;
  }
  .card-title-text {
    font-size: 12px;
  }
  .card-sub-text {
    font-size: 10px;
  }
  .coverflow-nav-arrow {
    width: 38px;
    height: 38px;
  }
  .coverflow-nav-arrow.prev { left: 4px; }
  .coverflow-nav-arrow.next { right: 4px; }
}

/* Compact Smartphones (320px - 375px) */
@media (max-width: 375px) {
  .coverflow-container {
    height: 330px;
  }
  .coverflow-card {
    width: 185px;
    height: 295px;
  }
  .card-top-bar {
    top: 8px;
    left: 8px;
    right: 8px;
  }
  .card-quality-tag {
    font-size: 9px;
    padding: 3px 7px;
  }
  .card-sound-btn {
    width: 28px;
    height: 28px;
  }
  .card-title-text {
    font-size: 11px;
  }
  .card-sub-text {
    font-size: 9px;
  }
  .coverflow-nav-arrow {
    width: 34px;
    height: 34px;
  }
  .coverflow-nav-arrow.prev { left: 2px; }
  .coverflow-nav-arrow.next { right: 2px; }
}

/* Touch devices: disable hover transforms */
@media (hover: none) {
  .coverflow-nav-arrow:hover {
    transform: translateY(-50%) !important;
    background: rgba(22, 17, 38, 0.85) !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6) !important;
  }
  .card-sound-btn:hover {
    transform: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .coverflow-card {
    transition: none !important;
  }
  .coverflow-ambient-glow {
    transition: none !important;
  }
}
