/*Tách biệt hoàn toàn giao diện Admin.
   ADMIN.CSS - GIAO DIỆN QUẢN TRỊ VIÊN
   ============================================ */

#adminPage {
  padding-top: 0 !important;
}

.admin-layout {
  display: flex;
  min-height: 100vh;
  padding-top: 100px;
}

/* --- SIDEBAR (THANH MENU TRÁI) --- */
.admin-sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: var(--spacing-lg) 0;
  position: fixed;
  top: 100px;
  bottom: 0;
  left: 0;
  overflow-y: auto;
  z-index: 100;
  transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), 
              background-color 0.3s ease,
              transform 0.3s ease;
  will-change: width, transform;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 10px;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.admin-nav-item:hover,
.admin-nav-item.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.admin-nav-item.active {
  border-left: 3px solid var(--accent-primary);
  background: linear-gradient(
    90deg,
    rgba(229, 9, 20, 0.1) 0%,
    transparent 100%
  );
}

.admin-nav-item i {
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
}

/* --- PC: COLLAPSED STATE (THU NHỎ) --- */
.admin-sidebar.collapsed {
  width: 80px;
  overflow: visible;
}
.admin-sidebar.collapsed .admin-nav-item span {
  display: none;
}
.admin-sidebar.collapsed .admin-nav-item {
  justify-content: center;
  padding: 15px 0;
}
.admin-sidebar.collapsed .admin-nav-item:hover {
  background: var(--accent-primary);
  color: #fff;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  margin: 0 auto;
}

/* --- CONTENT AREA (NỘI DUNG PHẢI) --- */
.admin-content {
  flex: 1;
  margin-left: 260px;
  padding: 30px;
  transition: margin-left 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), 
              width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  will-change: margin-left, width;
}

.admin-content.expanded {
  margin-left: 80px;
  width: calc(100% - 80px);
}

/* Tabs Logic */
.admin-panel {
  display: none !important;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.admin-panel.active {
  display: block !important;
  opacity: 1;
  animation: slideUpFade 0.4s ease forwards;
}

@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- STATS CARDS (THẺ THỐNG KÊ) --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: var(--spacing-lg);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-xl);
}
.stat-icon.movies {
  background: rgba(229, 9, 20, 0.2);
  color: var(--accent-primary);
}
.stat-icon.views {
  background: rgba(0, 212, 255, 0.2);
  color: var(--accent-secondary);
}
.stat-icon.revenue {
  background: rgba(0, 255, 136, 0.2);
  color: var(--success);
}
.stat-icon.users {
  background: rgba(255, 170, 0, 0.2);
  color: var(--warning);
}

.stat-info h3 {
  font-size: var(--font-xxl);
  margin-bottom: var(--spacing-xs);
}
.stat-info p {
  color: var(--text-secondary);
  font-size: var(--font-sm);
}

/* --- ADMIN TABLES (BẢNG DỮ LIỆU) --- */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.admin-table th,
.admin-table td {
  padding: 15px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.admin-table th {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.admin-table tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Quy tắc an toàn cho mọi ảnh trong bảng admin */
.admin-table td img {
    max-width: 50px;
    height: auto;
    object-fit: cover;
    border-radius: 4px;
}

.admin-table-poster {
  width: 50px;
  height: 75px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
}

.admin-table tr:hover .admin-table-poster {
    transform: scale(1.05);
}


/* Admin Header & Search */
.admin-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-xl);
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.admin-mobile-toggle {
  display: none; /* Ẩn trên PC */
  background: none;
  border: none;
  color: var(--accent-primary);
  font-size: 1.2rem;
  padding: 5px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.admin-mobile-toggle i {
  transition: transform 0.3s ease;
}

/* Khi sidebar active (mở) thì xoay mũi tên lại nếu cần, 
   nhưng ở đây mobile toggle chỉ dùng để mở, overlay dùng để đóng.
   Tuy nhiên ta có thể thêm class để xoay */
.admin-sidebar.active ~ .admin-content .admin-mobile-toggle i {
  transform: rotate(180deg);
}

.search-filter {
  display: flex;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

/* Movie Filter Grid Optimization */
.movie-filter-grid {
  display: grid;
  grid-template-columns: 2fr repeat(5, 1fr);
  gap: 12px;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 15px;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.movie-filter-grid .search-box {
  width: 100%;
}

.movie-filter-grid .search-box input {
  min-width: unset;
  width: 100%;
}

.movie-filter-grid .form-select {
  width: 100%;
  padding: 8px 10px;
  font-size: 0.88rem;
  background-color: var(--bg-secondary);
}

/* Country Badge Decoration */
.country-badge-v2 {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.2s;
}

.country-badge-v2:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.1);
}

.country-badge-v2 .flag-icon {
    font-size: 1rem;
    line-height: 1;
}

/* Flag Waving Animation */
@keyframes flag-wave {
    0% { transform: rotate(0deg) skewY(0deg); }
    25% { transform: rotate(2deg) skewY(1deg); }
    50% { transform: rotate(0deg) skewY(0deg); }
    75% { transform: rotate(-2deg) skewY(-1deg); }
    100% { transform: rotate(0deg) skewY(0deg); }
}

/* Đã tắt animation flag-wave theo yêu cầu để giảm giật lag */
.admin-table td .flag-icon-img {
    width: 18px !important;
    height: 10px !important; /* Tỉ lệ ~16:9 */
    object-fit: cover !important;
    border-radius: 2px !important; /* Phá bỏ hình tròn nếu bị ghi đè */
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    transform-origin: left center;
    vertical-align: middle;
    margin-right: 4px;
    display: inline-block;
}

@media (max-width: 1200px) {
  .movie-filter-grid {
    grid-template-columns: 1.5fr repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .movie-filter-grid {
    grid-template-columns: 1fr 1fr;
    padding: 12px;
  }
  .movie-filter-grid .search-box {
    grid-column: span 2;
  }
}
.search-box {
  position: relative;
}
.search-box input {
  padding-left: 40px;
  min-width: 250px;
}
.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* ============================================
   ADMIN MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  /* Sidebar ẩn trên mobile */
  .admin-sidebar {
    display: none;
  }

  /* Content chiếm full width */
  .admin-content {
    margin-left: 0 !important;
    padding: 15px !important;
    width: 100% !important;
    padding-top: 15px !important;
  }

  .admin-layout {
    padding-top: 70px !important;
  }

  /* Header panel: xếp dọc */
  .admin-panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Search box nhỏ hơn */
  .search-box input {
    min-width: 100% !important;
  }
  .search-filter {
    width: 100%;
  }
  .search-filter .form-select {
    width: 100%;
  }

  /* BẢNG DỮ LIỆU: Cho phép cuộn ngang */
  .admin-panel {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 20px;
  }

  .admin-table {
    min-width: 900px; /* Tăng min-width để 10 cột không bị quá chật */
    overflow: visible !important;
  }

  .admin-table th,
  .admin-table td {
    padding: 12px 10px;
    font-size: 13px;
    white-space: normal; /* Cho phép xuống dòng ở một số nội dung */
  }

  .admin-table td:nth-child(2) {
      min-width: 180px; /* Cột tên cần rộng hơn */
  }

  .admin-actions {
      flex-direction: row !important; /* Trên mobile nút hành động nên nằm ngang để dễ bấm */
      justify-content: center;
  }


  /* Stats cards xếp 2 cột trên mobile */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .stat-card {
    padding: 12px;
  }
  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
  .stat-info h3 {
    font-size: 18px;
  }
  .stat-info p {
    font-size: 11px;
  }
}

/* --- IMAGE UPLOAD & PREVIEW --- */
.input-with-action {
  display: flex !important;
  gap: 8px;
  margin-bottom: 5px;
}

.btn-upload {
  white-space: nowrap;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-upload:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.image-upload-preview {
  margin-top: 10px;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px;
  border-radius: var(--border-radius-sm);
  display: inline-block;
  border: 1px dashed var(--border-color);
}

.image-upload-preview img {
  max-height: 120px;
  display: block;
  border-radius: 4px;
  object-fit: contain;
}

/* --- ADMIN NOTIFICATION PANEL --- */
/* Hộp gửi thông báo */
.admin-notif-send-box {
  background: linear-gradient(135deg, rgba(77, 184, 255, 0.08) 0%, rgba(77, 184, 255, 0.02) 100%);
  border: 1px solid rgba(77, 184, 255, 0.15);
  border-radius: 12px;
  padding: 20px 24px;
}

/* Thống kê thông báo */
.admin-notif-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.admin-notif-stat i {
  font-size: 0.8rem;
  opacity: 0.7;
}

/* Status Badges - Premium Look */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-badge.public {
  background: rgba(46, 204, 113, 0.2);
  color: #2ecc71;
  border-color: rgba(46, 204, 113, 0.3);
}

.status-badge.hidden {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
  border-color: rgba(231, 76, 60, 0.3);
}

.status-badge.pending {
  background: rgba(241, 196, 15, 0.2);
  color: #f1c40f;
  border-color: rgba(241, 196, 15, 0.3);
}

.status-badge.free {
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
    border-color: rgba(52, 152, 219, 0.3);
}

.movie-type-badge {
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    font-weight: 600;
}

/* Badge loại thông báo */
.notif-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.notif-type-badge.system {
  background: rgba(77, 184, 255, 0.15);
  color: #4db8ff;
}
.notif-type-badge.new_movie {
  background: rgba(229, 9, 20, 0.15);
  color: #ff6b6b;
}
.notif-type-badge.promotion {
  background: rgba(255, 193, 7, 0.15);
  color: #ffc107;
}
.notif-type-badge.maintenance {
  background: rgba(108, 117, 125, 0.15);
  color: #adb5bd;
}
.notif-type-badge.vip_request {
  background: rgba(255, 193, 7, 0.15);
  color: #ffc107;
}
.notif-type-badge.vip_approved {
  background: rgba(81, 207, 102, 0.15);
  color: #51cf66;
}

/* Hộp lập lịch thông báo */
.admin-notif-schedule-box {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.08) 0%, rgba(255, 193, 7, 0.02) 100%);
  border: 1px solid rgba(255, 193, 7, 0.15);
  border-radius: 12px;
  padding: 20px 24px;
  margin-top: 20px;
}

/* Badge trạng thái lịch hẹn */
.sched-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.sched-status.pending {
  background: rgba(255, 193, 7, 0.15);
  color: #ffc107;
}
.sched-status.sent {
  background: rgba(81, 207, 102, 0.15);
  color: #51cf66;
}
.sched-status.paused {
  background: rgba(108, 117, 125, 0.15);
  color: #adb5bd;
}

/* Responsive schedule form trên mobile */
@media (max-width: 768px) {
  .admin-notif-schedule-box [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
}

/* --- SMART ACTOR SELECTION --- */
.smart-actor-wrapper {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 8px;
  min-height: 48px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  position: relative;
}

.smart-actor-wrapper:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(229, 9, 20, 0.2);
}

.actor-pills-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.actor-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 4px 12px 4px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-primary);
  animation: slideIn 0.2s ease-out;
}

.actor-pill.fallback {
  padding: 4px 12px;
  border-style: dashed;
}

.actor-pill img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.actor-pill-remove {
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.actor-pill-remove:hover {
  color: var(--danger);
}

.smart-actor-input {
  flex: 1;
  min-width: 150px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1rem;
  padding: 4px 8px;
  outline: none;
}

.smart-actor-input::placeholder {
  color: var(--text-muted);
}

.actor-suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  margin-top: 4px;
  max-height: 250px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: var(--shadow-md);
  display: none;
}

.actor-suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 15px;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.actor-suggestion-item:last-child {
  border-bottom: none;
}

.actor-suggestion-item:hover,
.actor-suggestion-item.active {
  background: var(--bg-tertiary);
}

.actor-suggestion-item img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.actor-suggestion-info {
  display: flex;
  flex-direction: column;
}

.actor-suggestion-name {
  font-weight: 500;
  color: var(--text-primary);
}

.actor-suggestion-id {
  font-size: 0.8rem;
  color: var(--text-muted);
}


/* --- SMART COUNTRY SUGGESTIONS --- */
.suggestions-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 var(--border-radius-sm) var(--border-radius-sm);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.suggestion-item {
  padding: 10px 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.active {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding-left: 20px;
}

.suggestion-item.warning-item {
  background: rgba(255, 68, 68, 0.1);
  border-left: 3px solid #ff4444;
}

.suggestion-item.warning-item:hover {
  background: rgba(255, 68, 68, 0.2);
}

.suggestion-item i {
  color: var(--accent-primary, #e50914);
  font-size: 0.9rem;
  margin-right: 10px;
}

/* Tùy chỉnh thanh cuộn cho danh sách gợi ý */
.suggestions-list::-webkit-scrollbar {
  width: 5px;
}
.suggestions-list::-webkit-scrollbar-track {
  background: transparent;
}
.suggestions-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}
.suggestions-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
/* --- BULK ACTIONS BAR --- */
.bulk-actions-bar {
  display: none; /* Hiện khi có item được chọn */
  position: sticky;
  top: 100px;
  background: rgba(229, 9, 20, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(229, 9, 20, 0.3);
  padding: 12px 20px;
  border-radius: var(--border-radius);
  margin-bottom: 20px;
  z-index: 99;
  justify-content: space-between;
  align-items: center;
  animation: slideDownFade 0.3s ease;
}

.bulk-actions-bar.active {
  display: flex;
}

.bulk-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.selected-count {
  font-weight: 600;
  color: var(--accent-primary);
}

.bulk-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .bulk-actions-bar {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
    top: 70px;
  }
}

/* --- DRAG & DROP EPISODES --- */
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 14px;
}
.drag-handle:active {
  cursor: grabbing;
}
.sortable-ghost {
  opacity: 0.4;
  background: rgba(229, 9, 20, 0.1) !important;
}
.quick-edit-input {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid transparent !important;
  color: #fff !important;
  width: 60px !important;
  text-align: center;
  padding: 4px !important;
  border-radius: 4px;
}
.quick-edit-input:focus {
  border-color: var(--accent-primary) !important;
  background: rgba(0, 0, 0, 0.3) !important;
}
.quick-edit-input.is-single {
  width: 100px !important;
}

/* --- COMPARE TABLE (API IMPORT) --- */
.compare-table {
  width: 100%;
  border-collapse: collapse;
}

.compare-table th {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  padding: 12px 20px;
}

.compare-table td {
  padding: 15px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.compare-label {
  font-weight: 600;
  color: var(--text-secondary);
}

.compare-old {
  color: var(--text-muted);
  opacity: 0.8;
}

.compare-new {
  color: var(--text-primary);
  font-weight: 500;
}

.compare-highlight {
  background: rgba(81, 207, 102, 0.1);
  color: #51cf66 !important;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(81, 207, 102, 0.2);
}

.compare-empty {
  font-style: italic;
  opacity: 0.4;
}

.compare-avatar-img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

/* --- ACTOR BADGES --- */
.badge-new {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #ff4444;
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  margin-left: 8px;
  animation: pulse-new 2s infinite;
  vertical-align: middle;
  box-shadow: 0 0 10px rgba(255, 68, 68, 0.4);
}

@keyframes pulse-new {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}
/* Category Tags in Avatar Library */
.category-tag {
    transition: all 0.2s ease;
}

.category-tag:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: var(--accent-primary) !important;
}

.category-tag i:hover {
    color: var(--accent-primary) !important;
    transform: scale(1.2);
}

/* --- AVATAR LIBRARY ENHANCEMENTS --- */
.avatar-filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.avatar-filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.avatar-filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.avatar-filter-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(229, 9, 20, 0.3);
}

.avatar-item .avatar-cat-select {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 10px;
    padding: 4px;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    outline: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.avatar-item .avatar-cat-select:hover {
    background: #000;
    color: var(--accent-primary);
}

.avatar-item .avatar-cat-select option {
    background: #1a1a1a;
    color: #fff;
    font-size: 12px;
}

/* --- AVATAR MULTI-SELECT --- */
.avatar-item .avatar-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 20px;
    height: 20px;
    z-index: 5;
    cursor: pointer;
    accent-color: var(--accent-primary);
    opacity: 0.3;
    transition: opacity 0.2s ease;
}

.avatar-item:hover .avatar-checkbox,
.avatar-item .avatar-checkbox:checked {
    opacity: 1;
}

#avatarBulkActionsBar {
    display: none;
    position: sticky;
    top: 100px;
    background: rgba(252, 213, 53, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(252, 213, 53, 0.3);
    padding: 12px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    z-index: 99;
    justify-content: space-between;
    align-items: center;
    animation: slideDownFade 0.3s ease;
}

#avatarBulkActionsBar.active {
    display: flex;
}

#avatarBulkActionsBar .bulk-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

#avatarBulkActionsBar .selected-count strong {
    color: var(--accent-primary);
}

#avatarBulkActionsBar .bulk-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Biểu tượng nguồn ảnh (Cloudinary / Link) - Dùng chung cho Avatar và Phim */
.image-source-indicator {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 22px;
    height: 22px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    z-index: 5;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: help;
    transition: all 0.2s ease;
}

/* Điều chỉnh vị trí riêng cho Avatar Item (vì có checkbox ở left:5px) */
.avatar-item .image-source-indicator {
    left: 30px;
}

/* Định dạng cho khung preview phim */
.image-upload-preview {
    position: relative;
    display: inline-block;
}

.image-source-indicator.cloudinary {
    color: #4db8ff;
    border-color: rgba(77, 184, 255, 0.3);
    box-shadow: 0 0 10px rgba(77, 184, 255, 0.2);
}

.image-source-indicator.direct-link {
    color: #aaa;
}

.image-source-indicator:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* --- MOVIE SELECTION GRID (EPISODE MANAGEMENT) --- */
.movie-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    margin-top: 10px;
    max-height: 500px;
    overflow-y: auto;
    padding: 5px;
}

.movie-selection-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.movie-selection-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.movie-selection-card .poster-wrapper {
    position: relative;
    aspect-ratio: 2/3;
    width: 100%;
}

.movie-selection-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.movie-selection-card .status-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 10px;
    padding: 3px 6px;
    border-radius: 4px;
    z-index: 2;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    text-transform: uppercase;
}

.status-badge.bg-danger { background: #ff4757; color: #fff; } /* Chưa có tập */
.status-badge.bg-warning { background: #ffa502; color: #111; } /* Đang cập nhật */
.status-badge.bg-success { background: #2ed573; color: #fff; } /* Hoàn tất */
.status-badge.bg-info { background: #1e90ff; color: #fff; } /* Phim lẻ */

.movie-selection-card .info {
    padding: 8px;
    flex: 1;
}

.movie-selection-card .title {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #eee;
}

.movie-selection-card .stats {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
}

/* Tablet/Mobile optimization */
@media (max-width: 768px) {
    .movie-selection-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 10px;
    }
}

/* --- PAGINATION (PHÂN TRANG) --- */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-top: 25px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    flex-wrap: wrap;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-right: 15px;
}

.btn-page {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-page:hover:not(:disabled) {
    background: var(--bg-card);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-2px);
}

.btn-page.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
    box-shadow: 0 4px 10px rgba(229, 9, 20, 0.3);
}

.btn-page:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-page-nav {
    width: auto;
    padding: 0 15px;
    gap: 6px;
}

/* Nhảy trang nhanh */
.pagination-jump {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
    padding-left: 20px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.jump-input {
    width: 60px;
    height: 38px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: #fff;
    border-radius: 8px;
    text-align: center;
    outline: none;
    transition: all 0.2s;
    font-weight: 600;
}

.jump-input:focus {
    border-color: var(--accent-primary);
}

.btn-jump {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0 12px;
    height: 38px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-jump:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #fff;
}

@media (max-width: 768px) {
    .pagination-container {
        justify-content: center;
        gap: 10px;
        padding: 12px 10px;
    }
    .pagination-info {
        margin-right: 0;
        margin-bottom: 5px;
        width: 100%;
        text-align: center;
    }
    .pagination-controls {
        gap: 5px;
    }
    .pagination-jump {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        width: 100%;
        justify-content: center;
        margin-top: 5px;
    }
    .btn-page {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    .jump-input, .btn-jump {
        height: 32px;
        font-size: 0.8rem;
    }
    .btn-page-nav span {
        display: none; /* Ẩn chữ "Trực" "Sau" trên mobile */
    }
}
/* --- BILL VIEWPORT MODAL --- */
.bill-viewport-modal {
    max-width: 90vw !important;
    width: auto !important;
    max-height: 90vh;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.bill-viewport-modal .modal-header {
    background: rgba(0, 0, 0, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 12px 12px 0 0;
}

.bill-viewport-body {
    padding: 0 !important;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: #000;
    border-radius: 0 0 12px 12px;
}

.bill-viewport-body img {
    max-width: 100%;
    max-height: calc(90vh - 60px);
    object-fit: contain;
    display: block;
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.bill-viewport-body img:active {
    cursor: grabbing;
}

/* Mobile optimization for Bill Viewport */
@media (max-width: 768px) {
    .bill-viewport-modal {
        max-width: 95vw !important;
    }
}
