/*
Theme Name:  CineX
Theme URI:   https://github.com/
Description: Dark cinema streaming theme, tích hợp plugin Phim Crawler.
Version:     1.0.0
Author:      Minh Dev
Text Domain: cinex
*/

/* === DESIGN TOKENS === */
:root {
  --bg-base:      #0a0a0f;
  --bg-card:      #12121a;
  --bg-sidebar:   #0f0f17;
  --bg-hover:     #1a1a28;
  --accent:       #7c3aed;       /* violet */
  --accent-light: #a78bfa;
  --accent-glow:  rgba(124,58,237,.35);
  --gold:         #f59e0b;
  --text-primary: #f1f5f9;
  --text-muted:   #94a3b8;
  --text-dim:     #475569;
  --border:       rgba(255,255,255,.07);
  --sidebar-w:    220px;
  --radius-sm:    6px;
  --radius-md:    10px;
  --radius-lg:    16px;
  --transition:   .2s cubic-bezier(.4,0,.2,1);
}

/* === RESET / BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }

/* === LAYOUT === */
#cx-sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--transition);
}

#cx-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#cx-header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(10,10,15,.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  height: 60px;
}

#cx-content {
  flex: 1;
  padding: 0 28px 48px;
}

/* === LOGO === */
.cx-logo {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 24px 20px 8px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text-primary);
  flex-shrink: 0;
}
.cx-logo span { color: var(--accent); }

/* === SIDEBAR NAV === */
.cx-nav { padding: 8px 0; flex: 1; }
.cx-nav-section { padding: 12px 20px 4px; font-size: 10px; font-weight: 600; letter-spacing: 1.2px; color: var(--text-dim); text-transform: uppercase; }

.cx-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-radius: 0;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: color var(--transition), background var(--transition);
  position: relative;
}
.cx-nav a:hover { color: var(--text-primary); background: var(--bg-hover); }
.cx-nav a.active {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.cx-nav a.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.cx-nav svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .8; }
.cx-nav a.active svg, .cx-nav a:hover svg { opacity: 1; }

/* Sidebar promo */
.cx-sidebar-promo {
  margin: 16px 12px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(124,58,237,.18) 0%, rgba(124,58,237,.06) 100%);
  border: 1px solid rgba(124,58,237,.3);
  border-radius: var(--radius-md);
  font-size: 13px;
}
.cx-sidebar-promo p { color: var(--text-muted); margin: 4px 0 12px; line-height: 1.5; font-size: 12px; }
.cx-sidebar-promo .cx-devices { display: flex; gap: 12px; align-items: center; color: var(--text-muted); margin-bottom: 12px; }
.cx-sidebar-promo .cx-devices svg { width: 20px; height: 20px; }

/* === HEADER === */
.cx-search {
  flex: 1;
  max-width: 500px;
  position: relative;
}
.cx-search input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 9px 16px 9px 40px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
}
.cx-search input::placeholder { color: var(--text-dim); }
.cx-search input:focus { border-color: var(--accent); }
.cx-search-icon {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  width: 16px; height: 16px;
  pointer-events: none;
}

.cx-header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.cx-icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  background: transparent;
  transition: background var(--transition), color var(--transition);
}
.cx-icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.cx-icon-btn svg { width: 18px; height: 18px; }

.cx-vip-badge {
  display: flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, #92400e, #b45309);
  color: #fde68a;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}
.cx-vip-badge svg { width: 14px; height: 14px; }

.cx-avatar {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}
.cx-avatar img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }

/* === HERO SLIDER === */
.cx-hero {
  position: relative;
  height: 520px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  margin: 20px 0 32px;
}
.cx-hero-slide {
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity .6s ease;
}
.cx-hero-slide.active { opacity: 1; z-index: 1; }
.cx-hero-bg {
  width: 100%; height: 100%;
  object-fit: cover;
}
.cx-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(10,10,15,.95) 0%, rgba(10,10,15,.7) 45%, rgba(10,10,15,.1) 100%);
}
.cx-hero-content {
  position: absolute;
  bottom: 48px; left: 48px;
  max-width: 500px;
  z-index: 2;
}
.cx-hero-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 12px;
  text-transform: uppercase;
}
.cx-hero-title {
  font-size: clamp(28px, 3.5vw, 44px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1px;
  margin-bottom: 10px;
}
.cx-hero-meta {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 14px;
}
.cx-hero-meta .dot { color: var(--text-dim); }
.cx-hero-meta .cx-rating { display: flex; align-items: center; gap: 4px; color: var(--gold); font-weight: 600; }
.cx-hero-meta .cx-rating svg { width: 13px; height: 13px; }
.cx-hero-desc {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 24px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cx-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.cx-btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent);
  color: #fff;
  padding: 11px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}
.cx-btn-primary:hover {
  background: #6d28d9;
  box-shadow: 0 0 20px var(--accent-glow);
  transform: translateY(-1px);
  color: #fff;
}
.cx-btn-primary svg { width: 16px; height: 16px; }

.cx-btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.1);
  color: var(--text-primary);
  padding: 11px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  backdrop-filter: blur(6px);
  transition: background var(--transition);
  border: 1px solid rgba(255,255,255,.12);
}
.cx-btn-secondary:hover { background: rgba(255,255,255,.18); color: var(--text-primary); }
.cx-btn-secondary svg { width: 16px; height: 16px; }

/* Hero controls */
.cx-hero-nav {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  z-index: 3;
  width: 38px; height: 38px;
  background: rgba(0,0,0,.5);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  transition: background var(--transition);
}
.cx-hero-nav:hover { background: var(--accent); }
.cx-hero-nav svg { width: 16px; height: 16px; }
.cx-hero-prev { left: 14px; }
.cx-hero-next { right: 14px; }

.cx-hero-dots {
  position: absolute;
  bottom: 16px; right: 24px;
  z-index: 3;
  display: flex; gap: 6px;
}
.cx-hero-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.3);
  transition: all var(--transition);
  cursor: pointer;
}
.cx-hero-dot.active { width: 20px; border-radius: 3px; background: var(--accent); }

/* === SECTION ROW === */
.cx-section { margin-bottom: 36px; }
.cx-section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.cx-section-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.3px;
}
.cx-section-more {
  font-size: 13px;
  color: var(--accent-light);
  font-weight: 500;
  transition: color var(--transition);
}
.cx-section-more:hover { color: var(--accent); }

/* === MOVIE CARD === */
.cx-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.cx-row-continue { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.cx-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
}
.cx-card:hover {
  transform: scale(1.04) translateY(-2px);
  box-shadow: 0 12px 32px rgba(0,0,0,.6);
  z-index: 2;
}
.cx-card-thumb {
  position: relative;
  padding-bottom: 150%;
  overflow: hidden;
}
.cx-card-thumb img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.cx-card:hover .cx-card-thumb img { transform: scale(1.06); }

.cx-card-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.85) 100%);
  opacity: 0;
  transition: opacity var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.cx-card:hover .cx-card-overlay { opacity: 1; }
.cx-play-btn {
  width: 44px; height: 44px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
}
.cx-play-btn svg { width: 18px; height: 18px; margin-left: 2px; }

/* Score badge */
.cx-score {
  position: absolute;
  top: 8px; left: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  z-index: 2;
  line-height: 1.6;
}

/* Quality badge */
.cx-quality {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(0,0,0,.7);
  border: 1px solid rgba(255,255,255,.2);
  color: var(--gold);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 2;
  letter-spacing: .5px;
}

/* Info button */
.cx-card-info-btn {
  position: absolute;
  top: 8px; right: 8px;
  width: 26px; height: 26px;
  background: rgba(0,0,0,.6);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  z-index: 3;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition);
}
.cx-card:hover .cx-card-info-btn { opacity: 1; }
.cx-card-info-btn:hover { background: var(--accent); color: #fff; }
.cx-card-info-btn svg { width: 13px; height: 13px; }

.cx-card-body { padding: 10px 10px 12px; }
.cx-card-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}
.cx-card-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Continue card (wider ratio) */
.cx-card-continue .cx-card-thumb { padding-bottom: 60%; }

/* === PROGRESS BAR on continue cards === */
.cx-progress {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(255,255,255,.15);
}
.cx-progress-fill { height: 100%; background: var(--accent); }

/* === SINGLE PHIM PAGE === */
.cx-single-hero {
  position: relative;
  height: 460px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  margin: 20px 0 0;
}
.cx-single-hero-bg {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: blur(2px) brightness(.4);
  transform: scale(1.04);
}
.cx-single-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10,10,15,0) 30%, var(--bg-base) 100%);
}
.cx-single-content {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  gap: 28px;
  padding: 0 36px 36px;
}
.cx-single-poster {
  width: 160px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,.6);
}
.cx-single-poster img { width: 100%; }
.cx-single-info { flex: 1; }
.cx-single-title {
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 8px;
  line-height: 1.1;
}
.cx-single-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  font-size: 13px; color: var(--text-muted);
  margin-bottom: 16px;
}
.cx-single-meta .cx-tag {
  background: rgba(255,255,255,.08);
  border: 1px solid var(--border);
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 12px;
}
.cx-single-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 20px;
  max-width: 560px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* === PLAYER === */
.cx-player-section { padding: 24px 0; }
.cx-player-section h2 { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.cx-server-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.cx-server-tab {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.cx-server-tab.active, .cx-server-tab:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.cx-ep-grid { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.cx-ep-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}
.cx-ep-btn.active, .cx-ep-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.cx-player-wrap {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  background: #000;
  border-radius: var(--radius-md);
}
.cx-player-wrap iframe {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

/* === ARCHIVE / FILTER === */
.cx-archive-header { padding: 28px 0 16px; }
.cx-archive-title { font-size: 22px; font-weight: 800; }
.cx-filter-bar {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.cx-filter-btn {
  padding: 7px 16px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.cx-filter-btn.active, .cx-filter-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Pagination */
.cx-pagination {
  display: flex; justify-content: center; gap: 6px;
  margin-top: 36px;
}
.cx-pagination a, .cx-pagination span {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
  transition: all var(--transition);
}
.cx-pagination a:hover, .cx-pagination .current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* === SEARCH RESULTS === */
.cx-no-results { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.cx-no-results svg { width: 48px; height: 48px; margin: 0 auto 16px; opacity: .3; }

/* === FOOTER === */
#cx-footer {
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  padding: 32px 28px 24px;
  font-size: 13px;
  color: var(--text-dim);
  margin-top: auto;
}
#cx-footer .cx-footer-inner { max-width: 860px; display: flex; gap: 48px; flex-wrap: wrap; }
#cx-footer h4 { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 12px; }
#cx-footer ul li { margin-bottom: 8px; }
#cx-footer ul a { color: var(--text-dim); transition: color var(--transition); }
#cx-footer ul a:hover { color: var(--text-muted); }
.cx-footer-copy { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 12px; }

/* === MOBILE HEADER TOGGLE === */
.cx-menu-toggle {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  color: var(--text-muted);
  margin-right: 4px;
}
.cx-menu-toggle svg { width: 22px; height: 22px; }

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .cx-row { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (max-width: 768px) {
  #cx-sidebar {
    transform: translateX(-100%);
  }
  #cx-sidebar.open { transform: translateX(0); }
  #cx-main { margin-left: 0; }
  .cx-menu-toggle { display: flex; }
  #cx-content { padding: 0 16px 40px; }
  #cx-header { padding: 0 16px; }
  .cx-hero { height: 360px; margin: 12px 0 24px; border-radius: var(--radius-md); }
  .cx-hero-content { left: 20px; bottom: 24px; max-width: 90%; }
  .cx-hero-title { font-size: 22px; }
  .cx-hero-desc { display: none; }
  .cx-row { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
  .cx-single-poster { width: 110px; }
  .cx-single-title { font-size: 20px; }
}

@media (max-width: 480px) {
  .cx-row { grid-template-columns: repeat(3, 1fr); }
  .cx-row-continue { grid-template-columns: repeat(2, 1fr); }
}

/* Sidebar overlay on mobile */
.cx-sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 99;
}
.cx-sidebar-overlay.visible { display: block; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }
