:root {
  --bg-color: #0b0d13;
  --card-bg: rgba(20, 24, 35, 0.75);
  --card-border: rgba(255, 255, 255, 0.09);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --primary-red: #e52e2e;
  --primary-red-hover: #ff3b3b;
  --primary-red-glow: rgba(229, 46, 46, 0.4);
  --accent-cyan: #00f2fe;
  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.35);
  --accent-orange: #f59e0b;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Background Ambient Lighting */
.background-glow {
  position: fixed;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 600px;
  background: radial-gradient(circle, rgba(229, 46, 46, 0.15) 0%, rgba(79, 70, 229, 0.08) 50%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

.app-container {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: 100vh;
}

/* Glassmorphic Card base */
.glass {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

/* Header & Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: rgba(15, 18, 28, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-badge {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #e52e2e 0%, #ff5252 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 16px var(--primary-red-glow);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
  display: block;
}

.accent-dot {
  color: var(--primary-red);
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Auth Status Badge */
.auth-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  transition: var(--transition-fast);
}

.auth-status-badge.authenticated {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.auth-status-badge.unauthenticated {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 600;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: var(--transition-normal);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-red) 0%, #ff4d4d 100%);
  color: #fff;
  box-shadow: 0 4px 18px var(--primary-red-glow);
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(229, 46, 46, 0.55);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 8px 16px;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-success {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: #fff;
  box-shadow: 0 4px 18px var(--accent-green-glow);
  padding: 14px 28px;
  font-size: 1.05rem;
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.5);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 8px 16px;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-warning {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  color: #fff;
  border: 1px solid rgba(245, 158, 11, 0.4);
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.25);
}

.btn-warning:hover {
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.45);
  transform: translateY(-1px);
}

.btn-purple {
  background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
  color: #fff;
  border: 1px solid rgba(147, 51, 234, 0.4);
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.25);
}

.btn-purple:hover {
  background: linear-gradient(135deg, #9333ea 0%, #a855f7 100%);
  box-shadow: 0 4px 16px rgba(147, 51, 234, 0.45);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1.1rem;
  border-radius: var(--radius-md);
}

.btn-chip {
  padding: 6px 14px;
  font-size: 0.82rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-full);
}

.btn-chip:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

/* Search Section */
.search-section {
  padding: 36px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.search-header h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #ffffff 40%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.search-header p {
  color: var(--text-secondary);
  font-size: 1rem;
}

.search-box {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-wrapper input {
  width: 100%;
  padding: 16px 70px 16px 52px;
  background: rgba(10, 12, 18, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 1rem;
  font-family: inherit;
  transition: var(--transition-fast);
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--primary-red);
  box-shadow: 0 0 0 3px rgba(229, 46, 46, 0.2);
}

.btn-paste {
  position: absolute;
  right: 12px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-paste:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.quick-samples {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.85rem;
}

.sample-label {
  color: var(--text-muted);
}

.sample-chip {
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.sample-chip:hover {
  border-color: var(--primary-red);
  color: #fff;
  background: rgba(229, 46, 46, 0.1);
}

/* Options Bar */
.options-bar {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.option-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

.custom-select {
  background: rgba(10, 12, 18, 0.8);
  border: 1px solid var(--card-border);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
}

.custom-select:focus {
  border-color: var(--primary-red);
}

/* Toggle switch */
.checkbox-item {
  cursor: pointer;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: 0.3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary-red);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.toggle-text {
  display: flex;
  flex-direction: column;
}

.toggle-text .title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
}

.toggle-text .desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dir-path {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Loading State */
.loading-state {
  padding: 48px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.spinner-pulse {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(229, 46, 46, 0.2);
  border-top-color: var(--primary-red);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  will-change: transform;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Drama Section */
.drama-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.drama-card {
  padding: 24px;
  display: flex;
  gap: 24px;
}

.drama-poster-wrapper {
  position: relative;
  width: 160px;
  min-width: 160px;
  height: 220px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.drama-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.drama-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  color: #fff;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.drama-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.drama-title {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 8px;
}

.drama-desc {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
  max-height: 72px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  margin-bottom: 14px;
}

.drama-meta-tags {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.meta-tag {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
}

.vip-tag {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.url-tag {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

/* Episodes Control Bar */
.episodes-control-bar {
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.episodes-count-info h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.episodes-quick-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Episode Grid: Cố định 10 tập/dòng trên laptop, 5 tập/dòng trên di động */
.episodes-grid {
  display: grid !important;
  grid-template-columns: repeat(10, 1fr) !important;
  gap: 6px !important;
}

@media (max-width: 992px) {
  .episodes-grid {
    grid-template-columns: repeat(8, 1fr) !important;
    gap: 5px !important;
  }
}

@media (max-width: 768px) {
  .episodes-grid {
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 4px !important;
  }
}

.episode-card {
  background: rgba(18, 22, 32, 0.75);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 6px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
  user-select: none;
  min-height: 56px;
}

.episode-card:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.episode-card.selected {
  background: rgba(229, 46, 46, 0.16);
  border-color: var(--primary-red);
  box-shadow: 0 0 10px rgba(229, 46, 46, 0.3);
}

.episode-card.downloaded {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.35);
}

.ep-checkbox {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 13px;
  height: 13px;
  accent-color: var(--primary-red);
  cursor: pointer;
  margin: 0;
}

.ep-number {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  margin-top: 1px;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
}

.ep-badge {
  font-size: 0.6rem;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
  line-height: 1.2;
}

.ep-badge.vip {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.ep-badge.free {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.ep-badge.downloaded-badge {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.btn-ep-play {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.4);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  transition: var(--transition-fast);
  line-height: 1.2;
  margin-top: 2px;
}

.btn-ep-play:hover {
  background: #2563eb;
  color: #fff;
  border-color: #3b82f6;
  transform: scale(1.04);
}

/* Thẻ file đã gom (Chunk Card) */
.episode-card.chunk-card {
  background: rgba(12, 38, 54, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.episode-card.chunk-card:hover {
  background: rgba(14, 50, 72, 0.9);
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.episode-card.chunk-card.tron-bo-card {
  background: rgba(88, 28, 135, 0.35);
  border: 1px solid rgba(168, 85, 247, 0.5);
}

.episode-card.chunk-card.tron-bo-card:hover {
  background: rgba(88, 28, 135, 0.55);
  border-color: #c084fc;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.4);
}

.chunk-size-badge {
  font-size: 0.58rem;
  color: #38bdf8;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.12);
  padding: 1px 4px;
  border-radius: 3px;
}

/* Thanh chuyển chế độ xem giữa File Gộp và Tập Lẻ */
.view-mode-toggle-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-toggle-view {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-toggle-view.active {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
}


/* Download Progress Section */
.download-progress-section {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border: 1px solid rgba(229, 46, 46, 0.35);
  box-shadow: 0 0 40px rgba(229, 46, 46, 0.15);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.progress-title-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pulse-indicator {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: var(--primary-red);
  box-shadow: 0 0 0 rgba(229, 46, 46, 0.6);
  animation: pulse 1.5s infinite;
  will-change: box-shadow;
  transform: translateZ(0);
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(229, 46, 46, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(229, 46, 46, 0); }
  100% { box-shadow: 0 0 0 0 rgba(229, 46, 46, 0); }
}

.progress-title-block h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.progress-title-block p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.progress-bars-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.progress-bar-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.progress-track {
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #e52e2e 0%, #ff5252 100%);
  border-radius: var(--radius-full);
  transition: width 0.25s ease;
}

.track-secondary {
  height: 6px;
}

.fill-secondary {
  background: linear-gradient(90deg, #3b82f6 0%, #00f2fe 100%);
}

.progress-meta-row {
  display: flex;
  gap: 24px;
  font-size: 0.85rem;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
}

.meta-item {
  display: flex;
  gap: 6px;
}

.meta-label {
  color: var(--text-muted);
}

.meta-value {
  color: #fff;
  font-weight: 600;
}

.folder-link {
  color: var(--accent-cyan);
  font-family: monospace;
}

/* Log Window */
.log-window-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-window-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-clean-log {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
}

.btn-clean-log:hover {
  color: var(--text-secondary);
}

.log-window {
  height: 130px;
  background: rgba(6, 8, 12, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  overflow-y: auto;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-line {
  color: #cbd5e1;
}

.log-line.info { color: #38bdf8; }
.log-line.success { color: #4ade80; }
.log-line.warn { color: #fbbf24; }
.log-line.error { color: #f87171; }

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-dialog {
  width: 100%;
  max-width: 580px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.modal-title-group h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.modal-title-group p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.btn-close-modal {
  background: transparent;
  border: none;
  font-size: 1.8rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.btn-close-modal:hover {
  color: #fff;
}

.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--card-border);
  gap: 10px;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.tab-btn.active {
  color: #fff;
  border-bottom-color: var(--primary-red);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.instruction-box {
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-size: 0.86rem;
  margin-bottom: 20px;
}

.instruction-box h4 {
  color: #fbbf24;
  margin-bottom: 10px;
}

.instruction-box ol {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-secondary);
}

.browser-login-action {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.w-full { width: 100%; }

.launch-msg {
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  text-align: center;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group textarea,
.form-group input {
  background: rgba(10, 12, 18, 0.8);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}

.form-group textarea:focus,
.form-group input:focus {
  border-color: var(--primary-red);
}

.field-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.save-notice {
  text-align: center;
  color: #34d399;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Footer */
.app-footer {
  margin-top: auto;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding-top: 20px;
}

/* Catalog Section */
.catalog-section {
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: 10px;
}

.catalog-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}

.catalog-title-group h2 {
  font-size: 1.7rem;
  font-weight: 800;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #ffffff 30%, #e2e8f0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.catalog-title-group p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 800px;
}

.catalog-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.catalog-badge {
  background: linear-gradient(135deg, rgba(229, 46, 46, 0.2) 0%, rgba(255, 77, 77, 0.1) 100%);
  color: #ff4d4d;
  border: 1px solid rgba(229, 46, 46, 0.35);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.catalog-count-badge {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  border: 1px solid var(--card-border);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
}

/* Catalog Toolbar */
.catalog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.catalog-search-wrapper {
  position: relative;
  flex: 1;
  min-width: 280px;
  max-width: 520px;
}

.catalog-search-wrapper input {
  width: 100%;
  padding: 12px 42px 12px 44px;
  background: rgba(10, 12, 18, 0.7);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: inherit;
  font-size: 0.92rem;
  transition: var(--transition-fast);
}

.catalog-search-wrapper input:focus {
  outline: none;
  border-color: var(--primary-red);
  box-shadow: 0 0 0 3px rgba(229, 46, 46, 0.15);
}

.btn-clear-search {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

.btn-clear-search:hover {
  color: #fff;
}

.catalog-filters-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.catalog-filter-item,
.catalog-sort-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-label,
.sort-label {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

/* Category Pills */
.catalog-categories-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.cat-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  padding: 7px 16px;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.cat-chip:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.cat-chip.active {
  background: linear-gradient(135deg, var(--primary-red) 0%, #ff4d4d 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 3px 12px var(--primary-red-glow);
}

/* Movie Grid */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.movie-card {
  background: rgba(15, 18, 26, 0.7);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition-normal);
  cursor: pointer;
  position: relative;
}

.movie-card:hover {
  transform: translateY(-6px);
  border-color: rgba(229, 46, 46, 0.4);
  box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.7), 0 0 20px rgba(229, 46, 46, 0.15);
}

.movie-cover-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.4);
}

.movie-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.movie-card:hover .movie-cover {
  transform: scale(1.06);
}

/* Floating Badges on Poster */
.badge-views {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.badge-views .eye-icon {
  color: #f87171;
}

.badge-chapters {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  color: #38bdf8;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.movie-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
  gap: 10px;
}

.movie-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}

.movie-card:hover .movie-title {
  color: #ff5252;
}

.movie-tags-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  max-height: 26px;
  overflow: hidden;
}

.small-tag {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

.btn-select-movie {
  width: 100%;
  padding: 8px 12px;
  background: rgba(229, 46, 46, 0.12);
  color: #ff5252;
  border: 1px solid rgba(229, 46, 46, 0.3);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.movie-card:hover .btn-select-movie {
  background: linear-gradient(135deg, var(--primary-red) 0%, #ff4d4d 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px var(--primary-red-glow);
}

.catalog-empty {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

/* Header Actions */
.catalog-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.btn-warning:hover {
  background: rgba(245, 158, 11, 0.25);
  color: #fff;
  border-color: #fbbf24;
}

/* Batch Selection Toolbar */
.batch-control-bar {
  background: rgba(20, 24, 35, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.batch-info-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.batch-icon {
  font-size: 1.2rem;
}

.batch-count-badge {
  font-weight: 700;
  font-size: 0.92rem;
  color: #fbbf24;
}

.batch-action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-category-all {
  background: rgba(56, 189, 248, 0.12) !important;
  color: #38bdf8 !important;
  border-color: rgba(56, 189, 248, 0.3) !important;
}

.btn-category-all:hover {
  background: rgba(56, 189, 248, 0.25) !important;
  color: #fff !important;
}

.btn-batch-run {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #fff !important;
  border: none !important;
  padding: 8px 16px !important;
  font-weight: 700 !important;
  box-shadow: 0 3px 12px rgba(16, 185, 129, 0.3) !important;
}

.btn-batch-run:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.1) !important;
  box-shadow: none !important;
}

/* Nút Upload Telegram to, nổi bật như các nút chọn hàng loạt phía trên */
.btn-telegram-batch {
  background: linear-gradient(135deg, #0088cc 0%, #0284c7 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(56, 189, 248, 0.5) !important;
  padding: 8px 18px !important;
  font-weight: 700 !important;
  font-size: 0.88rem !important;
  border-radius: var(--radius-sm) !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  box-shadow: 0 3px 12px rgba(0, 136, 204, 0.35) !important;
  transition: all 0.2s ease !important;
  letter-spacing: 0.2px !important;
}

.btn-telegram-batch:hover:not(:disabled) {
  background: linear-gradient(135deg, #0299e6 0%, #0369a1 100%) !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.5) !important;
  transform: translateY(-1px) !important;
}

.btn-telegram-batch:disabled {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: var(--text-muted) !important;
  box-shadow: none !important;
  transform: none !important;
}

/* Card Checkbox & Selection State */
.movie-card.batch-selected {
  border-color: #10b981 !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.35) !important;
}

.btn-all-library {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(249, 115, 22, 0.2) 100%) !important;
  color: #fb923c !important;
  border: 1px solid rgba(249, 115, 22, 0.5) !important;
  font-weight: 700 !important;
}

.btn-all-library:hover {
  background: linear-gradient(135deg, #ef4444 0%, #f97316 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.4) !important;
}

.card-select-checkbox {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  width: 22px;
  height: 22px;
  accent-color: #10b981;
  cursor: pointer;
  border-radius: 4px;
}

/* Nút "Thêm phim" chuẩn thiết kế ReelShort */
.load-more-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
  padding: 20px 0;
}

.btn-load-more {
  background: #2b2b2b;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  padding: 12px 42px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.btn-load-more:hover {
  background: #3a3a3a;
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}

.btn-load-more:active {
  transform: translateY(0);
}

.catalog-display-count {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Batch Queue Panel */
.batch-queue-panel {
  background: rgba(12, 15, 24, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.batch-queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 12px;
}

.batch-live-tag {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.batch-queue-title-group h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin: 4px 0;
}

.batch-queue-title-group p {
  font-size: 0.86rem;
  color: var(--text-secondary);
}

.batch-overall-progress-bar-wrapper {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}

.batch-overall-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #10b981);
  transition: width 0.4s ease;
}

.batch-queue-items-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.queue-drama-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.8rem;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.queue-drama-pill.downloading {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #fff;
  font-weight: 700;
}

.queue-drama-pill.completed {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
  color: #34d399;
}

/* Video Player Modal */
.video-modal-dialog {
  width: 90%;
  max-width: 900px;
  background: rgba(12, 16, 24, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.3);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 30px rgba(56, 189, 248, 0.15);
  padding: 24px;
}

.video-player-container {
  position: relative;
  width: 100%;
  max-height: 70vh;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 14px;
}

#mainVideoPlayer {
  width: 100%;
  max-height: 70vh;
  border-radius: var(--radius-sm);
  outline: none;
}

/* Completed Drama Badge on Movie Card */
.badge-completed {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(16, 185, 129, 0.9);
  backdrop-filter: blur(6px);
  color: #fff;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.movie-card.completed-movie {
  border-color: rgba(16, 185, 129, 0.5);
}

.movie-card.completed-movie:hover {
  border-color: #10b981;
  box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.7), 0 0 20px rgba(16, 185, 129, 0.25);
}

/* ==========================================
   ADMIN LOGIN OVERLAY & AUTHENTICATION STYLES
   ========================================== */
.admin-login-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(11, 13, 19, 0.92);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeInLogin 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInLogin {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 36px 30px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(229, 46, 46, 0.25);
  background: rgba(18, 22, 33, 0.95);
  box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.8), 0 0 40px rgba(229, 46, 46, 0.15);
  text-align: center;
}

.login-header {
  margin-bottom: 26px;
}

.logo-badge-lg {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--primary-red), #b91c1c);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 10px 25px var(--primary-red-glow);
}

.login-header h2 {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.login-form {
  text-align: left;
}

.login-form .form-group {
  margin-bottom: 18px;
}

.login-form label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.login-form input {
  width: 100%;
  padding: 12px 14px;
  background: rgba(10, 13, 20, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: var(--transition-fast);
}

.login-form input:focus {
  border-color: var(--primary-red);
  box-shadow: 0 0 0 3px var(--primary-red-glow);
  outline: none;
}

.login-hint {
  margin-top: 18px;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

.login-hint code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  color: #38bdf8;
}

.admin-nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-play-movie {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #34d399 !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
}

.btn-play-movie:hover {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #fff !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4) !important;
}

/* Downloaded Episode Styling & In-grid Play Button */
.episode-card.downloaded {
  border-color: rgba(16, 185, 129, 0.6);
  background: rgba(16, 185, 129, 0.12);
}

.ep-badge.downloaded-badge {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.5);
}

.btn-ep-play {
  margin-top: 6px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.85);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: var(--transition-fast);
}

.btn-ep-play:hover {
  background: #10b981;
  transform: scale(1.05);
}

/* Catalog Header Actions & Language Picker */
.catalog-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.catalog-lang-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(22, 27, 44, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  transition: all 0.2s ease;
}

.catalog-lang-picker:hover {
  border-color: #ef4444;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.25);
}

.lang-globe-icon {
  font-size: 1.15rem;
}

.lang-select-dropdown {
  background: transparent;
  color: #ffffff;
  border: none;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  padding: 4px 0;
}

.lang-select-dropdown option {
  background: #111420;
  color: #ffffff;
  padding: 8px;
}

/* Helpers */
.hidden { display: none !important; }

/* Responsive adjustments */
@media (max-width: 768px) {
  .search-box {
    flex-direction: column;
  }
  .options-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  .drama-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .drama-poster-wrapper {
    width: 140px;
    height: 190px;
  }
  .drama-desc {
    -webkit-line-clamp: 2;
  }
  .catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
  }
}

/* Toast Notification System */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 420px;
  width: calc(100vw - 48px);
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(18, 22, 34, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 0 1px rgba(255, 255, 255, 0.2);
  color: #fff;
  font-family: inherit;
  position: relative;
  overflow: hidden;
  animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: all 0.25s ease;
}

.toast-item.toast-closing {
  animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
  from {
    transform: translateX(110%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toastSlideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(110%);
    opacity: 0;
  }
}

.toast-icon-wrapper {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.toast-title {
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.3;
}

.toast-message {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-line;
}

.toast-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  margin-left: 4px;
  transition: color 0.2s;
  flex-shrink: 0;
}

.toast-close-btn:hover {
  color: #fff;
}

/* Toast types */
.toast-success {
  border-left: 4px solid #10b981;
}
.toast-success .toast-title {
  color: #34d399;
}

.toast-error {
  border-left: 4px solid #ef4444;
}
.toast-error .toast-title {
  color: #f87171;
}

.toast-warning {
  border-left: 4px solid #f59e0b;
}
.toast-warning .toast-title {
  color: #fbbf24;
}

.toast-info {
  border-left: 4px solid #38bdf8;
}
.toast-info .toast-title {
  color: #38bdf8;
}

/* Progress bar inside toast */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.25);
  width: 100%;
  transform-origin: left;
  animation: toastProgress linear forwards;
}

.toast-success .toast-progress { background: #10b981; }
.toast-error .toast-progress { background: #ef4444; }
.toast-warning .toast-progress { background: #f59e0b; }
.toast-info .toast-progress { background: #38bdf8; }

@keyframes toastProgress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* ========================================================
   TELEGRAM BOT & VIP SUBSCRIPTION MODAL STYLES
   ======================================================== */

.modal-dialog-lg {
  max-width: 900px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
}

.title-with-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.status-badge-online {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-badge-offline {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tab-btn-tg {
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn-tg:hover {
  color: #fff;
}

.tab-btn-tg.active {
  color: var(--primary-red);
  border-bottom-color: var(--primary-red);
}

.tg-tab-content {
  display: none;
  padding-top: 16px;
}

.tg-tab-content.active {
  display: block;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.pricing-card {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pricing-card h4 {
  font-size: 1.05rem;
  margin-bottom: 12px;
  color: #fff;
}

.highlight-card {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.05);
}

.sub-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.form-inline-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.form-inline-row input {
  flex: 1;
  min-width: 220px;
}

.manual-add-box {
  padding: 14px;
  margin-bottom: 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
}

.manual-add-box h4 {
  font-size: 0.9rem;
  color: #e2e8f0;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 8px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.data-table th {
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-secondary);
  font-weight: 600;
}

.data-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.status-badge-active,
.status-badge-online {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.status-badge-expired,
.status-badge-offline {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.modal-dialog-lg {
  max-width: 880px;
  max-height: 90vh;
  overflow-y: auto;
}

.title-with-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.action-btn-row {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.tab-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.text-muted {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: all 0.2s ease;
}

.radio-label:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.radio-label input[type="radio"] {
  accent-color: var(--primary-red);
}

.upload-progress-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.file-info-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* ==========================================
   TELEGRAM REAL-TIME UPLOAD MONITOR & BUTTONS
   ========================================== */

/* Nút Batch Upload Telegram */
.btn-telegram-batch {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border: 1px solid rgba(56, 189, 248, 0.4);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
  transition: all 0.2s ease;
}

.btn-telegram-batch:not(:disabled):hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  border-color: #38bdf8;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.5);
}

.btn-telegram-batch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* Nhóm nút bấm trên thẻ phim Catalog */
.movie-card-btn-group {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}

.movie-card-btn-group .btn-select-movie {
  flex: 1;
}

.btn-card-upload-tg {
  background: rgba(2, 132, 199, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-card-upload-tg:hover {
  background: rgba(2, 132, 199, 0.3);
  border-color: #38bdf8;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

/* Bảng Giám Sát Tiến Trình Upload Telegram */
.telegram-upload-panel {
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), rgba(12, 15, 24, 0.98));
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.6), 0 0 20px rgba(56, 189, 248, 0.15);
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.upload-monitor-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}

.upload-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: #38bdf8;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px #38bdf8;
  animation: pulseDot 1.4s ease-in-out infinite;
}

@keyframes pulseDot {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
  100% { opacity: 1; transform: scale(1); }
}

.upload-monitor-title-group h3 {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  margin: 4px 0;
}

.upload-monitor-title-group p {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.upload-monitor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-close-monitor {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.2s ease;
}

.btn-close-monitor:hover {
  color: #fff;
}

.upload-monitor-progress-wrapper {
  margin-bottom: 12px;
}

.upload-monitor-progress-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.upload-monitor-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7 0%, #38bdf8 50%, #34d399 100%);
  border-radius: 20px;
  transition: width 0.35s ease;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
}

.upload-monitor-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.upload-monitor-stats #tgUploadPercentText {
  font-weight: 800;
  color: #38bdf8;
  font-size: 0.95rem;
}

.upload-monitor-log-box {
  margin-top: 14px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  max-height: 160px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.8rem;
}

.upload-log-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.upload-log-line {
  color: var(--text-secondary);
  line-height: 1.4;
}

.upload-log-line.success {
  color: #34d399;
}

.upload-log-line.info {
  color: #38bdf8;
}

.upload-log-line.warn {
  color: #fbbf24;
}

.upload-log-line.error {
  color: #f87171;
}


