/* ====== RESET & FONT ====== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

body {
  background: url("https://i.pinimg.com/1200x/ca/92/30/ca923012f2da62ba5ba20a99e6c0ff91.jpg") no-repeat center center/cover;
  background-size: 1920px auto;
  background-attachment: fixed;
  min-height: 100vh;
  color: white;
  overflow-x: hidden;
  position: relative;
  padding-top: 100px;
}

/* Overlay gelap — FIXED position & NO blur agar teks section tetap tajam */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.55);
  z-index: 0;
}

/* ====== ANIMATED BACKGROUND ORBS ====== */
body::after {
  content: "";
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(75, 177, 255, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(160, 100, 255, 0.07) 0%, transparent 55%),
    radial-gradient(ellipse at 60% 80%, rgba(0, 200, 180, 0.06) 0%, transparent 50%);
  animation: bgShift 12s ease-in-out infinite alternate;
  z-index: 0;
  pointer-events: none;
}

@keyframes bgShift {
  0%   { opacity: 1; transform: scale(1) translateX(0px); }
  33%  { opacity: 0.7; transform: scale(1.05) translateX(15px); }
  66%  { opacity: 0.9; transform: scale(0.97) translateX(-10px); }
  100% { opacity: 1; transform: scale(1.03) translateX(8px); }
}

/* ====== FLOATING PARTICLES ====== */
.particle {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  animation: floatUp linear infinite;
  opacity: 0;
}

@keyframes floatUp {
  0%   { transform: translateY(100vh) translateX(0px);  opacity: 0; }
  10%  { opacity: 1; }
  50%  { transform: translateY(50vh)  translateX(30px); opacity: 1; }
  90%  { opacity: 0.8; }
  100% { transform: translateY(-100px) translateX(-20px); opacity: 0; }
}

/* ====== NAVBAR ====== */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 50px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  font-size: 1.6rem;
  font-weight: bold;
  text-decoration: none;
}

.logo a, .logo {
  color: #ffffff;
  font-size: 1.6rem;
  font-weight: bold;
  text-decoration: none;
}

.logo-img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 50%;
  background-color: #0b0b15;
  box-shadow: 0 0 8px rgba(0, 50, 200, 0.5);
  filter: drop-shadow(0 0 4px rgba(0, 0, 50, 0.6));
  transition: all 0.3s ease;
}

.logo-img:hover {
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(0, 150, 255, 0.8);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 25px;
}

.nav-links a {
  text-decoration: none;
  color: #fff;
  transition: 0.3s;
  font-weight: 500;
}

.nav-links a:hover {
  color: #ffd700;
}

.nav-links .active {
  color: #ffffff;
  font-weight: bold;
}

.logout-btn {
  background: rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: 6px;
}

.logout-btn:hover {
  background: #4bb1ff;
}

/* Navbar favorites counter */
.nav-fav {
  position: relative;
  display: inline-grid;
  place-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
}

.nav-fav .count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ff6b9a;
  color: #fff;
  font-size: 11px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

/* ====== HERO SECTION ====== */
.hero {
  height: 35vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  z-index: 1;
}

.hero-overlay {
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(5px);
  padding: 24px 40px;
  border-radius: 20px;
}

.hero h1 {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.hero p {
  font-size: 0.95rem;
  color: #ddd;
}

/* ====== SEARCH BAR ====== */
.search-center {
  text-align: center;
  margin: 2px 0 5px 0;
  position: relative;
  z-index: 1;
}

.search-center form {
  display: inline-block;
}

#search-input {
  box-sizing: border-box;
  width: 65%;
  max-width: 1800px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  padding: 10px 15px;
  font-size: 1rem;
  color: #fff;
  backdrop-filter: blur(10px);
  transition: width 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

#search-input:focus {
  width: 100%;
  max-width: 1800px;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
  box-shadow: 0 0 10px rgba(100, 150, 255, 0.4);
}

/* ====== ANIME CONTAINER ====== */
.anime-container {
  padding: 20px 0 60px;
  position: relative;
  z-index: 1;
}

/* ====== KATEGORI SECTION ====== */
.category {
  margin-bottom: 32px;
  padding: 0 20px;
}

.category h2 {
  font-size: 1.2em;
  margin-bottom: 12px;
  padding-left: 10px;
  border-left: 4px solid #ffd700;
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0,0,0,0.9);
  position: relative;
  z-index: 2;
}

/* ====== ANIME SCROLL ROW ====== */
.anime-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 4px 4px 10px 4px;
}

.anime-row::-webkit-scrollbar {
  height: 8px;
}

.anime-row::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 10px;
}

/* ====== ANIME CARD ====== */
.anime-card {
  flex: 0 0 auto;
  width: 140px;
  height: 200px;
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

.anime-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
}

.anime-card:hover {
  transform: scale(1.08);
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.3);
}

/* ====== ANIME TITLE OVERLAY ====== */
.anime-title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  text-align: center;
  font-size: 15px;
  padding: 8px 6px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.anime-card:hover .anime-title {
  opacity: 1;
  transform: translateY(0);
  color: #ffffff;
}

/* ====== FAVORITE BUTTON ====== */
.fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.3s;
  z-index: 5;
  color: white;
}

.fav-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  background: rgba(255, 80, 100, 0.4);
}

.fav-btn i {
  pointer-events: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 16px;
  transition: color 0.18s ease, text-shadow 0.18s ease;
}

.fav-btn.favorited,
.fav-btn.active {
  background: linear-gradient(135deg, #ff6b9a, #ff8fb3);
  border-color: rgba(255, 255, 255, 0.18);
}

.fav-btn.favorited i,
.fav-btn.active i {
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 140, 170, 0.45);
}

/* ====== RECOMMENDED HEADER (Random Anime) ====== */
.recommended-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 0;
}

.recommended-header h2 {
  margin-bottom: 0;
}

#refreshRandomBtn {
  background: transparent;
  border: none;
  color: #4bb1ff;
  font-size: 20px;
  cursor: pointer;
  transition: 0.3s;
  padding: 6px;
  border-radius: 6px;
}

#refreshRandomBtn:hover {
  color: #ffffff;
  transform: scale(1.1);
}

#refreshRandomBtn.rotate i {
  animation: spin 0.6s linear;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ====== GENRE CONTAINER ====== */
.genre-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 20px;
  padding: 50px;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 2;
}

.genre-card {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-align: center;
  padding: 40px 0;
  border-radius: 15px;
  font-size: 1.2em;
  font-weight: 500;
  letter-spacing: 1px;
  transition: all 0.3s ease;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.genre-card:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

/* ====== FAVORITES LIST PAGE ====== */
.favorites-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 18px;
  padding: 24px;
}

.fav-card {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
}

.fav-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.fav-card p {
  margin-top: 8px;
  font-size: 0.95rem;
  color: #fff;
}

/* ====== ABOUT SECTION ====== */
.about-section {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: #fff;
  position: relative;
  z-index: 1;
}

.about-container {
  max-width: 800px;
  background: rgba(255, 255, 255, 0.05);
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

.about-container h1 {
  color: #a0cfff;
  margin-bottom: 20px;
}

.about-container p {
  line-height: 1.6;
  margin-bottom: 15px;
  color: #ddd;
}

/* ====== FOOTER ====== */
footer {
  text-align: center;
  padding: 20px;
  color: #ccc;
  font-size: 0.9em;
  background: rgba(0, 0, 20, 0.7);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(6px);
  position: relative;
  z-index: 1;
}

/* ====== RESPONSIVE ====== */
@media (min-width: 769px) {
  body {
    padding-top: 75px;
  }
}

@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 10px;
    padding: 15px;
  }

  .anime-card {
    width: 120px;
    height: 175px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  #search-input {
    width: 70%;
    font-size: 0.95rem;
  }

  #search-input:focus {
    width: 80%;
  }
}

@media (max-width: 500px) {
  .hero {
    height: 40vh;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
  }
}