/* ================================================================
   THEME & SEASONAL EVENT TEMPLATES
   Hỗ trợ 5 chủ đề: Mặc định, Halloween, Tết Nguyên Đán, Trung Thu, Tình Yêu
   Nguyên tắc: Giữ nguyên màu nền sáng và độ tương phản đọc chuẩn mặc định,
   chỉ thay đổi điểm nhấn thương hiệu (accent) và không khí lễ hội tinh tế.
   ================================================================ */

/* --- 1. Theme Variables & Festive Accents --- */

/* 🎃 THEME: HALLOWEEN */
[data-theme="halloween"] {
  --purple: #ea580c !important;
  --purple-light: #fff7ed !important;
  --p: #ea580c !important;
  --p2: #fff7ed !important;
  --green: #84cc16 !important;
}
[data-theme="halloween"] .top {
  border-bottom: 2px solid #fed7aa !important;
}
[data-theme="halloween"] .logo>b {
  background: linear-gradient(135deg, #f97316, #ea580c) !important;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.28) !important;
}
[data-theme="halloween"] .site-nav a:hover {
  background: #fff7ed !important;
  color: #ea580c !important;
}
[data-theme="halloween"] .site-nav a.active {
  background: #ffedd5 !important;
  color: #c2410c !important;
}
[data-theme="halloween"] .primary-action {
  background: linear-gradient(135deg, #f97316, #ea580c) !important;
  box-shadow: 0 5px 15px rgba(234, 88, 12, 0.28) !important;
}
[data-theme="halloween"] .primary-action:hover {
  background: linear-gradient(135deg, #ea580c, #c2410c) !important;
}
[data-theme="halloween"] .card-ni {
  background: #fff7ed !important;
  color: #c2410c !important;
  border-color: #fed7aa !important;
}
[data-theme="halloween"] .card-hao {
  background: #ffffff !important;
  color: #7e22ce !important;
  border-color: #e9d5ff !important;
}
[data-theme="halloween"] .home-rank-card {
  background: linear-gradient(135deg, #fff7ed 0%, #ffffff 100%) !important;
  border-color: #fed7aa !important;
}
[data-theme="halloween"] .home-rank-card strong {
  color: #ea580c !important;
}
[data-theme="halloween"] .course-exam-cta {
  background: #fff7ed !important;
  border-color: #fed7aa !important;
  color: #ea580c !important;
}
[data-theme="halloween"] .course-exam-cta:hover {
  background: #ea580c !important;
  color: #ffffff !important;
  border-color: #ea580c !important;
}
[data-theme="halloween"] .art-seal {
  border-color: #ea580c !important;
  color: #ea580c !important;
}
[data-theme="halloween"] .theme-header-btn {
  background: #fff7ed !important;
  color: #c2410c !important;
  border-color: #fed7aa !important;
}

/* 🧧 THEME: TẾT NGUYÊN ĐÁN (XUÂN TIẾT - 春节) */
[data-theme="tet"] {
  --purple: #dc2626 !important;
  --purple-light: #fee2e2 !important;
  --p: #dc2626 !important;
  --p2: #fee2e2 !important;
  --green: #15803d !important;
}
[data-theme="tet"] .top {
  border-bottom: 2px solid #fca5a5 !important;
}
[data-theme="tet"] .logo>b {
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.28) !important;
}
[data-theme="tet"] .site-nav a:hover {
  background: #fee2e2 !important;
  color: #dc2626 !important;
}
[data-theme="tet"] .site-nav a.active {
  background: #fecaca !important;
  color: #b91c1c !important;
}
[data-theme="tet"] .primary-action {
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  box-shadow: 0 5px 15px rgba(220, 38, 38, 0.28) !important;
}
[data-theme="tet"] .primary-action:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c) !important;
}
[data-theme="tet"] .card-ni {
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border-color: #fca5a5 !important;
}
[data-theme="tet"] .card-hao {
  background: #ffffff !important;
  color: #b45309 !important;
  border-color: #fde68a !important;
}
[data-theme="tet"] .home-rank-card {
  background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%) !important;
  border-color: #fca5a5 !important;
}
[data-theme="tet"] .home-rank-card strong {
  color: #dc2626 !important;
}
[data-theme="tet"] .course-exam-cta {
  background: #fef2f2 !important;
  border-color: #fca5a5 !important;
  color: #dc2626 !important;
}
[data-theme="tet"] .course-exam-cta:hover {
  background: #dc2626 !important;
  color: #ffffff !important;
  border-color: #dc2626 !important;
}
[data-theme="tet"] .art-seal {
  border-color: #dc2626 !important;
  color: #dc2626 !important;
}
[data-theme="tet"] .theme-header-btn {
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border-color: #fca5a5 !important;
}

/* 🥮 THEME: TRUNG THU (TRUNG THU TIẾT - 中秋节) */
[data-theme="midautumn"] {
  --purple: #0284c7 !important;
  --purple-light: #e0f2fe !important;
  --p: #0284c7 !important;
  --p2: #e0f2fe !important;
  --green: #0d9488 !important;
}
[data-theme="midautumn"] .top {
  border-bottom: 2px solid #bae6fd !important;
}
[data-theme="midautumn"] .logo>b {
  background: linear-gradient(135deg, #38bdf8, #0284c7) !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.28) !important;
}
[data-theme="midautumn"] .site-nav a:hover {
  background: #e0f2fe !important;
  color: #0284c7 !important;
}
[data-theme="midautumn"] .site-nav a.active {
  background: #bae6fd !important;
  color: #0369a1 !important;
}
[data-theme="midautumn"] .primary-action {
  background: linear-gradient(135deg, #0284c7, #0369a1) !important;
  box-shadow: 0 5px 15px rgba(2, 132, 199, 0.28) !important;
}
[data-theme="midautumn"] .primary-action:hover {
  background: linear-gradient(135deg, #0369a1, #075985) !important;
}
[data-theme="midautumn"] .card-ni {
  background: #f0f9ff !important;
  color: #0369a1 !important;
  border-color: #bae6fd !important;
}
[data-theme="midautumn"] .card-hao {
  background: #ffffff !important;
  color: #a16207 !important;
  border-color: #fde047 !important;
}
[data-theme="midautumn"] .home-rank-card {
  background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%) !important;
  border-color: #bae6fd !important;
}
[data-theme="midautumn"] .home-rank-card strong {
  color: #0284c7 !important;
}
[data-theme="midautumn"] .course-exam-cta {
  background: #f0f9ff !important;
  border-color: #bae6fd !important;
  color: #0284c7 !important;
}
[data-theme="midautumn"] .course-exam-cta:hover {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
}
[data-theme="midautumn"] .art-seal {
  border-color: #0284c7 !important;
  color: #0284c7 !important;
}
[data-theme="midautumn"] .theme-header-btn {
  background: #f0f9ff !important;
  color: #0369a1 !important;
  border-color: #bae6fd !important;
}

/* 💖 THEME: TÌNH YÊU / VALENTINE / THẤT TỊCH (QIXI - 七夕) */
[data-theme="love"] {
  --purple: #e11d48 !important;
  --purple-light: #ffe4e6 !important;
  --p: #e11d48 !important;
  --p2: #ffe4e6 !important;
  --green: #059669 !important;
}
[data-theme="love"] .top {
  border-bottom: 2px solid #fecdd3 !important;
}
[data-theme="love"] .logo>b {
  background: linear-gradient(135deg, #fb7185, #e11d48) !important;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.28) !important;
}
[data-theme="love"] .site-nav a:hover {
  background: #ffe4e6 !important;
  color: #e11d48 !important;
}
[data-theme="love"] .site-nav a.active {
  background: #fecdd3 !important;
  color: #be123c !important;
}
[data-theme="love"] .primary-action {
  background: linear-gradient(135deg, #f43f5e, #e11d48) !important;
  box-shadow: 0 5px 15px rgba(225, 29, 72, 0.28) !important;
}
[data-theme="love"] .primary-action:hover {
  background: linear-gradient(135deg, #e11d48, #be123c) !important;
}
[data-theme="love"] .card-ni {
  background: #fff1f2 !important;
  color: #e11d48 !important;
  border-color: #fecdd3 !important;
}
[data-theme="love"] .card-hao {
  background: #ffffff !important;
  color: #db2777 !important;
  border-color: #fbcfe8 !important;
}
[data-theme="love"] .home-rank-card {
  background: linear-gradient(135deg, #fff1f2 0%, #ffffff 100%) !important;
  border-color: #fecdd3 !important;
}
[data-theme="love"] .home-rank-card strong {
  color: #e11d48 !important;
}
[data-theme="love"] .course-exam-cta {
  background: #fff1f2 !important;
  border-color: #fecdd3 !important;
  color: #e11d48 !important;
}
[data-theme="love"] .course-exam-cta:hover {
  background: #e11d48 !important;
  color: #ffffff !important;
  border-color: #e11d48 !important;
}
[data-theme="love"] .art-seal {
  border-color: #e11d48 !important;
  color: #e11d48 !important;
}
[data-theme="love"] .theme-header-btn {
  background: #fff1f2 !important;
  color: #e11d48 !important;
  border-color: #fecdd3 !important;
}

/* --- 2. Header Theme Button --- */
.theme-header-btn {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.theme-header-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

/* --- 3. Festive Floating Particles Container --- */
.theme-particles-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
  opacity: 0.55;
}
.theme-particle {
  position: absolute;
  top: -40px;
  user-select: none;
  animation: themeFall linear infinite;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.06));
}
@keyframes themeFall {
  0% {
    transform: translateY(0) rotate(0deg) translateX(0);
    opacity: 0.8;
  }
  50% {
    transform: translateY(50vh) rotate(180deg) translateX(25px);
    opacity: 0.7;
  }
  100% {
    transform: translateY(105vh) rotate(360deg) translateX(-20px);
    opacity: 0;
  }
}

/* Tuyệt đối ẩn hạt rơi trong trang Admin */
body.admin-body #themeParticles,
#adminApp #themeParticles,
#adminApp ~ #themeParticles {
  display: none !important;
}

/* --- 4. Theme Picker Modal --- */
.theme-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: themeFadeIn 0.2s ease-out;
}
.theme-modal-overlay[hidden],
.theme-modal-overlay.hidden {
  display: none !important;
}
.theme-modal-card {
  width: min(580px, 100%);
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.25);
  padding: 24px 28px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
}

.theme-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.theme-modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: #1e1b4b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin: 16px 0;
}
.theme-card-option {
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #ffffff;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.theme-card-option:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}
.theme-card-option.active {
  border-width: 2.5px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}
.theme-card-option[data-id="default"].active { border-color: #6657d9; }
.theme-card-option[data-id="halloween"].active { border-color: #ea580c; }
.theme-card-option[data-id="tet"].active { border-color: #dc2626; }
.theme-card-option[data-id="midautumn"].active { border-color: #0284c7; }
.theme-card-option[data-id="love"].active { border-color: #e11d48; }

.theme-option-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.theme-option-icon {
  font-size: 30px;
}
.theme-option-name {
  font-size: 15px;
  font-weight: 800;
  color: #1e1b4b;
}
.theme-option-desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.45;
  margin-bottom: 12px;
}
.theme-color-palette {
  display: flex;
  gap: 6px;
  align-items: center;
}
.theme-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
}
.theme-active-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 11px;
  font-weight: 800;
  background: #dcfce7;
  color: #166534;
  padding: 3px 8px;
  border-radius: 999px;
  display: none;
}
.theme-card-option.active .theme-active-badge {
  display: inline-block;
}

/* Toggle particle switch */
.theme-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  padding: 12px 16px;
  border-radius: 12px;
  margin-top: 18px;
  border: 1px solid #e2e8f0;
}

@keyframes themeFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* --- 5. Festive Visual Elements & Seasonal Stickers --- */
.logo-festive-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  margin-left: 6px;
  display: inline-flex;
  align-items: center;
  letter-spacing: 0.5px;
  vertical-align: middle;
  animation: festivePulse 2.5s ease-in-out infinite;
}
@keyframes festivePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

[data-theme="halloween"] .logo-festive-badge {
  background: #fff7ed !important;
  color: #ea580c !important;
  border: 1px solid #fed7aa !important;
}
[data-theme="tet"] .logo-festive-badge {
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border: 1px solid #fca5a5 !important;
}
[data-theme="midautumn"] .logo-festive-badge {
  background: #f0f9ff !important;
  color: #0284c7 !important;
  border: 1px solid #bae6fd !important;
}
[data-theme="love"] .logo-festive-badge {
  background: #fff1f2 !important;
  color: #e11d48 !important;
  border: 1px solid #fecdd3 !important;
}

/* Seasonal Hero Banner */
.seasonal-hero-banner {
  margin: 16px 0 14px;
  border-radius: 14px;
  padding: 12px 18px;
  animation: themeFadeIn 0.3s ease-out;
}
[data-theme="halloween"] .seasonal-hero-banner {
  border: 1.5px solid #fed7aa;
  background: linear-gradient(135deg, #fff7ed 0%, #ffffff 100%);
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.08);
}
[data-theme="tet"] .seasonal-hero-banner {
  border: 1.5px solid #fca5a5;
  background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%);
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.08);
}
[data-theme="midautumn"] .seasonal-hero-banner {
  border: 1.5px solid #bae6fd;
  background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%);
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.08);
}
[data-theme="love"] .seasonal-hero-banner {
  border: 1.5px solid #fecdd3;
  background: linear-gradient(135deg, #fff1f2 0%, #ffffff 100%);
  box-shadow: 0 4px 16px rgba(225, 29, 72, 0.08);
}

.seasonal-banner-inner {
  display: flex;
  align-items: center;
  gap: 14px;
}
.seasonal-banner-main-icon {
  font-size: 32px;
  flex-shrink: 0;
  animation: floatSlow 3s ease-in-out infinite;
}
.seasonal-banner-info strong {
  display: block;
  font-size: 14.5px;
  font-weight: 800;
  color: var(--purple);
}
.seasonal-banner-info small {
  display: block;
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}
.seasonal-banner-mini-icons {
  margin-left: auto;
  font-size: 22px;
  letter-spacing: 4px;
  flex-shrink: 0;
}
@media(max-width: 680px) {
  .seasonal-banner-mini-icons { display: none; }
}

/* Theme Art Stickers in Hero Art */
.theme-art-stickers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}
.theme-sticker {
  position: absolute;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.12));
}

/* Course Seasonal Pill */
.course-seasonal-pill {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  margin-left: auto;
}
[data-theme="halloween"] .course-seasonal-pill {
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #fed7aa;
}
[data-theme="tet"] .course-seasonal-pill {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fca5a5;
}
[data-theme="midautumn"] .course-seasonal-pill {
  background: #f0f9ff;
  color: #0284c7;
  border: 1px solid #bae6fd;
}
[data-theme="love"] .course-seasonal-pill {
  background: #fff1f2;
  color: #e11d48;
  border: 1px solid #fecdd3;
}

/* Animations for seasonal stickers */
@keyframes floatSlow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}
@keyframes floatGhost {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-11px) rotate(4deg); }
}
@keyframes floatBat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.08); }
}
@keyframes swingLantern {
  0%, 100% { transform: rotate(6deg); }
  50% { transform: rotate(-6deg); }
}
@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
