/* Animasi Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left-color: #ef4444;
  /* Merah Bunny Scans */
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Overlay untuk loading layar penuh (Opsional) */
.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  width: 100%;
}

/* Kontainer Utama Horizontal */
.horizontal-scroll-wrapper {
  position: relative;
  width: 100%;
}

.horizontal-scroll-container {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 16px;
  padding: 10px 5px 20px 5px;
  scroll-snap-type: x mandatory;
  /* Kartu akan 'menempel' saat di-scroll */
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Menghilangkan scrollbar default di Chrome/Safari */
.horizontal-scroll-container::-webkit-scrollbar {
  height: 6px;
}

.horizontal-scroll-container::-webkit-scrollbar-track {
  background: rgba(31, 41, 55, 0.5);
  border-radius: 10px;
}

.horizontal-scroll-container::-webkit-scrollbar-thumb {
  background: #ef4444;
  /* Merah Bunny Scans */
  border-radius: 10px;
  cursor: pointer;
}

/* Ukuran kartu tetap di mode horizontal */
.manga-card-horizontal {
  flex: 0 0 160px;
  /* Lebar kartu tetap 160px */
  scroll-snap-align: start;
  transition: transform 0.2s;
}

@media (min-width: 768px) {
  .manga-card-horizontal {
    flex: 0 0 200px;
    /* Lebar kartu di desktop 200px */
  }
}

/* Efek gradasi di ujung kanan untuk petunjuk scroll */
.horizontal-scroll-wrapper::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 50px;
  background: linear-gradient(to left, rgba(17, 24, 39, 0.8), transparent);
  pointer-events: none;
}

/* Tambahan untuk navigasi tombol */
.nav-scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: none;
  /* Sembunyikan di HP */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
}

.nav-scroll-btn:hover {
  background: #ef4444;
  /* Merah saat hover */
  border-color: #ef4444;
  scale: 1.1;
}

/* Tampilkan hanya di layar komputer (Desktop) */
@media (min-width: 1024px) {
  .nav-scroll-btn {
    display: flex;
  }
}

.btn-left {
  left: -20px;
}

.btn-right {
  right: -20px;
}

/* Pastikan wrapper punya overflow visible untuk tombol yang menonjol keluar */
.horizontal-scroll-wrapper {
  position: relative;
}

/* ---------------------- */
/* CSS POPULAR CAROUSEL */

.header-title {
  text-align: center;
}

.header-title h2 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.header-title span {
  background: linear-gradient(135deg, #ff4757, #ff6b81);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.carousel-container {
  width: 100%;
  max-width: 1200px;
  position: relative;
}

.swiper {
  width: 100%;
  padding: 20px 0 60px 0 !important; /* Tambah padding atas agar animasi lift-up tidak terpotong */
}

/* --- PREMIUM CARD DESIGN --- */
.popular-card {
  cursor: pointer;
  position: relative;
  background: #111116;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  height: 100%;
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.03);
  /* Efek transisi lentur (elastic spring effect) ketika di-hover */
  transition:
    transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.15),
    box-shadow 0.4s ease,
    border-color 0.4s ease;
}

.cover-wrapper {
  position: relative;
  width: 100%;
  padding-top: 142%;
  background: #181824;
}

.manga-cover {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

/* --- TRIGGER HOVER CARD (DESKTOP) --- */
.popular-card:hover {
  transform: translateY(-12px) scale(1.02); /* Card naik dan membesar sedikit */
  border-color: rgba(255, 71, 87, 0.4);
  /* Bayangan hitam pekat berpadu dengan aura merah neon tipis */
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.8),
    0 0 30px rgba(255, 71, 87, 0.15);
}

.popular-card:hover .manga-cover {
  transform: scale(1.08); /* Cover nge-zoom halus */
}

/* --- CINEMATIC GRADIENT & GLASS OVERLAY --- */
.manga-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* Gradient sinematik: agak transparan di atas, pekat di bawah */
  background: linear-gradient(
    180deg,
    rgba(11, 11, 16, 0.4) 0%,
    rgba(11, 11, 16, 0.98) 50%
  );
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 2;
}

.popular-card:hover .manga-overlay {
  opacity: 1;
}

/* --- STAGGERED ANIMATIONS SYSTEM --- */
/* Elemen default digeser ke bawah dan disembunyikan */
.manga-title,
.manga-synopsis,
.meta-container {
  transform: translateY(25px);
  opacity: 0;
  transition:
    transform 0.45s cubic-bezier(0.25, 1, 0.5, 1),
    opacity 0.45s ease;
}

/* Saat di-hover, muncul satu per satu berurutan menggunakan jeda delay */
.popular-card:hover .manga-title {
  transform: translateY(0);
  opacity: 1;
  transition-delay: 0.05s;
}

.popular-card:hover .manga-synopsis {
  transform: translateY(0);
  opacity: 1;
  transition-delay: 0.12s;
}

.popular-card:hover .meta-container {
  transform: translateY(0);
  opacity: 1;
  transition-delay: 0.18s;
}

/* --- TYPOGRAPHY & MINI BADGES --- */
.manga-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  color: #ffffff;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.manga-synopsis {
  font-size: 0.75rem;
  color: #a4a4b5;
  line-height: 1.45;
  display: -webkit-box;
  line-clamp: 5;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: left;
}

/* Container Badges */
.meta-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
}

/* Style Badge Status */
.status-badge {
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.06);
  color: #cccccc;
  padding: 5px 10px;
  border-radius: 6px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.08);
  letter-spacing: 0.3px;
}

/* Style Badge Chapter (Glow Premium) */
.chapter-badge {
  font-size: 0.7rem;
  background: linear-gradient(135deg, #ff4757, #ff6b81);
  color: #ffffff;
  padding: 5px 12px;
  border-radius: 6px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(255, 71, 87, 0.35);
  letter-spacing: 0.3px;
}

.swiper-pagination-bullet {
  background: #ffffffaa !important;
  opacity: 1;
}

.swiper-pagination-bullet-active {
  background: linear-gradient(135deg, #ff4757, #ff6b81) !important;
  width: 24px;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.loading {
  text-align: center;
  font-size: 1.1rem;
  color: #ff4757;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* --- 📱 BACK TO MOBILE CLEAN LOOK (ANTI-HOVER) --- */
@media (max-width: 768px) {
  /* body {
    padding: 40px 15px;
  } */

  .header-title h2 {
    font-size: 1.8rem;
  }

  .swiper {
    padding: 10px 0 50px 0 !important;
  }

  .popular-card {
    display: flex;
    flex-direction: column;
    border-radius: 12px;
  }

  .popular-card:hover {
    transform: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.03);
  }

  .manga-overlay {
    position: relative;
    opacity: 1 !important;
    background: #111116;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 12px;
    height: auto;
  }

  /* Matikan sistem pergeseran animasi di HP */
  .manga-title,
  .manga-synopsis,
  .meta-container {
    transform: none !important;
    opacity: 1 !important;
    transition: none !important;
  }

  .manga-synopsis {
    display: none;
  }

  .manga-title {
    font-size: 0.85rem;
    line-clamp: 1;
    -webkit-line-clamp: 1;
    margin-bottom: 8px;
  }

  .meta-container {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 8px;
  }

  .status-badge,
  .chapter-badge {
    font-size: 0.65rem;
    padding: 4px 8px;
    border-radius: 4px;
  }
}

/* Running Text */
/* css running text */
.breaking-news-ticker {
    position: relative; /* DIUBAH: dari 'fixed' menjadi 'relative' agar tidak ikut melayang saat di-scroll */
    width: 100%;
    height: 36px;
    background-color: #0f0f14;
    border-bottom: 1px solid rgba(255, 71, 87, 0.2);
    display: flex;
    align-items: center;
    overflow: hidden;
    z-index: 10; /* Diturunkan karena tidak perlu melayang di atas segalanya */
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

    /* Label Badge Merah ala Breaking News */
    .ticker-title {
        background: linear-gradient(135deg, #ff4757, #ff6b81);
        color: #ffffff;
        padding: 0 16px;
        height: 100%;
        display: flex;
        align-items: center;
        font-size: 1rem;
        font-weight: 800;
        letter-spacing: 1px;
        z-index: 10;
        box-shadow: 6px 0 15px rgba(0, 0, 0, 0.4);
        position: relative;
    }

    /* Area teks berjalan */
    .ticker-content {
        flex-grow: 1;
        overflow: hidden;
        display: flex;
        align-items: center;
    }

    .ticker-text {
        display: inline-block;
        white-space: nowrap;
        padding-left: 100%; /* Mulai berjalan dari ujung kanan luar layar */
        font-size: 0.8rem;
        font-weight: 500;
        color: #e2e2e9;
        letter-spacing: 0.2px;
        /* Menjalankan animasi bernama 'marquee' selama 25 detik secara berulang (infinite) */
        animation: marquee 25s linear infinite; 
    }

    /* Fitur Interaktif: Teks otomatis berhenti jalan saat kursor ditaruh di atasnya */
    .ticker-content:hover .ticker-text {
        animation-play-state: paused;
        cursor: pointer;
    }

    /* KEYFRAMES ANIMASI GERAKAN */
    @keyframes marquee {
        0% {
            transform: translate3d(0, 0, 0);
        }
        100% {
            transform: translate3d(-100%, 0, 0); /* Bergeser ke kiri hingga teks habis */
        }
    }
