:root {
  --bg: #121212;
  --surface: #171717;
  --surface-2: #222222;
  --border: #2a2a2a;
  --text: #dddddd;
  --text-muted: #888888;
  --gold: #dacb46;
  --cyan: #46e1ff;
  --pink: #ff6a88c2;
  --red-ribbon: #980202;
}

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

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: "Open Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 12px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(12, 12, 12, 0.96);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.3rem;
}

.logo-badge {
  background: var(--red-ribbon);
  color: #fff;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 3px;
}

.search-box {
  flex: 1;
  min-width: 240px;
  display: flex;
  gap: 6px;
}

.search-select,
.lang-select,
.filter-group select,
.jump-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  border-radius: 4px;
  font-size: 12px;
  outline: none;
}

.search-box input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: #fff;
  padding: 7px 12px;
  border-radius: 4px;
  font-size: 13px;
  outline: none;
}

.search-box input:focus {
  border-color: var(--gold);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn {
  border: none;
  cursor: pointer;
  padding: 7px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  transition: background 0.15s ease, color 0.15s ease;
}

.btn:hover {
  color: var(--gold);
}

.btn-primary {
  background: #c91835;
  color: #fff;
}

.btn-primary:hover {
  background: #e02040;
  color: #fff;
}

.btn-outline {
  border: 1px solid #383838;
}

.btn-ghost {
  background: transparent;
}

.pill {
  background: #2c2c2c;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  margin-left: 3px;
}

/* Main Menu Bar */
.main-menu-bar {
  background: #0b0b0b;
  border-top: 1px solid #1f1f1f;
}

.main-menu-list {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 6px 12px;
}

.menu-chip {
  white-space: nowrap;
  background: transparent;
  color: #ddd;
  border: none;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
}

.menu-chip:hover {
  color: var(--gold);
  background: #1a1a1a;
}

.menu-chip.active {
  color: var(--gold);
  background: #1e1e1e;
  font-weight: 700;
}

/* Main Wrap */
.main-wrap {
  padding-top: 16px;
  padding-bottom: 40px;
}

/* Top Carousel */
.top-movie-section {
  margin-bottom: 18px;
}

.top-movie-list {
  position: relative;
  background: var(--surface);
  border-radius: 5px;
  padding: 10px;
}

.carousel-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.carousel-card {
  flex: 0 0 210px;
  position: relative;
  border-radius: 5px;
  overflow: hidden;
  cursor: pointer;
  background: #0e0e0e;
}

.carousel-thumb {
  position: relative;
  width: 100%;
  padding-top: 62.5%;
  overflow: hidden;
}

.carousel-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.carousel-card:hover .carousel-thumb img {
  transform: scale(1.05);
  opacity: 0.85;
}

.ribbon {
  position: absolute;
  background: var(--red-ribbon);
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  top: 8px;
  right: -24px;
  width: 82px;
  line-height: 20px;
  transform: rotate(45deg);
  z-index: 5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.carousel-meta {
  padding: 6px 8px;
  background: #151515;
}

.carousel-title {
  font-size: 12px;
  color: #eee;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.carousel-card:hover .carousel-title {
  color: var(--gold);
}

.carousel-nav {
  position: absolute;
  top: 42%;
  transform: translateY(-50%);
  z-index: 10;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  width: 32px;
  height: 54px;
  font-size: 24px;
  cursor: pointer;
  border-radius: 3px;
}

.carousel-nav:hover {
  background: rgba(0, 0, 0, 0.88);
  color: var(--gold);
}

.carousel-nav.prev { left: 10px; }
.carousel-nav.next { right: 10px; }

/* 2-Column Layout (#main-content + #sidebar) */
.page-layout {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

#main-content {
  flex: 1;
  min-width: 0;
}

#sidebar {
  width: 320px;
  flex-shrink: 0;
}

@media (max-width: 960px) {
  .page-layout {
    flex-direction: column;
  }
  #sidebar {
    width: 100%;
  }
}

/* Home Sections & Block Box */
.home-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.block-box {
  background: var(--surface);
  border-radius: 5px;
  overflow: hidden;
}

.header-list-index {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  padding: 10px 12px;
  border-bottom: 2px solid var(--bg);
  font-size: 18px;
  font-weight: 400;
  color: #fff;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-title-link {
  color: #fff;
  cursor: pointer;
}

.header-title-link:hover {
  color: var(--gold);
}

.header-actions-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.random-btn {
  background: #242424;
  border: 1px solid #333;
  color: #ccc;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 4px;
  cursor: pointer;
}

.random-btn:hover {
  color: var(--gold);
  border-color: var(--gold);
}

.more-link {
  font-size: 12px;
  color: var(--gold);
  cursor: pointer;
}

.meta-summary {
  font-size: 12px;
  color: var(--text-muted);
}

/* Movie Grid (3 columns like javhdz.page) */
.last-film-box-wrapper {
  padding: 12px 12px 4px;
}

.last-film-box {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
}

@media (max-width: 720px) {
  .last-film-box {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

.movie-item {
  cursor: pointer;
  display: block;
  min-width: 0;
  overflow: hidden;
}

.movie-thumbnail.ratio-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 5px;
  overflow: hidden;
  background: #0d0d0d;
}

.public-film-item-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  border-radius: 5px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.public-film-item-thumb.thumb-dvd,
.carousel-thumb img.thumb-dvd,
.list-top-movie-item-thumb.thumb-dvd {
  object-position: center center;
}

.movie-thumbnail.ratio-box::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0) 48%);
  pointer-events: none;
  z-index: 2;
}

.thumb-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.thumb-play span {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  border: 2px solid rgba(255, 255, 255, 0.85);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  padding-left: 3px;
}

.movie-item:hover .thumb-play {
  opacity: 1;
}

.movie-item:hover .public-film-item-thumb {
  opacity: 0.88;
  transform: scale(1.04);
}

/* Ribbons đè góc dưới ảnh chuẩn javhdz.page */
.ribbon-sub,
.ribbon-viewed {
  position: absolute;
  bottom: 7px;
  font-size: 10.5px;
  font-weight: 600;
  color: #fff;
  padding: 2px 6px;
  border-radius: 5px;
  box-shadow: 0 8px 22px 0 rgba(0, 0, 0, 0.38);
  z-index: 3;
}

.ribbon-sub {
  left: 7px;
  background: var(--pink);
}

.ribbon-viewed {
  right: 7px;
  background: rgba(0, 0, 0, 0.58);
}

.movie-meta {
  padding-top: 6px;
  min-width: 0;
  overflow: hidden;
}

.movie-title-1 {
  font-size: 13.5px;
  font-weight: 400;
  color: #ddd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.movie-item:hover .movie-title-1 {
  color: var(--gold);
}

/* Sidebar Top Phim Hay */
.right-box {
  background: var(--surface);
  border-radius: 5px;
  overflow: hidden;
}

.trending-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 2px solid var(--bg);
}

.right-box-header {
  font-size: 17px;
  font-weight: 400;
  color: #fff;
}

.trending-filters-options {
  display: flex;
  gap: 6px;
}

.trending-filters-options label {
  font-size: 11px;
  color: #999;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
}

.trending-filters-options label.active {
  background: #2b2b2b;
  color: var(--gold);
}

.list-top-movie {
  list-style: none;
  padding: 6px 10px;
}

.list-top-movie-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #202020;
  cursor: pointer;
}

.list-top-movie-item:last-child {
  border-bottom: none;
}

.list-top-movie-item-thumb {
  width: 132px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 4px;
  object-fit: cover;
  background: #0d0d0d;
}

.list-top-movie-item:hover .list-top-movie-item-thumb {
  opacity: 0.78;
}

.list-top-movie-info {
  flex: 1;
  min-width: 0;
}

.list-top-movie-item-vn {
  font-size: 12.5px;
  color: #ddd;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.list-top-movie-item:hover .list-top-movie-item-vn {
  color: var(--gold);
}

.list-top-movie-item-code {
  font-size: 11px;
  color: var(--cyan);
  font-weight: 600;
}

.list-top-movie-item-view {
  font-size: 11px;
  color: var(--text-muted);
}

/* Filter Bar & Pagination (div.navigation) */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #222;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.loading-bar {
  padding: 10px 12px;
  color: var(--gold);
  font-size: 13px;
}

.error-banner {
  margin: 10px 12px;
  padding: 10px;
  background: rgba(152, 2, 2, 0.25);
  border: 1px solid #980202;
  color: #ffb4b4;
  border-radius: 4px;
}

.navigation {
  text-align: center;
  padding: 16px 10px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.page-numbers {
  background-color: #2e2e2e;
  color: #bbb;
  border: none;
  padding: 5px 12px;
  border-radius: 2px;
  cursor: pointer;
  font-size: 13px;
}

.page-numbers:hover:not(:disabled) {
  background-color: #555;
  color: #fff;
}

.page-numbers:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.currentpage {
  background-color: #121212;
  color: var(--gold);
  border: 1px solid #333;
  padding: 5px 12px;
  border-radius: 2px;
  font-weight: 700;
}

.jump-form {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.jump-input {
  width: 72px;
  padding: 4px 8px;
}

/* Watch Section */
.watch-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.watch-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.watch-tools {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.cinema-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 60;
}

.player-wrapper {
  position: relative;
  z-index: 70;
  background: #000;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.player-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-container iframe,
.player-container video {
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
}

.servers-box,
.video-meta-card {
  background: var(--surface);
  border-radius: 5px;
  padding: 14px;
}

.server-group-title {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.ep-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ep-btn {
  background: #242424;
  color: #ddd;
  border: 1px solid #333;
  padding: 5px 12px;
  border-radius: 3px;
  cursor: pointer;
}

.ep-btn.active {
  background: var(--red-ribbon);
  border-color: var(--red-ribbon);
  color: #fff;
}

.video-meta-title {
  font-size: 18px;
  color: #fff;
  margin-bottom: 6px;
}

.video-meta-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

.tag-label {
  color: var(--text-muted);
  font-weight: 600;
}

.tag-btn {
  background: #222;
  border: 1px solid #333;
  color: var(--cyan);
  padding: 3px 9px;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
}

.tag-btn:hover {
  color: var(--gold);
  border-color: var(--gold);
}

.video-desc {
  color: #bbb;
  line-height: 1.6;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 18px 0 80px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* Phase 3: Ad Slots */
.ad-slot-box {
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.ad-slot-box img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}

.ad-demo-card {
  width: 100%;
  background: linear-gradient(135deg, #1b1f2a, #14161e);
  border: 1px dashed #444c5e;
  border-radius: 5px;
  padding: 14px 16px;
  text-align: center;
  color: #aab4c8;
  font-size: 12px;
}

.ad-demo-card strong {
  color: var(--gold);
}

.ad-slot-300 .ad-demo-card {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

/* Pre-roll 5s Overlay */
.preroll-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(10, 12, 16, 0.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
  text-align: center;
}

.preroll-box {
  max-width: 460px;
  width: 100%;
  background: #1a1e28;
  border: 1px solid #353c4d;
  border-radius: 8px;
  padding: 18px;
}

.preroll-title {
  color: var(--gold);
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.preroll-skip-btn {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: #c91835;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-weight: 700;
  cursor: pointer;
}

.preroll-skip-btn:disabled {
  background: #333;
  color: #aaa;
  cursor: not-allowed;
}

/* Floating Catfish Banner */
.ad-catfish {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  width: min(728px, 98vw);
  background: #171717;
  border: 1px solid #333;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 6px 32px 6px 10px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.65);
}

.ad-catfish-close {
  position: absolute;
  top: 4px;
  right: 6px;
  background: #2b2b2b;
  color: #fff;
  border: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  line-height: 22px;
}
