/* ===============================
   style.css → Layout & Components
   =============================== */

/* ========== GLOBAL RESET ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  overflow-x: hidden;
  overflow: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

#content {
  padding: 1rem;
  margin-top: 70px;
  height: calc(100vh - 70px);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Webkit (Chrome, Edge, Safari) */
#content::-webkit-scrollbar {
  width: 6px;
}

#content::-webkit-scrollbar-track {
  background: transparent;
}

#content::-webkit-scrollbar-thumb {
  background-color: rgba(100, 100, 100, 0.3);
  border-radius: 3px;
}

/* Firefox */
#content {
  background-color: var(--color-content-bg);
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 100, 100, 0.3) transparent;
}

/* ========== HEADER ========== */
.main-header {
  width: 100%;
  background-color: var(--color-header-bg);
  border-bottom: 1px solid;
  box-shadow: 0 2px 8px var(--color-shadow);
  padding: 1rem 0;
  position: fixed;
  top: 0;
  z-index: 1000;
  box-sizing: border-box;
  height: 70px;
}

.header-container {
  width: 100%;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  box-sizing: border-box;
}

.logo {
  display: flex;
  align-items: center;
  font-size: 1.5rem;
  font-weight: bold;
  align-self: center;
  gap: 0.5rem;
}

.pencarian {
  flex: 1;
  display: flex;
  align-items: center;
}

.nav-divider {
  width: 1px;
  height: 24px;
  background-color: var(--color-text);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a,
.auth-links .auth-btn {
  position: relative;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 500;
  transition: color 0.3s ease;
  padding: 0.5rem 0;
}

/* Underline efek dengan ::after supaya tidak geser layout */
.nav-links a::after,
.auth-links .auth-btn::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0%;
  height: 2px;
  background-color: var(--color-primary);
  transition: width 0.3s ease;
}

/* Saat hover, underline muncul tanpa geser link lain */
.nav-links a:hover,
.auth-links .auth-btn:hover {
  color: var(--color-primary);
}

.nav-links a:hover::after,
.auth-links .auth-btn:hover::after {
  width: 100%;
}

/* Active state (tetap underline penuh) */
.nav-links a.active::after {
  width: 100%;
}

/* Auth links layout */
.auth-links {
  display: flex;
  gap: 1rem;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .auth-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}

/* ========== SEARCH ========== */
.search-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: none; /* default hidden */
  justify-content: center;
  align-items: flex-start;
  padding-top: 80px; /* offset dari header */
  z-index: 3000;
}

.search-box {
  background: var(--color-bg);
  padding: 0.5rem;
  border-radius: 8px;
  width: 500px;
  max-width: 90%;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
}

.search-box input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--form-border);
  outline: none;
  border-radius: 4px;
  font-size: 15px;
  margin-bottom: 0.5rem;
}

#searchResults {
  max-height: 80vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.result-category {
  color: var(--form-focus);
  font-size: 13px;
  margin: 0.5rem 0 0.2rem;
}

.result-list {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
}

.result-list li {
  width: 100%;
  box-sizing: border-box;
  padding: 0.7rem 0.8rem;
  color: var(--color-text);
  cursor: pointer;
  border-radius: 4px;
}

.result-list li:hover,
.result-list li.selected {
  background: var(--card-header-bg);
}

/* ========== RESPONSIVE HEADER ========== */
/* ========== MOBILE HEADER STYLE ========== */
.burger-menu,
.mobile-search-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--color-text);
}

@media (max-width: 768px) {
  .header-container {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .logo {
    margin: 0 auto;
  }

  .nav-divider {
    width: 100%;
    height: 1px;
  }

  .nav-links {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 70px; /* tinggi header */
    right: -100%;
    width: 50%;
    height: 100%;
    padding: 2rem 1rem;
    background-color: var(--color-bg);
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 999;
    gap: 1rem;
    border-left: 1px solid var(--color-shadow);
    align-items: flex-start;
  }

  .nav-links.show {
    right: 0;
  }

  .mobile-overlay {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    height: calc(100% - 70px);
    background: rgba(0, 0, 0, 0.2);
    z-index: 998;
  }

  .mobile-overlay.show {
    display: block;
  }

  .desktop-search {
    display: none;
  }

  .burger-menu,
  .mobile-search-btn {
    display: block;
  }
}

/* ========== DIVIDERS ========== */
.divider-top {
  border-top: 1px solid var(--color-primary);
  padding-top: 1rem;
  margin-top: 1rem;
}

.divider-bottom {
  border-bottom: 1px solid var(--color-primary);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

/* CONTAINER ATAU KONTEN */
.container {
  margin: 0 auto;
  padding: 0.5rem;
}

.genre-scroll {
  display: flex;
  flex-wrap: wrap;
  max-height: 150px;
  overflow-y: auto;
  gap: 0.3rem;
  background: var(--color-bg);
}

.genre-item {
  cursor: pointer;
  font-size: 14px;
  color: var(--color-text);
  white-space: nowrap;
  transition: color 0.2s ease, font-weight 0.2s ease;
}

.genre-item:hover {
  color: var(--color-primary);
}

.genre-item.active {
  color: var(--color-primary);
  font-weight: bold;
}

/* Overlay gelap */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* Modal container */
.modal-custom {
  background: var(--color-bg);
  max-width: 1200px;
  width: 90%;
  margin: 5% auto;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  max-height: 80vh;
}

/* Saat aktif */
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-overlay.active .modal-custom {
  transform: translateY(0);
}

/* Header & Footer */
.modal-header,
.modal-footer {
  text-align: end;
  padding: 1rem;
  border-bottom: 1px solid var(--form-border);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-footer {
  border-top: 1px solid var(--form-border);
  border-bottom: none;
}

.modal-body {
  overflow-y: auto;
  padding: 1rem;
}

.modal-tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.modal-tabs button.active {
  background: var(--color-hover-bg);
  color: var(--color-text);
}
.tab-content-custom {
  display: none;
  min-height: 200px;
}
.tab-content-custom.active {
  display: block;
}

#videoContainer img,
#videoContainer video {
  width: 100%;
  border-radius: 6px;
}

#epGrid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  overflow-y: auto;
  padding: 5px 0;
}

#epGrid button {
  min-width: 60px;
  max-width: 60px;
  text-align: center;
}
