/* ============================================================
   WatchLane — nav.css
   Navbar, Mega Menu, Search Expand, Mobile Overlay
   Import: tokens.css (sudah di-import di tokens.css)
   ============================================================ */

/* ── NAVBAR BASE ─────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 500;
  height: var(--nav-h);
  background: transparent;
  transition: background 0.3s ease, backdrop-filter 0.3s ease, border-bottom-color 0.3s ease;
  border-bottom: 1px solid transparent;
}

/* State setelah scroll > 80px (ditambahkan oleh JS) */
.navbar.scrolled {
  background: rgba(8, 9, 14, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--border);
}

/* ── NAV INNER CONTAINER ─────────────────────────────────── */
.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  height: 100%;
  gap: 32px;
}

/* ── LOGO ─────────────────────────────────────────────────── */
.nav-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.nav-logo img {
  height: 28px;
  width: auto;
  display: block;
}

/* ── NAV MENU (links kiri) ───────────────────────────────── */
.nav-menu {
  display: flex;
  gap: 4px;
  align-items: center;
  flex: 1;
}

/* ── NAV LINK ─────────────────────────────────────────────── */
.nav-link {
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  border-radius: var(--r-sm);
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: color 0.15s ease, background 0.15s ease;
  white-space: nowrap;
  position: relative;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-link:hover {
  color: var(--text-1);
  background: var(--surface-2);
}

/* Active state dengan garis merah di bawah */
.nav-link.active {
  color: var(--red);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 12px;
  right: 12px;
  height: 2px;
  background: var(--red);
  box-shadow: var(--red-shadow);
  border-radius: 2px;
}

/* ── NAV ITEM (wrapper untuk mega menu) ─────────────────── */
.nav-item {
  position: relative;
}

/* ── MEGA MENU ────────────────────────────────────────────── */
.mega-menu {
  display: none;
  position: absolute;
  top: calc(var(--nav-h) + 4px);
  left: 0;
  background: var(--surface-1);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-lg);
  padding: 24px;
  gap: 32px;
  min-width: 400px;
  box-shadow: var(--shadow-md);
  animation: slideDown 0.2s ease;
  z-index: 600;
}

/* Mega menu muncul saat hover parent item */
.nav-item.has-dropdown:hover .mega-menu,
.nav-item.has-dropdown:focus-within .mega-menu {
  display: flex;
}

/* Kolom dalam mega menu */
.mega-col {
  display: flex;
  flex-direction: column;
  min-width: 160px;
}

.mega-col h4 {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  margin-top: 16px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  font-family: 'Space Grotesk', sans-serif;
}

.mega-col h4:first-child {
  margin-top: 0;
}

.mega-col a {
  display: block;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.15s ease;
  line-height: 1.4;
}

.mega-col a:hover {
  color: var(--red);
}

/* ── NAV ACTIONS (kanan) ─────────────────────────────────── */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── SEARCH CONTAINER ────────────────────────────────────── */
.nav-search {
  position: relative;
  display: flex;
  align-items: center;
}

.search-trigger {
  z-index: 2;
  font-size: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}

.search-trigger:hover {
  background: var(--surface-2);
}

/* Panel expand search */
.search-expand {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  overflow: hidden;
  transition: width 0.3s ease;
}

.search-expand.open {
  width: 280px;
}

#navSearchInput {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-md);
  padding: 8px 14px 8px 36px;
  color: var(--text-1);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}

#navSearchInput:focus {
  border-color: var(--red-border);
}

#navSearchInput::placeholder {
  color: var(--text-3);
}

/* Ikon search di dalam input */
.search-expand::before {
  content: '🔍';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  pointer-events: none;
  z-index: 1;
}

/* ── SEARCH RESULTS DROPDOWN ─────────────────────────────── */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--surface-1);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-md);
  max-height: 360px;
  overflow-y: auto;
  z-index: 700;
  display: none;
  animation: slideDown 0.2s ease;
  box-shadow: var(--shadow-md);
}

.search-results.visible {
  display: block;
}

/* Label grup hasil pencarian */
.search-group-label {
  font-size: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-3);
  padding: 10px 12px 4px;
}

/* Item dalam hasil pencarian */
.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  color: var(--text-1);
}

.search-item:hover {
  background: var(--surface-2);
}

.search-item__poster {
  width: 32px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--surface-3);
  flex-shrink: 0;
}

.search-item__info {
  flex: 1;
  min-width: 0;
}

.search-item__title {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-item__meta {
  font-size: 11px;
  color: var(--text-3);
  font-family: 'Space Grotesk', sans-serif;
  margin-top: 2px;
}

/* Recent searches tags */
.search-recent-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px 12px;
}

.search-recent-tag {
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--border-hi);
  border-radius: 999px;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
  background: none;
  font-family: 'Space Grotesk', sans-serif;
}

.search-recent-tag:hover {
  border-color: var(--red-border);
  color: var(--red);
  background: var(--red-dim);
}

/* Pesan kosong / loading */
.search-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

/* ── BELL BUTTON ─────────────────────────────────────────── */
.nav-bell {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.15s;
}

.nav-bell:hover {
  background: var(--surface-2);
}

.bell-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  background: var(--red);
  border-radius: 999px;
  font-size: 9px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  display: none;
  align-items: center;
  justify-content: center;
  color: white;
  padding: 0 3px;
  box-shadow: 0 0 6px rgba(255, 23, 68, 0.5);
}

.bell-badge.visible {
  display: flex;
}

/* Bell dropdown panel */
.bell-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: var(--surface-1);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  z-index: 600;
  display: none;
  animation: slideDown 0.2s ease;
  overflow: hidden;
}

.bell-dropdown.open {
  display: block;
}

.bell-dropdown-header {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
}

.bell-dropdown-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

/* ── LANGUAGE BUTTON ─────────────────────────────────────── */
.lang-btn {
  font-size: 12px;
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
  padding: 4px 10px;
  border: 1px solid var(--border-hi);
  border-radius: var(--r-sm);
  color: var(--text-2);
  background: none;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.5px;
}

.lang-btn:hover {
  border-color: var(--red-border);
  color: var(--red);
  background: var(--red-dim);
}

/* ── USER MENU ────────────────────────────────────────────── */
.nav-user-menu {
  position: relative;
}

#userBtn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.15s;
}

#userBtn:hover {
  background: var(--surface-2);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 200px;
  background: var(--surface-1);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  z-index: 600;
  display: none;
  animation: slideDown 0.2s ease;
  overflow: hidden;
  padding: 6px 0;
}

.user-dropdown.open {
  display: block;
}

.user-dropdown a,
.user-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-2);
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}

.user-dropdown a:hover,
.user-dropdown button:hover {
  background: var(--surface-2);
  color: var(--text-1);
}

.user-dropdown .divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

/* ── HAMBURGER (mobile) ──────────────────────────────────── */
.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 20px;
  border-radius: var(--r-sm);
  color: var(--text-1);
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.hamburger:hover {
  background: var(--surface-2);
}

/* ── MOBILE OVERLAY ──────────────────────────────────────── */
.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 800;
  display: none;
  align-items: stretch;
  animation: fadeIn 0.2s ease;
}

.mobile-menu-overlay.active {
  display: flex;
}

.mobile-menu {
  width: 300px;
  height: 100%;
  background: var(--surface-1);
  padding: 20px;
  overflow-y: auto;
  animation: slideRight 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Tombol close mobile menu */
.mobile-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  color: var(--text-2);
  background: none;
  border: none;
  cursor: pointer;
  margin-left: auto;
  margin-bottom: 12px;
  transition: background 0.15s, color 0.15s;
}

.mobile-close:hover {
  background: var(--surface-3);
  color: var(--text-1);
}

/* Logo mobile menu */
.mobile-logo {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.mobile-logo img {
  height: 24px;
}

/* Link utama mobile */
.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  border-radius: var(--r-sm);
  transition: color 0.15s, background 0.15s;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
  color: var(--text-1);
  background: var(--surface-2);
}

.mobile-nav-link.active {
  color: var(--red);
}

/* Accordion item mobile */
.mobile-accordion-item {
  border-radius: var(--r-sm);
  overflow: hidden;
}

.mobile-accordion-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: color 0.15s, background 0.15s;
  border-radius: var(--r-sm);
}

.mobile-accordion-trigger:hover {
  background: var(--surface-2);
  color: var(--text-1);
}

.mobile-accordion-trigger.open {
  color: var(--text-1);
  background: var(--surface-2);
}

/* Chevron icon rotate */
.accordion-chevron {
  font-size: 10px;
  transition: transform 0.2s ease;
  color: var(--text-3);
}

.mobile-accordion-trigger.open .accordion-chevron {
  transform: rotate(180deg);
}

/* Content accordion */
.mobile-accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding-left: 16px;
}

.mobile-accordion-body.open {
  max-height: 500px;
}

.mobile-accordion-body a {
  display: block;
  padding: 8px 8px;
  font-size: 13px;
  color: var(--text-3);
  text-decoration: none;
  border-radius: var(--r-sm);
  transition: color 0.15s, background 0.15s;
}

.mobile-accordion-body a:hover {
  color: var(--red);
  background: var(--red-dim);
}

/* Section label dalam mobile menu */
.mobile-section-label {
  font-size: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-3);
  padding: 12px 8px 4px;
}

/* Divider mobile menu */
.mobile-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

/* Lang & misc actions di bawah mobile menu */
.mobile-footer-actions {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── KEYFRAME TAMBAHAN ───────────────────────────────────── */
@keyframes slideRight {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ── RESPONSIVE: MOBILE ──────────────────────────────────── */
@media (max-width: 768px) {
  .nav-menu {
    display: none;
  }

  .hamburger {
    display: flex;
  }

  .nav-inner {
    gap: 16px;
  }

  /* Search lebih kecil di mobile */
  .search-expand.open {
    width: 200px;
  }

  /* Sembunyikan beberapa action di mobile sangat kecil */
  .nav-bell {
    display: none;
  }
}

@media (max-width: 480px) {
  .nav-inner {
    padding: 0 12px;
    gap: 8px;
  }

  .lang-btn {
    display: none;
  }
}

/* ── TABLET (769px - 1024px) ─────────────────────────────── */
@media (min-width: 769px) and (max-width: 1024px) {
  .nav-inner {
    gap: 16px;
  }

  .nav-link {
    padding: 6px 8px;
    font-size: 13px;
  }
}

/* ── Mobile Menu Toggle (anime.html & kids.html style) ── */
.navbar__mobile-menu {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px 16px;
  background: var(--surface-2, #111);
  border-top: 1px solid var(--border, #222);
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 999;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.navbar__mobile-menu.open {
  display: flex;
}
.navbar__mobile-menu .mobile-nav-link {
  padding: 10px 12px;
  color: var(--text-1, #fff);
  text-decoration: none;
  border-radius: 8px;
  font-size: 15px;
  transition: background 0.15s;
}
.navbar__mobile-menu .mobile-nav-link:hover,
.navbar__mobile-menu .mobile-nav-link.active {
  background: var(--surface-3, #1e1e2e);
  color: var(--primary, #e50914);
}
