/* ==========================================================================
   MY MOVIE TRACKER - PHONG CÁCH DARK CINEMA (BƯỚC 1)
   Giao diện tinh gọn, hiện đại, dễ đọc, ưu tiên trải nghiệm người dùng.
   ========================================================================== */

/* 1. NẠP PHÔNG CHỮ HIỆN ĐẠI (GOOGLE FONTS) */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Outfit:wght@500;600;700;800&display=swap');

/* 2. BIẾN MÀU SẮC & GIAO DIỆN (DESIGN TOKENS) */
:root {
  /* Bảng màu nền rạp chiếu phim (Cinema Dark) */
  --bg-main: #0B0E17;
  --bg-surface: #131826;
  --bg-card: #181F30;
  --bg-card-hover: #1E273D;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);

  /* Màu điểm nhấn (Accents) */
  --primary: #6366F1;          /* Tím Indigo điện ảnh */
  --primary-hover: #4F46E5;
  --accent-green: #10B981;      /* Xanh ngọc - Tập mới */
  --accent-amber: #F59E0B;      /* Vàng cam - Lịch chiếu / Đánh giá */
  --accent-red: #EF4444;        /* Đỏ - Cảnh báo */

  /* Màu chữ (Typography) */
  --text-primary: #F8FAFC;      /* Trắng sáng dễ đọc */
  --text-secondary: #94A3B8;    /* Xám bạc */
  --text-muted: #64748B;        /* Xám mờ */

  /* Hiệu ứng bo góc và bóng đổ */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.5);
  --transition: all 0.25s ease;
}

/* 3. RESET CƠ BẢN */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Thanh cuộn tối màu tùy chỉnh */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #2D3748;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Khung nội dung chính */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* 4. HEADER & THANH ĐIỀU HƯỚNG TRÊN CÙNG */
.app-header {
  background: rgba(19, 24, 38, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.9rem 0;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

/* Logo */
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), #EC4899);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.25rem;
}

.brand-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #FFFFFF;
}

.brand-subtitle {
  font-size: 0.7rem;
  background: rgba(99, 102, 241, 0.15);
  color: #A5B4FC;
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  margin-left: 0.5rem;
  font-weight: 600;
}

/* Nút hành động chính */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.btn-backup {
  font-size: 0.85rem;
  padding: 0.55rem 0.95rem;
  background: rgba(255, 255, 255, 0.05);
  color: #E2E8F0;
  border: 1px solid var(--border-color);
}

.btn-backup:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
  color: #FFFFFF;
}

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

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

/* 5. KHU VỰC THỐNG KÊ TỔNG QUAN */
.stats-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.stat-box:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.stat-icon.purple { background: rgba(99, 102, 241, 0.15); color: var(--primary); }
.stat-icon.amber { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.stat-icon.blue { background: rgba(59, 130, 246, 0.15); color: #60A5FA; }

.stat-number {
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
}

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

/* 6. KHU VỰC TẬP MỚI CẬP NHẬT */
.section-new-releases {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.08) 0%, rgba(19, 24, 38, 0.6) 100%);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2.5rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.badge-new-pulse {
  background: var(--accent-green);
  color: #000;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.new-releases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.new-release-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
}

.new-release-item:hover {
  border-color: var(--accent-green);
  background: var(--bg-card-hover);
}

.new-release-poster {
  width: 54px;
  height: 76px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.new-release-info {
  flex: 1;
  min-width: 0;
}

.new-release-title {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.new-release-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-green);
  background: rgba(16, 185, 129, 0.12);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
}

.new-release-badge.badge-today {
  background: linear-gradient(135deg, #EF4444, #DC2626) !important;
  color: #FFFFFF !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  animation: badgePulseToday 1.8s infinite ease-in-out !important;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.5);
}

.new-release-item.item-airing-today {
  border-color: rgba(239, 68, 68, 0.45);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(24, 31, 48, 0.95));
}

.new-release-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.new-release-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* 7. THANH BỘ LỌC PHIM & TÌM KIẾM */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.filter-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.filter-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.tab-button {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: var(--transition);
}

.tab-button:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.tab-button.active {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

/* Hàng lọc Thể loại (Genre Filter) */
.genre-filter-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-wrap: wrap;
}

.genre-filter-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.genre-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  overflow-x: auto;
}

.genre-btn {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.genre-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  color: #FFFFFF;
  border-color: rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}

.genre-btn.active {
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  color: #FFFFFF;
  border-color: transparent;
  box-shadow: 0 3px 12px rgba(99, 102, 241, 0.4);
}

/* Nhóm điều khiển: Sắp xếp Dropdown & Tìm kiếm */
.filter-controls-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.sort-box {
  position: relative;
  display: flex;
  align-items: center;
}

.sort-icon {
  position: absolute;
  left: 0.85rem;
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.9rem;
}

.sort-select {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.55rem 2rem 0.55rem 2.2rem;
  border-radius: var(--radius-full);
  font-size: 0.86rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394A3B8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 0.85rem;
}

.sort-select:hover {
  border-color: rgba(99, 102, 241, 0.4);
}

.sort-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.sort-select option {
  background-color: var(--bg-card);
  color: var(--text-primary);
  padding: 0.5rem;
}

.search-box {
  position: relative;
  min-width: 250px;
}

.search-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.55rem 1rem 0.55rem 2.25rem;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-family: inherit;
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* 8. DANH SÁCH PHIM DẠNG CARD (MOVIE GRID) */
.movie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3.5rem;
}

.movie-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.movie-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.card-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background-color: #0E121B;
}

.card-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  transition: transform 0.4s ease;
}

.movie-card:hover .card-poster {
  transform: scale(1.05);
}

.card-badge-status {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  backdrop-filter: blur(8px);
}

.status-watching { background: rgba(99, 102, 241, 0.9); color: #fff; }
.status-completed { background: rgba(16, 185, 129, 0.9); color: #fff; }
.status-on_hold { background: rgba(245, 158, 11, 0.9); color: #fff; }

.card-score {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(0, 0, 0, 0.7);
  color: #FCD34D;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
}

/* Badge TẬP MỚI HÔM NAY trên thẻ phim */
@keyframes badgePulseToday {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  50% {
    transform: scale(1.04);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.95);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
}

.card-badge-today {
  position: absolute;
  bottom: 0.65rem;
  left: 0.65rem;
  background: linear-gradient(135deg, #EF4444, #B91C1C);
  color: #FFFFFF;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.22rem 0.55rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.03em;
  animation: badgePulseToday 1.8s infinite ease-in-out;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.5);
  z-index: 4;
  border: 1px solid rgba(255, 255, 255, 0.25);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.card-airing-today {
  border-color: rgba(239, 68, 68, 0.45) !important;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.18) !important;
}

.countdown-today {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #F87171 !important;
  border: 1px solid rgba(239, 68, 68, 0.35) !important;
  animation: badgePulseToday 2s infinite ease-in-out;
}

.card-body {
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.genre-tag {
  font-size: 0.7rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Thanh tiến độ xem */
.progress-box {
  margin-top: auto;
  padding-top: 0.5rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
}

.progress-text {
  font-weight: 600;
  color: var(--text-primary);
}

.progress-pct {
  color: #818CF8;
  font-weight: 700;
}

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

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #EC4899);
  border-radius: var(--radius-full);
}

.progress-fill.done {
  background: var(--accent-green);
}

/* Thanh thao tác nhanh trên thẻ phim (CRUD Actions: Xem, +1 tập, Sửa, Xóa) */
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  margin-top: 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.btn-watch-movie {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #2563EB, #1D4ED8);
  color: #FFFFFF;
  border: 1px solid rgba(59, 130, 246, 0.4);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn-watch-movie:hover {
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  color: #FFFFFF;
}

.btn-track-ep {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  background: rgba(99, 102, 241, 0.15);
  color: #C7D2FE;
  border: 1px solid rgba(99, 102, 241, 0.35);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  white-space: nowrap;
}

.btn-track-ep:hover {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-track-ep.done {
  background: rgba(16, 185, 129, 0.12);
  color: #6EE7B7;
  border-color: rgba(16, 185, 129, 0.3);
  cursor: default;
  pointer-events: none;
}

.card-icon-btns {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-card-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-card-icon:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  transform: translateY(-1px);
}

.btn-card-icon.delete:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  color: #FCA5A5;
}

/* 9. KHU VỰC LỊCH PHÁT HÀNH SẮP TỚI */
.section-schedule {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 3.5rem;
}

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.schedule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  gap: 1rem;
  transition: var(--transition);
}

.schedule-row:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: var(--bg-card-hover);
}

.schedule-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.schedule-poster {
  width: 44px;
  height: 62px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.schedule-title {
  font-size: 0.98rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

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

.schedule-right {
  text-align: right;
}

.countdown-tag {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.12);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.25rem;
}

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

/* 10. THÔNG BÁO TẠM THỜI (HỖ TRỢ NGƯỜI DÙNG) */
.notice-banner {
  background: rgba(99, 102, 241, 0.1);
  border: 1px dashed rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.25rem;
  margin-bottom: 1.75rem;
  font-size: 0.88rem;
  color: #C7D2FE;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* 11. FOOTER */
.app-footer {
  border-top: 1px solid var(--border-color);
  padding: 2rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* 12. MODAL FORM THÊM & SỬA PHIM (DARK CINEMA GLASSPHISM) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 7, 13, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.94) translateY(16px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-card {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(24, 31, 48, 0.5);
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-icon {
  font-size: 1.5rem;
  background: rgba(99, 102, 241, 0.15);
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.modal-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

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

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

.modal-form {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-label .required {
  color: var(--accent-red);
}

.form-input {
  width: 100%;
  background: #0E121C;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-family: inherit;
  transition: var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  background: #111724;
}

.form-select {
  cursor: pointer;
}

.form-select option {
  background: #131826;
  color: #fff;
}

.form-help {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* Checkbox */
.form-checkbox-wrap {
  background: rgba(16, 185, 129, 0.08);
  border: 1px dashed rgba(16, 185, 129, 0.3);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  margin-top: 0.25rem;
}

.checkbox-container {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.84rem;
  font-weight: 600;
  color: #A7F3D0;
}

.checkbox-container input {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent-green);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  margin-top: 0.5rem;
}

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

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

/* 14. TOAST NOTIFICATION POPUP */
.toast-popup {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #10B981;
  color: #064E3B;
  padding: 0.85rem 1.35rem;
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  z-index: 2000;
  transform: translateY(120%);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-popup.show {
  transform: translateY(0);
  opacity: 1;
}

/* 15. MODAL TÙY CHỌN IMPORT BACKUP */
.modal-sm {
  max-width: 480px;
}

.import-options-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.import-option-card {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.import-option-card:hover {
  background: rgba(99, 102, 241, 0.06);
  border-color: rgba(99, 102, 241, 0.4);
}

.import-option-card:has(input:checked) {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.import-option-card input[type="radio"] {
  margin-top: 0.2rem;
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.import-option-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.import-option-content strong {
  font-size: 0.9rem;
  color: var(--text-primary);
}

.import-option-content span {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   16. TỐI ƯU HÓA TOÀN DIỆN CHO MOBILE & TABLET (RESPONSIVE MASTER)
   ========================================================================== */

/* 1. MÀN HÌNH MÁY TÍNH BẢNG & LAPTOP NHỎ (DƯỚI 1024PX) */
@media (max-width: 1024px) {
  .movie-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }

  .header-container {
    gap: 1rem;
  }
}

/* 2. MÀN HÌNH TABLET & DI ĐỘNG DƯỚI 768PX */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  /* Header thanh điều hướng */
  .app-header {
    padding: 0.65rem 0;
  }

  .header-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
  }

  .brand {
    gap: 0.55rem;
  }

  .brand-icon {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    border-radius: var(--radius-sm);
  }

  .brand-title {
    font-size: 1.12rem;
  }

  .brand-subtitle {
    display: none; /* Ẩn subtitle trên header mobile để giao diện gọn gàng */
  }

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

  .btn-backup {
    padding: 0.45rem 0.65rem;
    font-size: 0.78rem;
    gap: 0.3rem;
  }

  .btn-primary#btnAddMovie {
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
    white-space: nowrap;
    border-radius: var(--radius-sm);
  }

  /* 4 ô thống kê trên Mobile: chia lưới 2x2 cực gọn gàng */
  .stats-section {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
    margin: 1.25rem 0;
  }

  .stat-box {
    padding: 0.85rem;
    gap: 0.65rem;
    border-radius: var(--radius-md);
  }

  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    border-radius: var(--radius-sm);
  }

  .stat-number {
    font-size: 1.35rem;
  }

  .stat-label {
    font-size: 0.72rem;
  }

  /* Khung tập mới cập nhật */
  .section-new-releases {
    padding: 1rem;
    margin-bottom: 2rem;
    border-radius: var(--radius-md);
  }

  .section-title {
    font-size: 1.1rem;
  }

  .new-releases-grid {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .new-release-item {
    padding: 0.65rem;
    gap: 0.75rem;
  }

  .new-release-poster {
    width: 48px;
    height: 68px;
  }

  .new-release-title {
    font-size: 0.88rem;
  }

  .new-release-badge {
    font-size: 0.7rem;
  }

  .new-release-time {
    font-size: 0.72rem;
  }

  /* Khung lọc phim & tìm kiếm */
  .filter-bar {
    padding: 0.85rem 1rem;
    margin-bottom: 1.5rem;
    gap: 0.75rem;
    border-radius: var(--radius-md);
  }

  .filter-top-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .filter-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0.4rem;
    padding-bottom: 0.2rem;
  }

  .filter-tabs::-webkit-scrollbar {
    display: none;
  }

  .tab-button {
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
    flex-shrink: 0;
  }

  .filter-controls-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
  }

  .sort-box {
    flex: 1;
    min-width: 140px;
  }

  .sort-select {
    width: 100%;
    font-size: 0.82rem;
    padding: 0.5rem 1.8rem 0.5rem 2rem;
  }

  .search-box {
    flex: 1.4;
    min-width: 160px;
  }

  .search-input {
    font-size: 0.82rem;
    padding: 0.5rem 0.85rem 0.5rem 2.2rem;
  }

  /* Hàng thể loại cuộn ngang mượt mà trên mobile */
  .genre-filter-row {
    padding-top: 0.65rem;
    gap: 0.5rem;
    flex-wrap: nowrap;
    align-items: center;
  }

  .genre-filter-label {
    font-size: 0.75rem;
    flex-shrink: 0;
  }

  .genre-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0.4rem;
    padding-bottom: 0.2rem;
  }

  .genre-tabs::-webkit-scrollbar {
    display: none;
  }

  .genre-btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    flex-shrink: 0;
  }

  /* Danh sách phim dạng thẻ: 2 cột trên Tablet/Mobile */
  .movie-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
    margin-bottom: 2rem;
  }

  /* Lịch phát sóng */
  .section-schedule {
    padding: 1rem;
    margin-bottom: 2.5rem;
    border-radius: var(--radius-md);
  }

  .schedule-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    padding: 0.75rem;
  }

  .schedule-left {
    gap: 0.75rem;
  }

  .schedule-poster {
    width: 38px;
    height: 54px;
  }

  .schedule-title {
    font-size: 0.9rem;
  }

  .schedule-ep-info {
    font-size: 0.75rem;
  }

  .schedule-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
  }

  .countdown-tag {
    font-size: 0.72rem;
    padding: 0.2rem 0.5rem;
  }

  .exact-time {
    font-size: 0.72rem;
  }
}

/* 3. CHUẨN HÓA CHO ĐIỆN THOẠI DI ĐỘNG DƯỚI 600PX */
@media (max-width: 600px) {
  .container {
    padding: 0 0.85rem;
  }

  /* Danh sách phim dạng thẻ: 2 cột chuẩn rạp chiếu phim Netflix/TMDB trên Mobile */
  .movie-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
    margin-bottom: 2rem;
  }

  .movie-card {
    border-radius: var(--radius-md);
  }

  .card-body {
    padding: 0.65rem 0.65rem 0.75rem;
  }

  .card-badge-status {
    top: 0.35rem;
    left: 0.35rem;
    padding: 0.18rem 0.38rem;
    font-size: 0.6rem;
    border-radius: 4px;
  }

  .card-score {
    top: 0.35rem;
    right: 0.35rem;
    padding: 0.15rem 0.35rem;
    font-size: 0.62rem;
    border-radius: 4px;
  }

  .card-badge-today {
    bottom: 0.35rem;
    left: 0.35rem;
    padding: 0.16rem 0.45rem;
    font-size: 0.58rem;
  }

  .card-genres {
    gap: 0.2rem;
    margin-bottom: 0.35rem;
    flex-wrap: nowrap;
    overflow-x: hidden;
  }

  .genre-tag {
    font-size: 0.6rem;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    white-space: nowrap;
  }

  .card-title {
    font-size: 0.85rem;
    margin-bottom: 0.1rem;
    line-height: 1.25;
  }

  .card-subtitle {
    font-size: 0.68rem;
    margin-bottom: 0.35rem;
  }

  .progress-box {
    margin-top: auto;
    padding-top: 0.35rem;
  }

  .progress-header {
    font-size: 0.68rem;
    margin-bottom: 0.2rem;
  }

  .progress-track {
    height: 4px;
  }

  /* Các nút thao tác trên thẻ phim co giãn vừa vặn màn hình */
  .card-actions {
    margin-top: 0.5rem;
    padding-top: 0.45rem;
    gap: 0.3rem;
    flex-wrap: wrap;
  }

  .btn-watch-movie {
    flex: 1 1 calc(50% - 0.2rem);
    padding: 0.38rem 0.35rem;
    font-size: 0.7rem;
    text-align: center;
    white-space: nowrap;
    border-radius: var(--radius-sm);
  }

  .btn-track-ep {
    flex: 1 1 calc(50% - 0.2rem);
    font-size: 0.7rem;
    padding: 0.38rem 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    border-radius: var(--radius-sm);
  }

  .card-icon-btns {
    width: 100%;
    justify-content: flex-end;
    gap: 0.25rem;
    padding-top: 0.1rem;
  }

  .btn-card-icon {
    width: 26px;
    height: 26px;
    font-size: 0.72rem;
  }

  /* Modal Form trên Mobile: Kiểu Bottom-sheet chuyên nghiệp */
  .modal-overlay {
    padding: 0.5rem 0.5rem 0;
    align-items: flex-end;
  }

  .modal-card {
    max-height: 92vh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
  }

  .modal-header {
    padding: 0.85rem 1rem;
  }

  .modal-icon {
    width: 34px;
    height: 34px;
    font-size: 1.1rem;
  }

  .modal-title {
    font-size: 1rem;
  }

  .modal-subtitle {
    font-size: 0.7rem;
  }

  .modal-form {
    padding: 0.85rem 1rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .form-label {
    font-size: 0.78rem;
    margin-bottom: 0.25rem;
  }

  .form-input {
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
  }

  .modal-footer {
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }

  .modal-footer .btn {
    flex: 1;
    padding: 0.55rem 0.75rem;
    font-size: 0.82rem;
  }

  /* Toast Popup trên Mobile */
  .toast-popup {
    left: 0.85rem;
    right: 0.85rem;
    bottom: 1rem;
    text-align: center;
    justify-content: center;
    font-size: 0.8rem;
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-md);
  }

  /* Footer */
  .app-footer {
    padding: 1.5rem 0;
    font-size: 0.75rem;
  }
}

/* 4. MÀN HÌNH ĐIỆN THOẠI NHỎ (DƯỚI 480PX) */
@media (max-width: 480px) {
  .header-actions {
    width: 100%;
    justify-content: space-between;
    gap: 0.3rem;
  }

  .btn-backup {
    flex: 1;
    padding: 0.4rem 0.45rem;
    font-size: 0.72rem;
    justify-content: center;
  }

  .btn-primary#btnAddMovie {
    flex: 1.3;
    padding: 0.4rem 0.5rem;
    font-size: 0.75rem;
    justify-content: center;
  }

  .filter-controls-group {
    flex-direction: column;
    gap: 0.5rem;
  }

  .sort-box, .search-box {
    width: 100%;
    min-width: 100%;
  }

  .sort-select, .search-input {
    width: 100%;
  }
}

/* 5. MÀN HÌNH SIÊU NHỎ (DƯỚI 360PX) */
@media (max-width: 360px) {
  /* Xếp 1 cột duy nhất cho thẻ phim trên màn hình siêu hẹp */
  .movie-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .stats-section {
    grid-template-columns: 1fr;
  }

  .btn-watch-movie, .btn-track-ep {
    flex: 1 1 100%;
  }
}


