/* ===== ANIMEX — MAIN STYLES ===== */
:root {
  --bg: #080c14;
  --bg2: #0d1420;
  --bg3: #131b2e;
  --card: #111827;
  --border: #1e2d45;
  --accent: #e63946;
  --accent2: #ff6b35;
  --gold: #ffd700;
  --text: #e8edf5;
  --text2: #8899b4;
  --text3: #4a5d7a;
  --font-display: 'Bebas Neue', cursive;
  --font-body: 'Rajdhani', sans-serif;
  --font-jp: 'Noto Sans JP', sans-serif;
  --radius: 8px;
  --shadow: 0 8px 32px rgba(0,0,0,0.6);
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; font-family: var(--font-body); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ===== PAGE LOADER ===== */
.page-loader {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  transition: opacity 0.5s, visibility 0.5s;
}
.page-loader.hidden { opacity: 0; visibility: hidden; }
.loader-logo {
  font-family: var(--font-display);
  font-size: 3rem;
  letter-spacing: 4px;
  color: var(--text);
}
.loader-logo span { color: var(--accent); }
.loader-bar {
  width: 200px; height: 3px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.loader-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 3px;
  animation: loadBar 1.5s ease-in-out forwards;
}
@keyframes loadBar { from { width: 0; } to { width: 100%; } }

/* ===== NAVBAR ===== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 1000;
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  background: linear-gradient(to bottom, rgba(8,12,20,0.98), rgba(8,12,20,0));
  transition: background var(--transition), box-shadow var(--transition);
}
.navbar.scrolled {
  background: rgba(8,12,20,0.98);
  box-shadow: 0 2px 20px rgba(0,0,0,0.5);
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: 2rem;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}
.logo {
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}
.logo span { color: var(--accent); }

.nav-search {
  flex: 1;
  max-width: 400px;
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 40px;
  overflow: visible;
  transition: border-color var(--transition);
}
.nav-search:focus-within { border-color: var(--accent); }
.nav-search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  padding: 0.5rem 1rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.nav-search input::placeholder { color: var(--text3); }
.nav-search button {
  background: none;
  padding: 0.5rem 1rem;
  color: var(--text2);
  display: flex;
  align-items: center;
}
.nav-search button svg { width: 18px; height: 18px; }
.nav-search button:hover { color: var(--accent); }

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 400px;
  overflow-y: auto;
  display: none;
  z-index: 200;
  box-shadow: var(--shadow);
}
.search-dropdown.show { display: block; }
.search-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  transition: background var(--transition);
  cursor: pointer;
}
.search-item:hover { background: var(--bg2); }
.search-item img {
  width: 40px; height: 56px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.search-item-info { flex: 1; min-width: 0; }
.search-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-item-sub { font-size: 0.75rem; color: var(--text2); }

.nav-links { display: flex; gap: 1.5rem; }
.nav-links a {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: color var(--transition);
}
.nav-links a:hover, .nav-links a.active { color: var(--accent); }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  margin-left: auto;
}
.hamburger span {
  display: block;
  width: 24px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 64px; left: 0; right: 0;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  z-index: 999;
  flex-direction: column;
  gap: 1rem;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text2);
}

/* ===== HERO ===== */
.hero {
  position: relative;
  height: 85vh;
  min-height: 500px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center top;
  transform: scale(1.05);
  transition: all 0.8s ease;
}
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(
    to right,
    rgba(8,12,20,0.95) 30%,
    rgba(8,12,20,0.5) 60%,
    rgba(8,12,20,0.1) 100%
  ),
  linear-gradient(
    to top,
    rgba(8,12,20,1) 0%,
    transparent 60%
  );
}
.hero-content {
  position: relative;
  z-index: 2;
  padding: 0 4rem 5rem;
  max-width: 650px;
  animation: heroFadeIn 0.8s ease forwards;
}
@keyframes heroFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.hero-badge {
  display: inline-block;
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 3px;
  padding: 4px 12px;
  border-radius: 2px;
  margin-bottom: 1rem;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  line-height: 1;
  letter-spacing: 2px;
  margin-bottom: 1rem;
  text-shadow: 0 2px 20px rgba(0,0,0,0.5);
}
.hero-desc {
  font-size: 0.95rem;
  color: var(--text2);
  margin-bottom: 1.2rem;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-meta {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  color: var(--text2);
  flex-wrap: wrap;
}
.hero-meta .score {
  color: var(--gold);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}
.hero-meta .tag {
  background: var(--bg3);
  border: 1px solid var(--border);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
}
.hero-actions { display: flex; gap: 1rem; }

.btn-watch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent);
  color: white;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 0.8rem 2rem;
  border-radius: var(--radius);
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-watch:hover {
  background: #c1121f;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(230,57,70,0.4);
}
.btn-watch svg { width: 20px; height: 20px; }
.btn-watch.full-width { width: 100%; justify-content: center; }

.btn-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.15);
  transition: all var(--transition);
}
.btn-info:hover { background: rgba(255,255,255,0.2); }
.btn-info svg { width: 20px; height: 20px; }

.hero-dots {
  position: absolute;
  bottom: 2.5rem;
  right: 3rem;
  display: flex;
  gap: 8px;
  z-index: 2;
}
.hero-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text3);
  cursor: pointer;
  transition: all var(--transition);
}
.hero-dot.active { background: var(--accent); width: 24px; border-radius: 4px; }

/* ===== SECTIONS ===== */
.section {
  padding: 2.5rem 3rem;
  max-width: 1400px;
  margin: 0 auto;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.section-header h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: 2px;
}
.see-all {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: color var(--transition);
}
.see-all:hover { color: var(--accent2); }

/* ===== ANIME ROW (horizontal scroll) ===== */
.anime-row {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.anime-row::-webkit-scrollbar { height: 4px; }

/* ===== ANIME CARD ===== */
.anime-card {
  flex-shrink: 0;
  width: 160px;
  cursor: pointer;
  transition: transform var(--transition);
}
.anime-card:hover { transform: translateY(-4px); }
.anime-card:hover .card-overlay { opacity: 1; }

.card-poster {
  position: relative;
  width: 160px;
  height: 225px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg3);
  margin-bottom: 0.5rem;
}
.card-poster img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.anime-card:hover .card-poster img { transform: scale(1.05); }

.card-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
  border-radius: var(--radius);
}
.play-icon {
  width: 52px; height: 52px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.play-icon svg { width: 22px; height: 22px; fill: white; }

.card-score {
  position: absolute;
  top: 8px; left: 8px;
  background: rgba(0,0,0,0.75);
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.card-ep-badge {
  position: absolute;
  bottom: 8px; right: 8px;
  background: var(--accent);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}
.card-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-sub {
  font-size: 0.75rem;
  color: var(--text2);
  margin-top: 2px;
}

/* ===== ANIME GRID (full) ===== */
.anime-grid-full {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.2rem;
}

/* ===== LOADING SKELETON ===== */
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--border) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ===== FOOTER ===== */
.footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding: 3rem 2rem;
  text-align: center;
}
.footer-inner { max-width: 600px; margin: 0 auto; }
.footer-logo {
  font-family: var(--font-display);
  font-size: 2rem;
  letter-spacing: 3px;
  margin-bottom: 0.75rem;
}
.footer-logo span { color: var(--accent); }
.footer p { color: var(--text2); font-size: 0.85rem; margin-bottom: 1rem; }
.footer-links { display: flex; justify-content: center; gap: 2rem; margin-bottom: 1rem; }
.footer-links a { color: var(--text2); font-size: 0.85rem; font-weight: 600; transition: color var(--transition); }
.footer-links a:hover { color: var(--accent); }
.footer-copy { color: var(--text3) !important; font-size: 0.75rem !important; }

/* ===== GENRES PAGE ===== */
.genres-page {
  padding: 100px 3rem 4rem;
  max-width: 1400px;
  margin: 0 auto;
}
.page-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  letter-spacing: 3px;
  margin-bottom: 2.5rem;
}
.page-title::after {
  content: '';
  display: block;
  width: 60px; height: 3px;
  background: var(--accent);
  margin-top: 8px;
  border-radius: 2px;
}
.genres-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 3rem;
}
.genre-card {
  padding: 1.5rem 1rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 600;
  letter-spacing: 1px;
}
.genre-card:hover {
  border-color: var(--accent);
  background: var(--bg2);
  transform: translateY(-2px);
  color: var(--accent);
}
.genre-card .genre-emoji { font-size: 1.8rem; margin-bottom: 0.5rem; }
.genre-results { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.btn-load-more {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 0.75rem 3rem;
  border-radius: var(--radius);
  transition: all var(--transition);
}
.btn-load-more:hover { border-color: var(--accent); color: var(--accent); }
.load-more-wrap { text-align: center; margin-top: 2.5rem; }

/* ===== DETAIL PAGE ===== */
.detail-page { padding-top: 64px; }
.detail-banner {
  position: relative;
  height: 350px;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.detail-banner-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(8,12,20,0.4), var(--bg));
}
.detail-content {
  display: flex;
  gap: 2.5rem;
  padding: 0 3rem;
  max-width: 1200px;
  margin: 0 auto;
  margin-top: -120px;
  position: relative;
  z-index: 2;
}
.detail-poster-col {
  flex-shrink: 0;
  width: 220px;
}
.detail-poster {
  width: 220px; height: 310px;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.detail-info-col { flex: 1; padding-top: 80px; }
.detail-badge {
  display: inline-block;
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 4px 12px;
  border-radius: 2px;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}
.detail-badge.airing { background: #22c55e; }
.detail-badge.finished { background: var(--text3); }
.detail-info-col h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 3rem);
  letter-spacing: 2px;
  margin-bottom: 0.25rem;
}
.detail-alt { color: var(--text2); font-size: 0.9rem; margin-bottom: 1rem; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; }
.detail-tag {
  background: var(--bg3);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.detail-tag:hover { border-color: var(--accent); color: var(--accent); }

.detail-stats {
  display: flex;
  gap: 2rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.stat-item { text-align: center; }
.stat-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--accent);
  letter-spacing: 1px;
}
.stat-label { font-size: 0.72rem; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; }

.detail-description {
  color: var(--text2);
  line-height: 1.8;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  max-width: 700px;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  max-width: 500px;
}
.detail-row { display: flex; flex-direction: column; }
.detail-row-label { font-size: 0.72rem; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; }
.detail-row-value { font-size: 0.9rem; font-weight: 600; }

/* ===== SPINNER ===== */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .hero-content { padding: 0 1.5rem 4rem; }
  .section { padding: 2rem 1.5rem; }
  .detail-content { flex-direction: column; align-items: center; padding: 0 1.5rem; }
  .detail-info-col { padding-top: 0; text-align: center; }
  .detail-tags { justify-content: center; }
  .detail-stats { justify-content: center; }
  .genres-page { padding: 90px 1.5rem 3rem; }
}
@media (max-width: 600px) {
  .hero { height: 70vh; }
  .hero-title { font-size: 2.2rem; }
  .anime-card { width: 130px; }
  .card-poster { width: 130px; height: 185px; }
  .navbar { padding: 0 1rem; }
  .nav-search { max-width: 200px; }
}
