/* --- MASTER DESIGN SYSTEM (GLOBAL VARIABLES) --- */
:root {
  /* 1. Backgrounds & Core Colors */
  --bg-dark: #09090B;        
  --bg-card: #150a21;        
  --primary: #9333ea;
  --primary-hover: #a855f7;
  --accent: #d8b4fe;
  
  /* 2. Text Colors */
  --text-main: #ffffff;
  --text-dim: #a1a1aa;
  
  /* 3. Glassmorphism & Borders */
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.05);
  --glass-hover: rgba(255, 255, 255, 0.08);
  --glass-blur: blur(12px);
  
  /* 4. Shadows & Glows */
  --glow-subtle: 0 4px 12px rgba(147, 51, 234, 0.15);
  --glow-hover: 0 10px 20px rgba(147, 51, 234, 0.25), 0 0 10px rgba(147, 51, 234, 0.1);
  --shadow-base: 0 4px 15px rgba(0, 0, 0, 0.3);
  --shadow-heavy: 0 10px 30px rgba(0, 0, 0, 0.8);
  --text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  
  /* 5. Gradients */
  --gradient-text: linear-gradient(90deg, #c084fc, #e879f9);
  --hero-overlay: linear-gradient(0deg, var(--bg-dark) 0%, rgba(9, 9, 11, 0.6) 40%, rgba(9, 9, 11, 0.1) 100%);
  
  /* NEW: Primary Button Gradient */
  --btn-gradient: linear-gradient(135deg, #9333ea 0%, #c084fc 100%);
  --btn-gradient-hover: linear-gradient(135deg, #a855f7 0%, #d8b4fe 100%);
  
  /* 6. Header States */
  --header-solid: var(--bg-dark);
  --header-scrolled: rgba(9, 9, 11, 0.85);

  /* 7. Badges */
  --badge-star: #facc15;
  --badge-quality-bg: var(--text-main);
  --badge-quality-text: #000000;
  --badge-sub-bg: rgba(236, 72, 153, 0.15);
  --badge-sub-text: #f472b6;
  --badge-sub-border: rgba(236, 72, 153, 0.3);
  --badge-dub-bg: rgba(59, 130, 246, 0.15);
  --badge-dub-text: #60a5fa;
  --badge-dub-border: rgba(59, 130, 246, 0.3);
}

/* --- UNIVERSAL RESET --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  text-decoration: none;
  color: inherit;
}

/* --- GLOBAL BUTTON COMPONENTS --- */
.btn-primary {
  background: var(--btn-gradient); /* Uses the new gradient variable */
  color: var(--text-main);
  padding: 14px 28px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  transition: 0.3s ease;
  box-shadow: 0 4px 15px rgba(147, 51, 234, 0.25); /* Built-in subtle glow */
}

.btn-primary:hover {
  background: var(--btn-gradient-hover); /* Lighter gradient on hover */
  box-shadow: var(--glow-hover);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--glass-bg);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
  padding: 14px 24px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  backdrop-filter: var(--glass-blur);
  transition: 0.3s ease;
}

.btn-secondary:hover {
  background: var(--glass-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

/* --- GLOBAL BADGE COMPONENTS --- */
.meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 25px;
}

.badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-star { color: var(--badge-star); font-size: 14px; display: flex; align-items: center; gap: 4px; font-weight: 700; }
.badge-quality { background: var(--badge-quality-bg); color: var(--badge-quality-text); }
.badge-sub { background: var(--badge-sub-bg); color: var(--badge-sub-text); border: 1px solid var(--badge-sub-border); }
.badge-dub { background: var(--badge-dub-bg); color: var(--badge-dub-text); border: 1px solid var(--badge-dub-border); }
/* --- GLOBAL NGD CARD COMPONENT (OTT STYLE) --- */
.ngd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 20px 15px;
}

.ngd-card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 2/3;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  background: var(--bg-card);
}

.ngd-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--glow-hover);
  border-color: var(--primary-hover);
}

.ngd-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.ngd-card:hover img {
  transform: scale(1.05);
}

/* The dark fade at the bottom to make text readable */
.ngd-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(9, 9, 11, 0.95) 0%, rgba(9, 9, 11, 0.4) 35%, transparent 60%);
  pointer-events: none;
  z-index: 1;
}

/* Title placed over the gradient */
.ngd-card-title {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  z-index: 2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

/* Dynamic Label (Anime, Series, etc.) */
.ngd-card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  z-index: 2;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.1);
}

/* Delete Button for Bookmarks */
.ngd-card-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(239, 68, 68, 0.8);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: 0.2s;
}

.ngd-card-remove:hover {
  background: #ef4444;
  transform: scale(1.1);
}

@media (max-width: 600px) {
  .ngd-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }
}