/* ==========================================================================
   SCROLLTIDE 3D & CINEMATIC CATEGORY ANIMATION SUITE
   Includes: Fan Deck, Fan Carousel, Arc Carousel, Spotlight Carousel, Media Gallery
   ========================================================================== */

:root {
  --cat-gold-glow: rgba(212, 175, 55, 0.35);
  --cat-card-bg: rgba(18, 18, 22, 0.92);
  --cat-border: rgba(255, 255, 255, 0.1);
  --cat-active-border: var(--gold, #D4AF37);
  --cat-font: var(--font, "Cairo", sans-serif);
}

/* Base Bar Height Adjustments for 3D Layouts */
.categories-bar.cat-layout-3d {
  position: relative;
  overflow: hidden !important;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 10px 0 18px 0;
  min-height: 190px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  contain: paint layout;
}

.categories-3d-wrapper {
  position: relative;
  width: 100%;
  max-width: 100vw;
  overflow: hidden !important;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .categories-bar.cat-layout-3d {
    min-height: 175px;
    padding: 8px 0 14px 0;
  }
}

/* Navigation Arrows for 3D Carousels */
.cat-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(18, 18, 22, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: #ffffff;
  font-size: 20px;
  cursor: pointer;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  outline: none;
}

.cat-nav-arrow:hover {
  background: var(--gold, #D4AF37);
  color: #000000;
  border-color: var(--gold, #D4AF37);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 0 20px var(--cat-gold-glow);
}

.cat-nav-arrow.prev { right: 12px; }
.cat-nav-arrow.next { left: 12px; }

@media (max-width: 480px) {
  .cat-nav-arrow {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
  .cat-nav-arrow.prev { right: 6px; }
  .cat-nav-arrow.next { left: 6px; }
}

/* Generic Category 3D Card */
.cat-3d-card {
  position: relative;
  border-radius: 16px;
  background: var(--cat-card-bg);
  border: 1.5px solid var(--cat-border);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 10px 12px;
  transition: transform 0.42s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.35s ease,
              border-color 0.35s ease,
              opacity 0.35s ease,
              width 0.42s cubic-bezier(0.16, 1, 0.3, 1);
  touch-action: pan-y;
  will-change: transform, opacity;
  box-sizing: border-box;
}

.cat-3d-card:hover {
  border-color: rgba(212, 175, 55, 0.5);
}

.cat-3d-card.active {
  border-color: var(--gold, #D4AF37) !important;
  box-shadow: 0 16px 36px var(--cat-gold-glow), 0 0 0 1.5px var(--gold, #D4AF37) !important;
}

/* Card Visual Backdrop Image */
.cat-card-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1;
}

.cat-3d-card:hover .cat-card-bg-img {
  transform: scale(1.08);
}

.cat-3d-card.active .cat-card-bg-img {
  transform: scale(1.05);
}

/* Card Gradient Overlay */
.cat-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10, 10, 12, 0.94) 0%, rgba(10, 10, 12, 0.6) 45%, rgba(0, 0, 0, 0.15) 100%);
  z-index: 2;
  transition: background 0.3s ease;
}

.cat-3d-card.active .cat-card-overlay {
  background: linear-gradient(to top, rgba(10, 10, 12, 0.96) 0%, rgba(20, 18, 10, 0.55) 50%, rgba(212, 175, 55, 0.15) 100%);
}

/* Card Floating Icon Pill */
.cat-card-icon-pill {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all 0.3s ease;
}

.cat-3d-card.active .cat-card-icon-pill {
  background: var(--gold, #D4AF37);
  color: #000;
  border-color: var(--gold, #D4AF37);
  box-shadow: 0 4px 12px var(--cat-gold-glow);
}

.cat-card-icon-pill img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

/* Card Content Area */
.cat-card-content {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: right;
}

.cat-card-title {
  font-family: var(--cat-font);
  font-weight: 800;
  font-size: 0.92rem;
  color: #ffffff;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
  transition: color 0.25s ease;
}

.cat-3d-card.active .cat-card-title {
  color: var(--gold-light, #F0D060);
}

.cat-card-count {
  font-size: 0.72rem;
  color: #bbb;
  font-weight: 600;
}

.cat-3d-card.active .cat-card-count {
  color: #f5f5f5;
}

/* ==========================================================================
   1. FAN DECK (مروحة البطاقات ثلاثية الأبعاد)
   ========================================================================== */
.fan-deck-stage {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 175px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  perspective: 1200px;
  overflow: hidden;
  box-sizing: border-box;
  padding-bottom: 8px;
}

.fan-deck-track {
  position: relative;
  width: 100%;
  max-width: 550px;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.fan-deck-stage .cat-3d-card {
  position: absolute;
  bottom: 0;
  width: 112px;
  height: 148px;
  transform-origin: 50% 135%;
  border-radius: 18px;
}

.fan-deck-stage .cat-3d-card.active {
  transform: translateY(-22px) rotate(0deg) scale(1.15) !important;
  z-index: 60 !important;
}

@media (max-width: 480px) {
  .fan-deck-stage {
    height: 155px;
  }
  .fan-deck-stage .cat-3d-card {
    width: 98px;
    height: 135px;
  }
  .fan-deck-stage .cat-3d-card.active {
    transform: translateY(-16px) rotate(0deg) scale(1.14) !important;
  }
}

/* ==========================================================================
   2. FAN CAROUSEL (كاروسيل المروحة الدائري)
   ========================================================================== */
.fan-carousel-stage {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 175px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1000px;
  overflow: hidden;
  box-sizing: border-box;
}

.fan-carousel-track {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.fan-carousel-stage .cat-3d-card {
  position: absolute;
  width: 110px;
  height: 145px;
  border-radius: 16px;
}

.fan-carousel-stage .cat-3d-card.active {
  transform: translateY(-14px) rotate(0deg) scale(1.16) !important;
  z-index: 50 !important;
}

@media (max-width: 480px) {
  .fan-carousel-stage {
    height: 155px;
  }
  .fan-carousel-stage .cat-3d-card {
    width: 96px;
    height: 132px;
  }
}

/* ==========================================================================
   3. ARC CAROUSEL (كاروسيل القوس المنحني)
   ========================================================================== */
.arc-carousel-stage {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 185px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  perspective: 1200px;
  overflow: hidden;
  box-sizing: border-box;
  padding-bottom: 6px;
}

.arc-carousel-track {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.arc-carousel-stage .cat-3d-card {
  position: absolute;
  bottom: 0;
  width: 115px;
  height: 146px;
  border-radius: 18px;
}

.arc-carousel-stage .cat-3d-card.active {
  z-index: 50 !important;
}

/* Glowing arch guide line */
.arc-guide-glow {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 85%;
  max-width: 500px;
  height: 2px;
  background: radial-gradient(ellipse at center, var(--gold, #D4AF37) 0%, rgba(212, 175, 55, 0.2) 60%, transparent 80%);
  filter: blur(1px);
  pointer-events: none;
  z-index: 1;
}

@media (max-width: 480px) {
  .arc-carousel-stage {
    height: 160px;
  }
  .arc-carousel-stage .cat-3d-card {
    width: 98px;
    height: 132px;
  }
}

/* ==========================================================================
   4. SPOTLIGHT CAROUSEL (كاروسيل سبوت لايت المضيء)
   ========================================================================== */
.spotlight-stage {
  position: relative;
  width: 100%;
  min-height: 165px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 10px 0;
}

.spotlight-beam-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 320px;
  height: 220px;
  background: radial-gradient(circle, var(--cat-gold-glow) 0%, rgba(212, 175, 55, 0.08) 45%, transparent 70%);
  filter: blur(25px);
  pointer-events: none;
  z-index: 1;
  animation: spotlightPulse 3s ease-in-out infinite alternate;
}

@keyframes spotlightPulse {
  0% { opacity: 0.7; transform: translate(-50%, -50%) scale(0.95); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

.spotlight-track {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 2;
  width: 100%;
}

.spotlight-stage .cat-3d-card {
  width: 92px;
  height: 142px;
  flex-shrink: 0;
  opacity: 0.65;
  transform: scale(0.9);
}

.spotlight-stage .cat-3d-card:hover {
  opacity: 0.9;
  transform: scale(0.95);
}

.spotlight-stage .cat-3d-card.active {
  width: 210px !important;
  opacity: 1 !important;
  transform: scale(1.08) !important;
  z-index: 30 !important;
  border-color: var(--gold, #D4AF37) !important;
  box-shadow: 0 14px 40px var(--cat-gold-glow), 0 0 15px rgba(212, 175, 55, 0.4) !important;
}

.spotlight-stage .cat-3d-card.active .cat-card-title {
  font-size: 1.05rem;
}

@media (max-width: 480px) {
  .spotlight-stage .cat-3d-card {
    width: 78px;
    height: 128px;
  }
  .spotlight-stage .cat-3d-card.active {
    width: 175px !important;
    transform: scale(1.05) !important;
  }
}

/* ==========================================================================
   5. MEDIA GALLERY 3D (معرض الميديا البانورامي)
   ========================================================================== */
.media-gallery-stage {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 175px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1100px;
  overflow: hidden;
  box-sizing: border-box;
}

.media-gallery-track {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  width: 100%;
  height: 100%;
}

.media-gallery-stage .cat-3d-card {
  position: absolute;
  width: 114px;
  height: 148px;
  border-radius: 18px;
  transform-style: preserve-3d;
}

.media-gallery-stage .cat-3d-card.active {
  transform: rotateY(0deg) translateZ(45px) scale(1.12) !important;
  z-index: 50 !important;
  box-shadow: 0 20px 45px var(--cat-gold-glow), 0 0 20px rgba(212, 175, 55, 0.3) !important;
}

@media (max-width: 480px) {
  .media-gallery-stage {
    height: 155px;
  }
  .media-gallery-stage .cat-3d-card {
    width: 98px;
    height: 134px;
  }
  .media-gallery-stage .cat-3d-card.active {
    transform: rotateY(0deg) translateZ(35px) scale(1.1) !important;
  }
}

/* Pagination Dots Indicator */
.cat-pagination-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}

.cat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.25s ease;
}

.cat-dot.active {
  width: 18px;
  border-radius: 10px;
  background: var(--gold, #D4AF37);
  box-shadow: 0 0 8px var(--cat-gold-glow);
}
