/**
 * chairueng Cinematic Streaming Theme Stylesheet
 * 
 * @package Chairueng\Theme
 * @author Ly Komry
 */

/* ==========================================================================
   1. Theme Variables & Base
   ========================================================================== */
:root {
  --cr-primary: #e50914;
  --cr-primary-hover: #b80710;
  --cr-background: #141414;
  --cr-surface: #1e1e1e;
  --cr-surface-elevated: #282828;
  --cr-surface-card: #222222;
  --cr-text-primary: #ffffff;
  --cr-text-secondary: #a3a3a3;
  --cr-text-muted: #737373;
  --cr-border: #333333;
  --cr-border-subtle: #262626;
  --cr-vip-gold: #f59e0b;
  --cr-vip-gold-dark: #b45309;
  --cr-success: #10b981;
  --cr-radius-sm: 4px;
  --cr-radius-md: 8px;
  --cr-radius-lg: 12px;
  --cr-shadow-card: 0 4px 20px rgba(0, 0, 0, 0.4);
  --cr-shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.7);
  --cr-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --cr-font-latin: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --cr-font-khmer: 'Kantumruy Pro', 'Battambang', sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--cr-background);
  color: var(--cr-text-primary);
  font-family: var(--cr-font-latin);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body:lang(km), body.khmer-content {
  font-family: var(--cr-font-khmer), var(--cr-font-latin);
}

.site-main {
  flex: 1;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--cr-transition);
}

a:hover {
  color: var(--cr-primary);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.chairueng-container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ==========================================================================
   2. Header Navigation
   ========================================================================== */
.chairueng-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(14, 14, 18, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  transition: var(--cr-transition);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
  gap: 1.5rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-decoration: none;
}

.logo-accent {
  color: var(--cr-primary);
  text-shadow: 0 0 16px rgba(229, 9, 20, 0.45);
}

.logo-khmer {
  color: #ffffff;
  font-family: var(--cr-font-khmer);
  font-size: 1.05rem;
  font-weight: 700;
  margin-left: 0.25rem;
}

.header-nav {
  display: flex;
  align-items: center;
}

.header-nav-list {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.header-nav-list li a {
  display: inline-block;
  padding: 0.45rem 0.95rem;
  border-radius: 20px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #d1d5db;
  text-decoration: none;
  transition: all 0.2s ease;
}

.header-nav-list li a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.header-nav-list li.current-menu-item a,
.header-nav-list li.active a {
  color: #ffffff;
  background: var(--cr-primary);
  box-shadow: 0 4px 15px rgba(229, 9, 20, 0.4);
}

.header-search {
  position: relative;
  display: flex;
  align-items: center;
}

.header-search-form {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 3px 4px 3px 12px;
  transition: all 0.25s ease;
}

.header-search-form:focus-within {
  border-color: var(--cr-primary);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 15px rgba(229, 9, 20, 0.35);
}

.header-search-icon {
  color: var(--cr-text-muted);
  font-size: 0.85rem;
  pointer-events: none;
  margin-right: 4px;
}

.header-search-form input[type="search"] {
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  padding: 0.4rem 0.5rem;
  font-size: 0.88rem;
  width: 200px;
  transition: width 0.25s ease;
}

.header-search-form:focus-within input[type="search"] {
  width: 260px;
}

.header-search-btn {
  background: var(--cr-primary);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease;
}

.header-search-btn:hover {
  transform: scale(1.08);
  background: var(--cr-primary-hover);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cr-header-vip-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000 !important;
  font-weight: 700;
  border-radius: 20px;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.cr-header-auth-btn {
  border-radius: 20px;
  padding: 0.45rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ==========================================================================
   3. Buttons & Badges
   ========================================================================== */
.cr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  font-size: 0.925rem;
  font-weight: 600;
  border-radius: var(--cr-radius-sm);
  cursor: pointer;
  border: none;
  transition: var(--cr-transition);
}

.cr-btn-primary {
  background: var(--cr-primary);
  color: #fff;
}

.cr-btn-primary:hover {
  background: var(--cr-primary-hover);
  color: #fff;
}

.cr-btn-secondary {
  background: var(--cr-surface-elevated);
  color: #fff;
  border: 1px solid var(--cr-border);
}

.cr-btn-secondary:hover {
  background: #333;
  color: #fff;
}

.cr-btn-vip {
  background: linear-gradient(135deg, var(--cr-vip-gold), var(--cr-vip-gold-dark));
  color: #000;
  font-weight: 700;
}

.cr-btn-vip:hover {
  filter: brightness(1.1);
  color: #000;
}

.cr-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--cr-radius-sm);
  text-transform: uppercase;
}

.cr-badge-vip {
  background: var(--cr-vip-gold);
  color: #000;
}

.cr-badge-free {
  background: var(--cr-success);
  color: #fff;
}

.cr-badge-rating {
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--cr-border);
  color: #fff;
}

/* ==========================================================================
   4. Hero Featured Slider & Welcome Showcase
   ========================================================================== */
.hero-slider {
  position: relative;
  height: 580px;
  overflow: hidden;
  margin-bottom: 2rem;
  background: #000;
}

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s ease, visibility 0.8s ease;
  background-size: cover;
  background-position: center top;
}

.hero-slide.active {
  opacity: 1;
  visibility: visible;
}

.hero-backdrop-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, #141414 0%, rgba(20,20,20,0.6) 50%, rgba(20,20,20,0.85) 100%),
              linear-gradient(90deg, #141414 0%, rgba(20,20,20,0.7) 45%, transparent 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 680px;
  padding-top: 100px;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.hero-title {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 0.5rem 0;
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--cr-primary);
  margin-bottom: 1rem;
  font-weight: 600;
}

.hero-description {
  color: #d1d5db;
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* 4.2 Welcome Hero Showcase (For Clean / Initial Sites) */
.cr-welcome-hero {
  position: relative;
  padding: 4.5rem 0 3.5rem 0;
  margin-bottom: 2rem;
  background: radial-gradient(circle at 50% 15%, rgba(229, 9, 20, 0.18) 0%, rgba(18, 18, 22, 0.98) 75%),
              linear-gradient(180deg, #121216 0%, #16161c 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  text-align: center;
}

.cr-welcome-content {
  max-width: 780px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.cr-welcome-badge {
  font-size: 0.85rem;
  padding: 0.35rem 0.95rem;
  border-radius: 20px;
  margin-bottom: 1.25rem;
}

.cr-welcome-title {
  font-size: 2.6rem;
  font-weight: 900;
  line-height: 1.2;
  margin: 0 0 1rem 0;
  color: #ffffff;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

.cr-welcome-subtitle {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #a3a3a3;
  margin: 0 auto 1.75rem auto;
  max-width: 660px;
}

.cr-welcome-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

.cr-welcome-btn-vip {
  padding: 0.75rem 1.75rem;
  font-size: 1rem;
}

.cr-admin-welcome-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(229, 9, 20, 0.08);
  border: 1px dashed rgba(229, 9, 20, 0.45);
  border-radius: 12px;
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  color: #e5e5e5;
  text-align: left;
  flex-wrap: wrap;
  justify-content: center;
}

.cr-hint-icon {
  font-size: 1.15rem;
}

.cr-hint-btn {
  background: var(--cr-primary);
  color: #fff;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.8rem;
  text-decoration: none;
  white-space: nowrap;
}

.cr-hint-btn:hover {
  background: var(--cr-primary-hover);
  color: #fff;
}

/* 4.3 Streaming Quick Category Filter Pills */
.cr-category-bar-wrapper {
  margin-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 0.75rem;
}

.cr-category-bar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0;
}

.cr-category-bar::-webkit-scrollbar {
  display: none;
}

.cr-cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  color: #d1d5db;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.cr-cat-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.cr-cat-pill.active {
  background: var(--cr-primary);
  color: #ffffff;
  border-color: var(--cr-primary);
  box-shadow: 0 4px 15px rgba(229, 9, 20, 0.4);
}

/* ==========================================================================
   5. Section Headers & Drama Cards
   ========================================================================== */
.cr-section {
  margin-bottom: 3.5rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--cr-border-subtle);
  padding-bottom: 0.75rem;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.section-accent-bar {
  display: inline-block;
  width: 4px;
  height: 22px;
  background: var(--cr-primary);
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(229, 9, 20, 0.5);
}

.section-title {
  font-size: 1.45rem;
  font-weight: 700;
  margin: 0;
  color: #ffffff;
}

.section-more {
  color: var(--cr-text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.section-more:hover {
  color: var(--cr-primary);
}

/* Empty State Card */
.cr-empty-state-card {
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.03) 0%, rgba(20, 20, 24, 0.85) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 3.5rem 2rem;
  text-align: center;
  max-width: 580px;
  margin: 1.5rem auto 3rem auto;
}

.cr-empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.cr-empty-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 0.5rem 0;
}

.cr-empty-desc {
  font-size: 0.95rem;
  color: #9ca3af;
  line-height: 1.6;
  margin: 0 auto 1.5rem auto;
  max-width: 440px;
}

.cr-empty-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.drama-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

.drama-card {
  position: relative;
  background: var(--cr-surface-card);
  border-radius: var(--cr-radius-md);
  overflow: hidden;
  transition: var(--cr-transition);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.drama-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--cr-shadow-hover);
  border-color: rgba(229, 9, 20, 0.4);
}

.drama-poster-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  width: 100%;
  overflow: hidden;
  background: #111;
  text-decoration: none;
}

.drama-poster-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.drama-card:hover .drama-poster-wrap img {
  transform: scale(1.06);
}

.drama-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.25) 0%, transparent 40%, rgba(0,0,0,0.85) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.75rem;
}

.overlay-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.overlay-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.drama-info {
  padding: 0.85rem;
  flex: 1;
}

.drama-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.35rem 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drama-card-title a {
  color: #fff;
  text-decoration: none;
  transition: color 0.2s ease;
}

.drama-card-title a:hover {
  color: var(--cr-primary);
}

.drama-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--cr-text-muted);
}

.cr-genre-buttons-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.cr-genre-tag-btn {
  border-radius: 20px;
  font-size: 0.85rem;
  padding: 0.45rem 1rem;
}

/* ==========================================================================
   6. Episode Cards & Lists
   ========================================================================== */
.episode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.episode-card {
  background: var(--cr-surface-card);
  border-radius: var(--cr-radius-md);
  overflow: hidden;
  border: 1px solid var(--cr-border-subtle);
  transition: var(--cr-transition);
}

.episode-card:hover {
  transform: translateY(-4px);
  border-color: var(--cr-border);
}

.episode-thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #111;
  overflow: hidden;
}

.episode-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.episode-play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: var(--cr-transition);
}

.episode-card:hover .episode-play-icon {
  opacity: 1;
}

.episode-play-icon svg {
  width: 44px;
  height: 44px;
  fill: var(--cr-primary);
}

.episode-duration-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.episode-info {
  padding: 0.85rem;
}

.episode-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.35rem 0;
}

/* ==========================================================================
   7. Single Drama & Watch Page Layout
   ========================================================================== */
.drama-detail-hero {
  position: relative;
  min-height: 480px;
  background-size: cover;
  background-position: center top;
  margin-bottom: 3rem;
  padding: 3rem 0;
}

.drama-detail-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2.5rem;
  position: relative;
  z-index: 2;
}

.drama-detail-poster img {
  border-radius: var(--cr-radius-lg);
  box-shadow: 0 10px 40px rgba(0,0,0,0.7);
  width: 100%;
}

.drama-meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 1.5rem 0;
  padding: 1rem 0;
  border-top: 1px solid var(--cr-border);
  border-bottom: 1px solid var(--cr-border);
  font-size: 0.9rem;
}

.drama-meta-item span {
  display: block;
  color: var(--cr-text-muted);
  font-size: 0.775rem;
  text-transform: uppercase;
}

/* Watch Page Layout */
.watch-container {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 2rem;
  margin-top: 2rem;
  margin-bottom: 4rem;
}

.watch-player-box {
  background: #000;
  border-radius: var(--cr-radius-md);
  overflow: hidden;
  box-shadow: var(--cr-shadow-card);
}

.watch-player-aspect {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
}

.watch-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 1px solid var(--cr-border-subtle);
}

/* ==========================================================================
   8. Membership Pricing Table
   ========================================================================== */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin: 3rem 0;
}

.pricing-card {
  background: var(--cr-surface-card);
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  transition: var(--cr-transition);
  position: relative;
}

.pricing-card.featured {
  border-color: var(--cr-primary);
  background: linear-gradient(180deg, rgba(229, 9, 20, 0.1) 0%, var(--cr-surface-card) 100%);
  transform: scale(1.03);
}

.pricing-card:hover {
  border-color: var(--cr-primary);
  box-shadow: var(--cr-shadow-hover);
}

.pricing-price {
  font-size: 2.75rem;
  font-weight: 800;
  color: #fff;
  margin: 1.5rem 0 0.5rem 0;
}

.pricing-price-khr {
  color: var(--cr-vip-gold);
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 2rem;
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem 0;
  text-align: left;
}

.pricing-features li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--cr-border-subtle);
  font-size: 0.925rem;
  color: #d1d5db;
}

/* ==========================================================================
   9. Mobile Navigation & Interactive Drawer System
   ========================================================================== */

/* 9.1 Mobile Toggle Button (Hamburger) */
.cr-mobile-toggle {
  display: none;
  background: transparent;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--cr-text-primary);
  align-items: center;
  justify-content: center;
  border-radius: var(--cr-radius-sm);
  transition: var(--cr-transition);
}

.cr-mobile-toggle:hover {
  background: var(--cr-surface-elevated);
}

.cr-hamburger-box {
  width: 24px;
  height: 20px;
  display: inline-block;
  position: relative;
}

.cr-hamburger-inner,
.cr-hamburger-inner::before,
.cr-hamburger-inner::after {
  width: 24px;
  height: 2.5px;
  background-color: #fff;
  border-radius: 2px;
  position: absolute;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.cr-hamburger-inner {
  top: 50%;
  transform: translateY(-50%);
}

.cr-hamburger-inner::before,
.cr-hamburger-inner::after {
  content: "";
  display: block;
}

.cr-hamburger-inner::before {
  top: -7px;
}

.cr-hamburger-inner::after {
  bottom: -7px;
}

.cr-mobile-toggle.active .cr-hamburger-inner {
  transform: rotate(45deg);
}

.cr-mobile-toggle.active .cr-hamburger-inner::before {
  top: 0;
  opacity: 0;
}

.cr-mobile-toggle.active .cr-hamburger-inner::after {
  bottom: 0;
  transform: rotate(-90deg);
}

/* 9.2 Mobile Search Toggle Button */
.cr-mobile-search-btn {
  display: none;
  background: var(--cr-surface-elevated);
  border: 1px solid var(--cr-border);
  color: var(--cr-text-primary);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: var(--cr-transition);
}

.cr-mobile-search-btn:hover,
.cr-mobile-search-btn.active {
  border-color: var(--cr-primary);
  color: var(--cr-primary);
}

/* 9.3 Mobile Expandable Search Bar */
.cr-mobile-search-bar {
  display: none;
  padding: 0.75rem 0 1rem 0;
  border-top: 1px solid var(--cr-border-subtle);
  animation: crSlideDown 0.25s ease forwards;
}

.cr-mobile-search-bar.active {
  display: block;
}

.cr-mobile-search-bar form {
  display: flex;
  gap: 0.5rem;
}

.cr-mobile-search-bar input[type="search"] {
  flex: 1;
  background: var(--cr-surface-elevated);
  border: 1px solid var(--cr-border);
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: var(--cr-radius-sm);
  font-size: 0.95rem;
  outline: none;
}

.cr-mobile-search-bar input[type="search"]:focus {
  border-color: var(--cr-primary);
}

.cr-mobile-search-bar .cr-search-submit-btn {
  background: var(--cr-primary);
  color: #fff;
  border: none;
  padding: 0.65rem 1.25rem;
  border-radius: var(--cr-radius-sm);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}

@keyframes crSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 9.4 Mobile Slide-out Drawer */
.cr-mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 320px;
  max-width: 86vw;
  height: 100vh;
  height: 100dvh;
  background: #181818;
  border-right: 1px solid var(--cr-border);
  box-shadow: 10px 0 40px rgba(0, 0, 0, 0.85);
  z-index: 99999;
  transform: translateX(-100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.cr-mobile-drawer.active {
  transform: translateX(0);
}

.cr-drawer-inner {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 1.5rem 1.25rem;
}

/* Drawer Header */
.cr-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--cr-border-subtle);
  margin-bottom: 1.25rem;
}

.cr-drawer-close {
  background: transparent;
  border: none;
  color: var(--cr-text-secondary);
  font-size: 1.75rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  border-radius: var(--cr-radius-sm);
  transition: var(--cr-transition);
}

.cr-drawer-close:hover {
  color: #fff;
  background: var(--cr-surface-elevated);
}

/* Drawer User Card */
.cr-drawer-user-card {
  background: var(--cr-surface-elevated);
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius-md);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.cr-user-badge-wrap {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.cr-user-avatar-initial {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cr-primary), #800);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 10px rgba(229, 9, 20, 0.3);
}

.cr-user-meta .cr-user-name {
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  margin-bottom: 0.25rem;
}

.cr-user-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.cr-btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.825rem;
}

.cr-guest-prompt .cr-guest-text {
  font-size: 0.85rem;
  color: var(--cr-text-secondary);
  line-height: 1.5;
  margin: 0 0 0.85rem 0;
}

.cr-guest-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

/* Drawer Navigation Menu */
.cr-drawer-nav {
  margin-bottom: 1.5rem;
}

.cr-drawer-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.cr-drawer-menu li {
  position: relative;
}

.cr-drawer-menu a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  color: var(--cr-text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--cr-radius-sm);
  transition: var(--cr-transition);
}

.cr-drawer-menu a:hover,
.cr-drawer-menu .current-menu-item > a {
  background: var(--cr-surface-elevated);
  color: #fff;
}

.cr-drawer-menu .current-menu-item > a {
  border-left: 3px solid var(--cr-primary);
  color: var(--cr-primary);
}

.cr-menu-icon {
  font-size: 1.15rem;
  width: 22px;
  text-align: center;
}

.cr-submenu-toggle {
  position: absolute;
  right: 8px;
  top: 10px;
  background: transparent;
  border: none;
  color: var(--cr-text-muted);
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.cr-drawer-menu .menu-item-has-children.submenu-open > .cr-submenu-toggle {
  transform: rotate(180deg);
}

.cr-drawer-menu .sub-menu {
  display: none;
  list-style: none;
  padding: 0.25rem 0 0.25rem 2rem;
  margin: 0;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--cr-radius-sm);
}

.cr-drawer-menu .menu-item-has-children.submenu-open > .sub-menu {
  display: block;
}

/* Drawer Quick Categories */
.cr-drawer-categories {
  margin-bottom: 1.5rem;
}

.cr-drawer-section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--cr-text-muted);
  margin: 0 0 0.75rem 0;
  font-weight: 700;
}

.cr-category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.cr-pill {
  background: var(--cr-surface-elevated);
  border: 1px solid var(--cr-border);
  color: var(--cr-text-secondary);
  font-size: 0.8rem;
  padding: 0.35rem 0.7rem;
  border-radius: 14px;
  transition: var(--cr-transition);
}

.cr-pill:hover {
  background: var(--cr-primary);
  color: #fff;
  border-color: var(--cr-primary);
}

/* Drawer Footer */
.cr-drawer-footer {
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px solid var(--cr-border-subtle);
}

.cr-drawer-lang-label {
  font-size: 0.75rem;
  color: var(--cr-text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cr-drawer-lang-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.cr-lang-choice {
  color: var(--cr-text-secondary);
  font-weight: 500;
}

.cr-lang-choice.active {
  color: var(--cr-primary);
  font-weight: 700;
}

.cr-sep {
  color: var(--cr-border);
}

.cr-drawer-logout-wrap {
  margin-top: 1rem;
}

.cr-drawer-logout-link {
  color: #ef4444;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.cr-drawer-logout-link:hover {
  color: #f87171;
}

/* 9.5 Mobile Backdrop */
.cr-mobile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.cr-mobile-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* Lock Body Scroll when Drawer Open */
body.cr-drawer-open {
  overflow: hidden;
  touch-action: none;
}

/* 9.6 Mobile Bottom Navigation App Bar */
.cr-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(18, 18, 18, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 9990;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.cr-bottom-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 100%;
  max-width: 600px;
  margin: 0 auto;
}

.cr-bottom-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--cr-text-muted);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 500;
  gap: 3px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.cr-bottom-item:active {
  transform: scale(0.92);
}

.cr-bottom-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.cr-bottom-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.cr-bottom-item.active {
  color: #fff;
}

.cr-bottom-item.active .cr-bottom-icon {
  color: var(--cr-primary);
}

.cr-bottom-item-vip {
  color: #fbbf24;
}

.cr-bottom-item-vip.active,
.cr-bottom-item-vip:hover {
  color: #f59e0b;
}

/* 9.7 Modern Global Footer */
.chairueng-footer {
  background: linear-gradient(180deg, #121216 0%, #0d0d11 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4rem 0 2.5rem 0;
  margin-top: 4.5rem;
  color: var(--cr-text-secondary);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 3rem;
}

.footer-col {
  display: flex;
  flex-direction: column;
}

.footer-logo {
  font-size: 1.5rem;
  font-weight: 900;
  margin-bottom: 1rem;
}

.footer-desc {
  color: var(--cr-text-muted);
  font-size: 0.875rem;
  line-height: 1.65;
  margin: 0 0 1.25rem 0;
  max-width: 340px;
}

.footer-payment-rails {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.payment-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--cr-text);
  letter-spacing: 0.02em;
}

.footer-title {
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 0 1.2rem 0;
  position: relative;
  padding-bottom: 0.5rem;
}

.footer-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 24px;
  height: 2px;
  background: var(--cr-primary);
  border-radius: 2px;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.footer-links li a {
  color: var(--cr-text-muted);
  font-size: 0.875rem;
  text-decoration: none;
  transition: color 0.2s ease, transform 0.2s ease;
  display: inline-flex;
  align-items: center;
}

.footer-links li a:hover {
  color: #fff;
  transform: translateX(4px);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 1.75rem;
  font-size: 0.85rem;
  color: var(--cr-text-muted);
}

.footer-copyright {
  line-height: 1.5;
}

.footer-lang {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-lang .lang-item {
  color: var(--cr-text-muted);
  font-weight: 500;
}

.footer-lang .lang-sep {
  color: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   10. Comprehensive Responsive Breakpoints
   ========================================================================== */

/* 10.1 Large Desktop / 4K Screens (min-width: 1441px) */
@media (min-width: 1441px) {
  .drama-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* 10.2 Medium Desktop (1025px - 1440px) */
@media (max-width: 1440px) {
  .drama-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 1.25rem;
  }
}

/* 10.3 Tablet Landscape & Laptops (993px - 1024px) */
@media (max-width: 1024px) {
  .watch-container {
    grid-template-columns: 1fr;
  }
  .drama-detail-grid {
    grid-template-columns: 240px 1fr;
    gap: 1.75rem;
  }
  .drama-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
  }
}

/* 10.4 Tablet Portrait & Navigation Breakpoint (max-width: 992px) */
@media (max-width: 992px) {
  /* Show Mobile Hamburger and Hide Desktop Header Nav */
  .cr-mobile-toggle {
    display: inline-flex;
  }
  .cr-mobile-search-btn {
    display: inline-flex;
  }
  .header-nav {
    display: none !important;
  }
  .header-search {
    display: none;
  }
  .cr-header-auth-btn {
    display: none;
  }
  .header-inner {
    height: 64px;
    gap: 0.75rem;
  }
  .site-logo {
    font-size: 1.35rem;
  }
  .site-logo span {
    font-size: 0.95rem;
  }
  .drama-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
  .hero-slider {
    height: 480px;
  }
  .hero-title {
    font-size: 2.2rem;
  }
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
  .footer-col-brand {
    grid-column: span 2;
  }
}

/* 10.5 Mobile Smartphones (max-width: 768px) */
@media (max-width: 768px) {
  /* Activate Mobile Bottom Bar and Add Body Clearance */
  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }
  .cr-bottom-nav {
    display: block;
  }

  /* Header adjustments */
  .chairueng-header {
    background: rgba(18, 18, 18, 0.98);
  }
  .header-actions .header-lang-wrapper {
    display: none; /* Moved into mobile drawer for cleaner mobile header */
  }

  /* Hero Slider for Mobile */
  .hero-slider {
    height: 400px;
  }
  .hero-content {
    max-width: 100%;
    bottom: 2rem;
    left: 1rem;
    right: 1rem;
  }
  .hero-title {
    font-size: 1.75rem;
    line-height: 1.25;
  }
  .hero-synopsis {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.85rem;
  }
  .hero-actions {
    flex-wrap: wrap;
    gap: 0.6rem;
  }
  .hero-actions .cr-btn {
    flex: 1;
    min-width: 130px;
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
  }

  /* Single Drama Details Stacked Layout */
  .drama-detail-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 1.5rem;
  }
  .drama-detail-poster {
    max-width: 200px;
    margin: 0 auto;
    border-radius: var(--cr-radius-md);
  }
  .drama-meta-list {
    justify-content: center;
  }
  .drama-taxonomy-pills {
    justify-content: center;
  }

  /* Watch Page Responsive Player */
  .watch-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .watch-main {
    min-width: 0;
  }
  .watch-sidebar {
    width: 100%;
  }

  /* Episode Grid on Mobile */
  .episode-grid {
    grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
    gap: 0.5rem;
  }
  .ep-btn {
    padding: 0.6rem 0.4rem;
    font-size: 0.85rem;
  }

  /* Footer Adjustments */
  .chairueng-footer {
    padding: 2.5rem 0 calc(3rem + env(safe-area-inset-bottom, 0px)) 0 !important;
    margin-top: 3rem !important;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .footer-col-brand {
    grid-column: span 1;
  }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 1.25rem;
  }
}

/* 10.6 Mobile Portrait Small Devices (max-width: 480px) */
@media (max-width: 480px) {
  .chairueng-container {
    padding: 0 1rem;
  }

  /* 2-Column High-Density Drama Grid for Mobile Screens */
  .drama-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  .drama-card {
    border-radius: var(--cr-radius-sm);
  }
  .drama-card-title {
    font-size: 0.875rem;
    line-height: 1.3;
  }
  .drama-card-meta {
    font-size: 0.75rem;
  }

  /* Section Title Scaling */
  .section-title {
    font-size: 1.25rem;
  }
  .section-header {
    margin-bottom: 1rem;
  }

  /* Mobile Drawer takes 90vw on small phones */
  .cr-mobile-drawer {
    width: 300px;
    max-width: 90vw;
  }
}

/* 10.7 Ultra Small Phones (max-width: 360px) */
@media (max-width: 360px) {
  .site-logo {
    font-size: 1.15rem;
  }
  .site-logo span {
    font-size: 0.8rem;
  }
  .drama-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  .cr-bottom-label {
    font-size: 0.62rem;
  }
  .cr-bottom-icon {
    font-size: 1.1rem;
  }
}

