@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@300;400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Light Theme */
  --bg-main: #FDFBF7;
  --bg-card: #FFFFFF;
  --text-main: #1F2937;
  --text-muted: #6B7280;
  --border-color: #E5E7EB;
  --primary: #D4B895; /* Gold Accent */
  --primary-hover: #C2A582;
  --secondary: #1E3A8A; /* Royal Blue */
  
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-card-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.6);
  --shadow-color: rgba(0, 0, 0, 0.05);
}

.dark {
  /* Dark Theme — Warm Charcoal */
  --bg-main: #141414;          /* Very dark, neutral charcoal */
  --bg-card: #1f1f1f;          /* Slightly lighter card surface */
  --text-main: #EDEDED;        /* Soft off-white, not stark white */
  --text-muted: #888888;       /* Mid-gray, readable but subtle */
  --border-color: #2e2e2e;     /* Barely-visible separator lines */
  --primary: #f97316;          /* Orange-500 — brand color stays consistent */
  --primary-hover: #fb923c;    /* Orange-400 on hover */
  --secondary: #60a5fa;        /* Blue-400 — softer blue accent */
  
  --glass-bg: rgba(31, 31, 31, 0.80);
  --glass-card-bg: rgba(31, 31, 31, 0.95);
  --glass-border: rgba(255, 255, 255, 0.06);
  --shadow-color: rgba(0, 0, 0, 0.5);
}

body {
  font-family: 'Be Vietnam Pro', 'Inter', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  transition: background-color 0.4s ease, color 0.4s ease;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.content-container {
  width: 100%;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

/* Glassmorphism */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
}

.glass-card {
  background: var(--glass-card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 24px -1px var(--shadow-color);
  border-radius: 1.5rem;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease, background-color 0.3s ease;
}

.glass-card.hoverable:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 20px 40px -5px var(--shadow-color);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 9999px;
  padding: 0.6rem 1.5rem;
  font-weight: 600;
  box-shadow: 0 4px 14px 0 rgba(212, 184, 149, 0.4);
  background-size: 200% 200%;
}
.btn-primary:hover {
  background-position: right center;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 184, 149, 0.6);
}
.btn-primary:active {
  transform: translateY(1px); /* Spring effect */
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 9999px;
  padding: 0.6rem 1.5rem;
  font-weight: 500;
}
.btn-secondary:hover {
  background-color: var(--border-color);
  transform: translateY(-1px);
}
.btn-secondary:active {
  transform: translateY(1px);
}

/* Inputs */
.input-glass {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 1rem;
  padding: 0.75rem 1rem;
  transition: all 0.2s ease;
  width: 100%;
  outline: none;
}
.input-glass:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(212, 184, 149, 0.2);
}

/* Fix date input tràn ra ngoài trên mọi trình duyệt */
input[type="date"].input-glass {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  display: block;
  overflow: hidden;
}
input[type="date"].input-glass::-webkit-calendar-picker-indicator {
  opacity: 0.6;
  cursor: pointer;
  filter: invert(0.4);
}
.dark input[type="date"].input-glass::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, var(--border-color) 25%, var(--bg-card) 50%, var(--border-color) 75%);
  background-size: 200% 100%;
  animation: skeletonLoading 1.5s infinite;
  border-radius: 0.5rem;
}
@keyframes skeletonLoading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Loaders */
.loader {
  border: 3px solid rgba(212, 184, 149, 0.3);
  border-radius: 50%;
  border-top: 3px solid var(--primary);
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Progress Bar */
.progress-bar-container {
  width: 100%;
  background-color: var(--border-color);
  border-radius: 9999px;
  overflow: hidden;
  height: 8px;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 9999px;
}

/* Animations */
.fade-in {
  animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.stagger-item {
  opacity: 0;
  animation: slideInRight 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Video Container */
.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  border-radius: 1rem;
  overflow: hidden;
  background-color: #000;
  box-shadow: 0 20px 40px -10px var(--shadow-color);
  border: 1px solid var(--glass-border);
}
.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Floating Elements & Glow */
.glow-orange {
  box-shadow: 0 10px 30px -10px rgba(249, 115, 22, 0.5);
}
.glow-yellow {
  box-shadow: 0 10px 30px -10px rgba(234, 179, 8, 0.5);
}
.glow-purple {
  box-shadow: 0 10px 30px -10px rgba(168, 85, 247, 0.5);
}
.glow-blue {
  box-shadow: 0 10px 30px -10px rgba(59, 130, 246, 0.5);
}

.pulse-glow {
  animation: pulseGlow 2s infinite;
}
@keyframes pulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(212, 184, 149, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(212, 184, 149, 0); }
  100% { box-shadow: 0 0 0 0 rgba(212, 184, 149, 0); }
}

.floating-btn {
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

/* Badge gamification popup */
.badge-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.5);
  opacity: 0;
  z-index: 9999;
  pointer-events: none;
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.badge-popup.show {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

/* Utilities for dynamic classes */
.bg-card { background-color: var(--bg-card); }
.border-theme { border-color: var(--border-color); }
.text-main { color: var(--text-main); }
.text-muted { color: var(--text-muted); }

/* Main View Layout (Flow) */
.main-view {
  display: block;
  width: 100%;
  opacity: 0;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  padding-bottom: 3rem;
  will-change: opacity, transform;
}
.main-view.hidden {
  display: none !important;
}

.view-content-wrapper {
  padding: 1.5rem;
}

@media (min-width: 640px) {
  .view-content-wrapper {
    padding: 2rem;
  }
}

/* Sidebar Mobile Overrides */
@media (max-width: 1023px) {
  #global-sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh !important;
    z-index: 100;
    transform: translateX(-100%);
    display: flex !important;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }
  #global-sidebar:not(.hidden) {
    transform: translateX(0);
    box-shadow: 0 0 100px rgba(0,0,0,0.5);
  }
  #global-sidebar.hidden {
    transform: translateX(-100%);
    pointer-events: none;
  }
  
  .main-view {
    padding-bottom: 7rem !important;
  }
}

/* On mobile, extra bottom padding so content isn't hidden under bottom nav */
@media (max-width: 1023px) {
  .main-view {
    padding-bottom: 5.5rem !important;
  }
}

/* Hybrid Grid Sidebar */
.sidebar-item {
  position: relative;
  transition: all 0.3s ease;
}
.sidebar-item::before {
  content: '';
  position: absolute;
  top: 10%;
  right: 0;
  height: 80%;
  width: 4px;
  background: linear-gradient(180deg, #f97316 0%, #ef4444 100%);
  border-radius: 4px 0 0 4px;
  opacity: 0;
  transform: translateX(10px);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.sidebar-item:hover::before, .sidebar-item.active::before {
  opacity: 1;
  transform: translateX(0);
}
.sidebar-item:hover, .sidebar-item.active {
  background-color: var(--bg-card);
  color: var(--text-main) !important;
  box-shadow: 0 4px 12px var(--shadow-color);
  transform: translateX(4px);
}

/* ========================================================
   PREMIUM DASHBOARD UI & UX UPGRADES
   ======================================================== */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in-up {
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

@keyframes pulseSlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

.animate-pulse-slow {
  animation: pulseSlow 4s ease-in-out infinite;
}

/* SKELETON LOADING */
@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--card-bg) 25%, rgba(200,200,200,0.1) 50%, var(--card-bg) 75%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite linear;
  border-radius: 1rem;
}
.dark .skeleton {
  background: linear-gradient(90deg, var(--card-bg) 25%, rgba(255,255,255,0.05) 50%, var(--card-bg) 75%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite linear;
}

/* NEUMORPHISM STAT CARDS */
.stat-card-neumorph {
  background: var(--card-bg);
  border-radius: 1.5rem;
  box-shadow: 
    8px 8px 16px rgba(0, 0, 0, 0.05), 
    -8px -8px 16px rgba(255, 255, 255, 0.6);
  transition: all 0.3s ease;
  border: 1px solid rgba(255,255,255,0.1);
  position: relative;
  overflow: hidden;
}

.dark .stat-card-neumorph {
  box-shadow: 
    8px 8px 16px rgba(0, 0, 0, 0.4), 
    -8px -8px 16px rgba(255, 255, 255, 0.02);
}

.stat-card-neumorph:hover {
  transform: translateY(-3px);
  box-shadow: 
    12px 12px 20px rgba(0, 0, 0, 0.08), 
    -12px -12px 20px rgba(255, 255, 255, 0.8);
  border-color: rgba(251, 191, 36, 0.4); /* Golden border on hover */
}

.dark .stat-card-neumorph:hover {
  box-shadow: 
    12px 12px 20px rgba(0, 0, 0, 0.5), 
    -12px -12px 20px rgba(255, 255, 255, 0.03);
}

.stat-card-neumorph:hover::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at top right, rgba(251, 191, 36, 0.15), transparent 70%);
  pointer-events: none;
}

/* GOLDEN AURA (Leaderboard Top 1) */
@keyframes goldenAura {
  0% { box-shadow: 0 0 10px rgba(251, 191, 36, 0.5); }
  50% { box-shadow: 0 0 25px rgba(251, 191, 36, 0.9); }
  100% { box-shadow: 0 0 10px rgba(251, 191, 36, 0.5); }
}

.golden-aura {
  animation: goldenAura 2s infinite ease-in-out;
  border: 2px solid #f59e0b;
}

/* FOCUS MODE */
body.focus-mode aside {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
  position: absolute;
}
body.focus-mode header {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  position: absolute;
}
body.focus-mode .main-view {
  top: 0 !important;
  padding: 1rem !important;
  height: 100vh !important;
}
body.focus-mode {
  background-color: #0f172a !important; /* Very dark background */
}
body.focus-mode #video-container iframe {
  border-radius: 0;
}
body.focus-mode #view-learning {
  padding: 0 !important;
  gap: 0 !important;
}
body.focus-mode .focus-hide {
  display: none !important;
}

/* TOAST NOTIFICATION */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideInRight 0.3s ease-out forwards;
  max-width: 300px;
}

.dark .toast {
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

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

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

/* ========================================================
   DISCOVERY LANDING PAGE (COMBO 2K9)
   ======================================================== */
.combo-landing {
    --accent-gold: #e67e22; 
    --accent-gold-light: #f39c12;
    --accent-green: #2ecc71;
    --accent-green-dark: #27ae60;
    --accent-blue: #3498db;
    --glass-bg: rgba(255, 255, 255, 0.9); 
    --glass-border: rgba(255, 255, 255, 1);
}

.combo-landing .main-wrapper {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden; 
    background: linear-gradient(-45deg, #f0f4f8, #e0eaf5, #d4e4f7, #f0f4f8); 
    background-size: 400% 400%; 
    animation: gradientBG 15s ease infinite;
    border-radius: 20px;
}
@keyframes gradientBG { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

.combo-landing .blob { position: absolute; border-radius: 50%; filter: blur(60px); z-index: 0; animation: moveBlobs 8s infinite alternate ease-in-out; pointer-events: none; opacity: 0.7; }
.combo-landing .blob-1 { width: 250px; height: 250px; background: rgba(255, 159, 67, 0.3); top: 2%; left: -10%; }
.combo-landing .blob-2 { width: 300px; height: 300px; background: rgba(52, 152, 219, 0.3); bottom: 15%; right: -15%; animation-delay: 2s; }
.combo-landing .blob-3 { width: 200px; height: 200px; background: rgba(46, 204, 113, 0.3); top: 40%; left: 20%; animation-delay: 4s; }
@keyframes moveBlobs { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(25px, -25px) scale(1.1); } }

.combo-landing .app-container { width: 100%; margin: 0 auto; position: relative; z-index: 1; color: #2d3436; }
.combo-landing .header { text-align: center; }
.combo-landing .site-logo { width: 90px; height: 90px; object-fit: cover; border-radius: 22px; background: #ffffff; padding: 5px; box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08); margin: 0 auto 15px auto; display: block; border: 2px solid rgba(255,255,255,0.8); }
.combo-landing .title { background: linear-gradient(90deg, #d35400, #f39c12, #e74c3c); background-size: 200% auto; -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; animation: shineText 3s linear infinite; line-height: 1.3;}
@keyframes shineText { to { background-position: 200% center; } }
.combo-landing .subtitle { font-weight: 600; line-height: 1.6; color: #34495e; padding: 0 5px; }

.combo-landing .format-compact { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 16px 15px; align-items: center; margin-bottom: 15px;}
.combo-landing .format-mini-item { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: #2c3e50; width: calc(50% - 6px); }
.combo-landing .format-mini-item i { font-size: 22px; }

.combo-landing .section-heading { text-align: center; font-weight: 800; color: #2c3e50; text-transform: uppercase; margin: 35px 0 20px 0; letter-spacing: 0.5px; position: relative; }
.combo-landing .section-heading::after { content: ''; display: block; width: 50px; height: 4px; background: linear-gradient(90deg, var(--accent-green), var(--accent-blue)); margin: 8px auto 0; border-radius: 4px; }
.combo-landing .section-heading.mini { margin: 25px 0 15px 0; font-size: 16px; } 

.combo-landing .stat-box { background: #fff; border-radius: 16px; padding: 15px; text-align: center; box-shadow: 0 8px 20px rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.03); display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%;}
.combo-landing .stat-box i { font-size: 32px; color: var(--accent-gold); margin-bottom: 5px; }
.combo-landing .stat-box .num { font-size: 22px; font-weight: 800; color: #d35400; line-height: 1.2;}
.combo-landing .stat-box .text { font-size: 12px; font-weight: 700; color: #636e72; text-transform: uppercase; margin-top: 2px;}
.combo-landing .trust-list { background: #fff; border-radius: 16px; padding: 20px; box-shadow: 0 8px 20px rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.03); list-style: none; height: 100%; display: flex; flex-direction: column; justify-content: center; margin: 0;}
.combo-landing .trust-list li { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; font-weight: 500; line-height: 1.5; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px dashed #ecf0f1; }
.combo-landing .trust-list li:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.combo-landing .trust-list li i { color: var(--accent-blue); font-size: 20px; flex-shrink: 0; margin-top: 2px;}

.combo-landing .courses-section { background: #ffffff; border-radius: 18px; padding: 20px 15px; box-shadow: 0 10px 25px rgba(0,0,0,0.05); position: relative; border: 1px solid rgba(0,0,0,0.02);}
.combo-landing .tab-menu { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 12px; margin-bottom: 12px; -ms-overflow-style: none; scrollbar-width: none; scroll-behavior: smooth; width: 100%;}
.combo-landing .tab-menu::-webkit-scrollbar { display: none; }
.combo-landing .tab-btn { background: #f0f4f8; border: 1px solid #dcdde1; color: #7f8fa6; padding: 8px 16px; border-radius: 30px; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; scroll-snap-align: start; display: flex; align-items: center; gap: 5px; transition: 0.3s; }
.combo-landing .tab-btn i { font-size: 16px; }
.combo-landing .tab-btn.active { background: linear-gradient(135deg, var(--accent-gold-light), var(--accent-gold)); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(230, 126, 34, 0.3); }
.combo-landing .course-list { list-style: none; min-height: 250px; padding: 0; margin: 0;}
.combo-landing .course-item { font-size: 13.5px; font-weight: 600; color: #34495e; padding: 12px 0; border-bottom: 1px solid #f1f2f6; display: flex; align-items: flex-start; gap: 10px; animation: slideInUp 0.3s ease forwards; opacity: 0; transform: translateY(10px); line-height: 1.5;}
@keyframes slideInUp { to { opacity: 1; transform: translateY(0); } }
.combo-landing .course-item:last-child { border-bottom: none; }
.combo-landing .course-item i.check { color: var(--accent-green); font-size: 18px; margin-top: 2px; flex-shrink: 0; }
.combo-landing .hot-icon { font-size: 14px; margin-left: 5px; animation: bounceFire 1s infinite; display: inline-block;}
@keyframes bounceFire { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.2); } }

.combo-landing .video-slider { display: flex; gap: 15px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 15px; margin: 0; width: 100%; -ms-overflow-style: none; scrollbar-width: none; scroll-behavior: smooth; }
.combo-landing .video-slider::-webkit-scrollbar { display: none; }
.combo-landing .video-item { aspect-ratio: 16 / 9; flex: 0 0 88%; background: #000; border-radius: 16px; overflow: hidden; scroll-snap-align: center; position: relative; box-shadow: 0 8px 20px rgba(0,0,0,0.1); cursor: pointer; }
.combo-landing .video-thumb { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-size: cover; background-position: center; transition: transform 0.3s; }
.combo-landing .video-item:hover .video-thumb { transform: scale(1.05); }
.combo-landing .play-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.3); display: flex; align-items: center; justify-content: center; }
.combo-landing .play-btn-custom { width: 55px; height: 55px; background: rgba(255, 255, 255, 0.95); border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 5px 15px rgba(0,0,0,0.3); animation: pulsePlay 1.5s infinite;}
.combo-landing .play-btn-custom i { font-size: 32px; color: #e74c3c; margin-left: 4px; }
.combo-landing .video-item iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; }
.combo-landing .swipe-hint { text-align: center; font-size: 12.5px; color: #636e72; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: -5px;}
.combo-landing .swipe-hint i { font-size: 16px; animation: slideArrow 1.5s infinite ease-in-out; }
.combo-landing .swipe-hint .bx-left-arrow-alt { animation-direction: reverse; }
@keyframes slideArrow { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(5px); } }

.combo-landing .pricing-box { position: relative; background: #ffffff; border: 2px dashed #ff9f43; border-radius: 20px; padding: 25px 15px; text-align: center; box-shadow: 0 10px 30px rgba(230, 126, 34, 0.1); animation: glowBorderLight 2s infinite alternate; }
@keyframes glowBorderLight { 0% { box-shadow: 0 0 5px rgba(243, 156, 18, 0.1); border-color: rgba(243, 156, 18, 0.4); } 100% { box-shadow: 0 0 20px rgba(243, 156, 18, 0.4); border-color: #e67e22; } }
.combo-landing .price-title { color: #e67e22; font-size: 15px; font-weight: 800; text-transform: uppercase; margin-bottom: 12px; line-height: 1.4;}
.combo-landing .price-amount { font-size: 48px; font-weight: 800; color: #d35400; margin-bottom: 5px; text-shadow: 1px 2px 3px rgba(0,0,0,0.1); }
.combo-landing .price-include { font-size: 13.5px; color: #e67e22; font-weight: 700; margin-bottom: 20px; background: rgba(230, 126, 34, 0.1); display: inline-block; padding: 4px 15px; border-radius: 30px; }
.combo-landing .pricing-list { list-style: none; text-align: left; margin: 0; padding: 0;}
.combo-landing .pricing-list li { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; font-weight: 600; margin-bottom: 10px; line-height: 1.5;}
.combo-landing .pricing-list li i { color: #27ae60; font-size: 20px; margin-top: 2px; flex-shrink: 0;}
.combo-landing .highlight { color: #e74c3c; font-weight: 800; animation: blinkText 1.5s infinite; background: rgba(231, 76, 60, 0.1); padding: 2px 5px; border-radius: 4px;}
@keyframes blinkText { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.combo-landing .btn-register { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; background: linear-gradient(135deg, var(--accent-green), var(--accent-green-dark)); color: white; font-weight: 800; text-transform: uppercase; border-radius: 50px; text-decoration: none; border: none; box-shadow: 0 10px 25px rgba(46, 204, 113, 0.4); animation: pulseBtnLight 2s infinite; position: relative; overflow: hidden; transition: transform 0.2s; }
.combo-landing .btn-register:active, .combo-landing .btn-register:hover { transform: scale(0.96); box-shadow: 0 5px 15px rgba(46, 204, 113, 0.4);}
.combo-landing .btn-register::before { content: ''; position: absolute; top: 0; left: -100%; width: 50%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent); animation: sweepShimmer 3s infinite; }
@keyframes sweepShimmer { 0% { left: -100%; } 100% { left: 100%; } }

@media (max-width: 991px) {
    .combo-landing .app-container { max-width: 480px; padding: 30px 15px 40px 15px; }
    .combo-landing .header { margin-bottom: 25px; }
    .combo-landing .title { font-size: 24px; }
    .combo-landing .subtitle { font-size: 14.5px; }
    .combo-landing .stats-container { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 15px; }
    .combo-landing .trust-list { margin-bottom: 25px; }
    .combo-landing .section-heading { font-size: 18px; }
    .combo-landing .pricing-box { margin-top: 35px; }
    .combo-landing .btn-register { font-size: 18px; padding: 18px 20px; }
}
@media (min-width: 992px) {
    .combo-landing .app-container { max-width: 1100px; padding: 50px 20px; }
    .combo-landing .header { margin-bottom: 50px; }
    .combo-landing .title { font-size: 36px; margin-bottom: 15px; }
    .combo-landing .subtitle { font-size: 16px; }
    .combo-landing .format-compact { flex-wrap: nowrap; padding: 20px 30px; margin-bottom: 30px; border-radius: 30px;}
    .combo-landing .format-mini-item { width: auto; font-size: 16px; gap: 12px;}
    .combo-landing .format-mini-item i { font-size: 28px; }
    .combo-landing .section-heading { font-size: 24px; margin: 60px 0 30px 0; }
    .combo-landing .stats-trust-wrapper { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; align-items: stretch; margin-bottom: 40px; }
    .combo-landing .stats-container { display: flex; flex-direction: column; gap: 20px; margin-bottom: 0; }
    .combo-landing .trust-list { margin-bottom: 0; padding: 30px; }
    .combo-landing .trust-list li { font-size: 16px; margin-bottom: 20px; padding-bottom: 20px; }
    .combo-landing .courses-section { padding: 30px; }
    .combo-landing .tab-menu { padding-bottom: 20px; }
    .combo-landing .tab-btn { font-size: 14px; padding: 10px 20px; }
    .combo-landing .course-item { font-size: 15px; padding: 15px 0; }
    .combo-landing .video-slider { gap: 20px; padding-bottom: 20px; }
    .combo-landing .video-item { flex: 0 0 calc(33.333% - 14px); border-radius: 20px; } 
    .combo-landing .pricing-box { max-width: 700px; margin: 60px auto 0 auto; padding: 40px; border-radius: 30px; }
    .combo-landing .price-title { font-size: 18px; }
    .combo-landing .price-amount { font-size: 64px; }
    .combo-landing .pricing-list li { font-size: 16px; margin-bottom: 15px; }
    .combo-landing .btn-register { font-size: 22px; padding: 22px 30px; border-radius: 60px; }
}

/* ========================================================
   DARK MODE — Combo Landing Overrides
   ======================================================== */
.dark .combo-landing .main-wrapper {
    background: linear-gradient(-45deg, #1a1a1a, #222222, #1e1e1e, #1a1a1a);
}
.dark .combo-landing .blob-1 { background: rgba(249, 115, 22, 0.12); }
.dark .combo-landing .blob-2 { background: rgba(96, 165, 250, 0.10); }
.dark .combo-landing .blob-3 { background: rgba(34, 197, 94, 0.08); }
.dark .combo-landing .app-container { color: #EDEDED; }
.dark .combo-landing .subtitle { color: #aaaaaa; }
.dark .combo-landing .section-heading { color: #EDEDED; }
.dark .combo-landing .format-mini-item { color: #cccccc; }
.dark .combo-landing .stat-box { background: #2a2a2a; border-color: #333; }
.dark .combo-landing .stat-box .text { color: #888; }
.dark .combo-landing .trust-list { background: #2a2a2a; border-color: #333; }
.dark .combo-landing .trust-list li { color: #cccccc; border-bottom-color: #333; }
.dark .combo-landing .courses-section { background: #2a2a2a; border-color: #333; }
.dark .combo-landing .tab-btn { background: #333; border-color: #444; color: #999; }
.dark .combo-landing .course-item { color: #cccccc; border-bottom-color: #333; }
.dark .combo-landing .pricing-box { background: #2a2a2a; border-color: rgba(249,115,22,0.4); }
.dark .combo-landing .pricing-list li { color: #cccccc; }
.dark .combo-landing .glass-card { background: rgba(42, 42, 42, 0.95); border-color: #333; }

/* ========================================================
   DARK MODE — Global Icon Badge & UI Element Overrides
   ======================================================== */
.dark .bg-green-100 { background-color: rgba(34,197,94,0.15) !important; }
.dark .text-green-600 { color: #4ade80 !important; }
.dark .bg-purple-100 { background-color: rgba(168,85,247,0.15) !important; }
.dark .text-purple-600 { color: #c084fc !important; }
.dark .bg-indigo-100 { background-color: rgba(99,102,241,0.15) !important; }
.dark .text-indigo-600 { color: #818cf8 !important; }
.dark .bg-white { background-color: #1f1f1f !important; }

/* Global sidebar in dark */
.dark #global-sidebar {
  background-color: #1a1a1a !important;
  border-right-color: #2e2e2e !important;
}

/* Bottom nav dark */
.dark #mobile-bottom-nav {
  background-color: rgba(26, 26, 26, 0.95) !important;
  border-top-color: #2e2e2e !important;
}

/* Header dark */
.dark header {
  background-color: rgba(20, 20, 20, 0.85) !important;
  border-bottom-color: #2e2e2e !important;
}

/* Card elements in dark use our new charcoal bg-card */
.dark .bg-card { background-color: #1f1f1f !important; }

/* Focus mode dark background update */
.dark body.focus-mode { background-color: #0d0d0d !important; }


/* ========================================================
   PROFILE VIEW
   ======================================================== */

#view-profile .glass-card {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}
#view-profile .glass-card:hover {
  box-shadow: 0 20px 40px -8px var(--shadow-color);
}
#view-profile .input-glass:focus {
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
  outline: none;
}

/* Custom select arrow */
#pf-grade {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* Avatar ring hover */
#avatar-upload-area > div:first-child {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
#avatar-upload-area:hover > div:first-child {
  transform: scale(1.04);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.4), 0 16px 32px -8px rgba(249, 115, 22, 0.3);
}

/* Save button */
#btn-save-profile:not(:disabled):hover { transform: translateY(-2px); }
#btn-save-profile:disabled { opacity: 0.75; cursor: not-allowed; }

/* Completion bar % color animation */
#profile-completion-pct { transition: color 0.5s ease; }

/* ========================================================
   ADVANCED VISUAL EFFECTS — v2.0
   ======================================================== */

/* --- Grainy Texture Overlay (Premium paper feel) --- */
#grain-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* --- Mouse Glow Follower --- */
#mouse-glow {
  position: fixed;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 998;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(249,115,22,0.12) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
  will-change: left, top;
}
.dark #mouse-glow {
  background: radial-gradient(circle, rgba(249,115,22,0.18) 0%, transparent 70%);
}

/* --- Skeleton Loading Cards --- */
.skeleton-card {
  background: var(--card-bg);
  border-radius: 1.5rem;
  border: 1px solid var(--border-color);
  padding: 1rem;
  overflow: hidden;
}
.skeleton-line {
  height: 14px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--card-bg) 25%, rgba(150,150,150,0.12) 50%, var(--card-bg) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.6s infinite linear;
  margin-bottom: 10px;
}
.skeleton-img {
  width: 100%;
  height: 8rem;
  border-radius: 1rem;
  background: linear-gradient(90deg, var(--card-bg) 25%, rgba(150,150,150,0.12) 50%, var(--card-bg) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.6s infinite linear;
  margin-bottom: 12px;
}

/* --- Mobile Bottom Navigation --- */
#mobile-bottom-nav {
  safe-area-inset-bottom: env(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-nav-btn {
  position: relative;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.mobile-nav-btn.active,
.mobile-nav-btn[data-active="true"] {
  color: #f97316;
}

.mobile-nav-btn.active::before,
.mobile-nav-btn[data-active="true"]::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: linear-gradient(to right, #f97316, #ef4444);
  border-radius: 0 0 4px 4px;
}

/* On mobile, add safe padding to scrollable content so bottom nav doesn't cover it */
@media (max-width: 1023px) {
  #views-container {
    padding-bottom: 80px !important;
  }
  .main-view {
    padding-bottom: 5rem !important;
  }
}

/* --- Spring Button (CSS baseline, JS enhances) --- */
button {
  transition: transform 0.2s ease;
  will-change: transform;
}

/* --- Q&A Like Button --- */
.qa-like-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
}
.qa-like-btn:hover,
.qa-like-btn.liked {
  background: rgba(249,115,22,0.1);
  border-color: #f97316;
  color: #f97316;
}
.qa-like-btn.liked .qa-heart-icon {
  fill: #f97316;
  stroke: #f97316;
}
.qa-heart-icon {
  fill: transparent;
  stroke: currentColor;
  stroke-width: 2;
  width: 14px;
  height: 14px;
  transition: fill 0.2s ease, transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.qa-like-btn:active .qa-heart-icon {
  transform: scale(1.4);
}

/* --- Leaderboard Online Dot --- */
.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid white;
  position: absolute;
  bottom: 0;
  right: 0;
  animation: pulseGreen 2s infinite;
}
@keyframes pulseGreen {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.6); }
  50% { box-shadow: 0 0 0 4px rgba(34,197,94,0); }
}

/* --- Bento Grid for Dashboard Stats (highlight first card) --- */
@media (min-width: 1024px) {
  .stats-bento {
    display: grid;
    grid-template-columns: 1.7fr 1fr 1fr 1fr;
    gap: 1.25rem;
  }
  .stats-bento .stat-card-neumorph:first-child {
    grid-row: span 1;
    background: linear-gradient(135deg, var(--card-bg) 70%, rgba(249,115,22,0.06));
  }
  .stats-bento .stat-card-neumorph:first-child h3 {
    font-size: 2.5rem;
  }
}

/* --- Sticky Mini Video Player (PiP style) --- */
#sticky-video-player {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: 280px;
  aspect-ratio: 16/9;
  border-radius: 12px;
  overflow: hidden;
  z-index: 200;
  box-shadow: 0 20px 50px rgba(0,0,0,0.4);
  display: none;
  border: 2px solid rgba(249,115,22,0.4);
}
#sticky-video-player iframe {
  width: 100%;
  height: 100%;
  pointer-events: auto;
}
#sticky-video-player.visible {
  display: block;
  animation: slideInRight 0.3s ease-out forwards;
}
@media (min-width: 1024px) {
  #sticky-video-player { bottom: 20px; right: 20px; width: 320px; }
}

/* ========================================================
   DASHBOARD v2 — Hero, Stats, Quick Actions
   ======================================================== */

/* --- Hero Banner v2 --- */
.hero-banner-v2 {
  box-shadow: 0 25px 50px -10px rgba(0,0,0,0.25);
  transition: box-shadow 0.3s ease;
}
.hero-banner-v2:hover {
  box-shadow: 0 30px 60px -10px rgba(0,0,0,0.35);
}

/* Floating math/science symbols */
.float-icon {
  position: absolute;
  color: white;
  font-family: 'Georgia', serif;
  font-weight: 700;
  animation: floatSymbol 6s ease-in-out infinite;
  will-change: transform;
  pointer-events: none;
  user-select: none;
}
@keyframes floatSymbol {
  0%, 100% { transform: translateY(0px) rotate(-5deg); }
  50% { transform: translateY(-14px) rotate(5deg); }
}

/* --- Stat Cards v2 --- */
.stat-card-v2 {
  background: var(--card-bg);
  border: 1.5px solid var(--border-color);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  cursor: default;
  box-shadow: 0 4px 16px -4px var(--shadow-color);
}
.stat-card-v2:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 32px -8px var(--shadow-color);
}

/* Gradient border glow on hover using outline trick */
.stat-card-orange:hover { border-color: rgba(249,115,22,0.5); box-shadow: 0 16px 32px -8px rgba(249,115,22,0.18); }
.stat-card-blue:hover   { border-color: rgba(59,130,246,0.5);  box-shadow: 0 16px 32px -8px rgba(59,130,246,0.15); }
.stat-card-green:hover  { border-color: rgba(34,197,94,0.5);   box-shadow: 0 16px 32px -8px rgba(34,197,94,0.15);  }
.stat-card-purple:hover { border-color: rgba(168,85,247,0.5);  box-shadow: 0 16px 32px -8px rgba(168,85,247,0.15); }

.stat-label-v2 {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.stat-value-v2 {
  font-size: 2.25rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1;
  transition: color 0.2s ease;
}
.stat-card-orange:hover .stat-value-v2 { color: #f97316; }
.stat-card-blue:hover   .stat-value-v2 { color: #3b82f6; }
.stat-card-green:hover  .stat-value-v2 { color: #22c55e; }
.stat-card-purple:hover .stat-value-v2 { color: #a855f7; }

.stat-icon-v2 {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.stat-card-v2:hover .stat-icon-v2 {
  transform: scale(1.15) rotate(8deg);
}

/* Sparkline mini chart */
.sparkline-wrap {
  width: 100%;
  overflow: hidden;
  border-radius: 6px;
  margin-top: 4px;
}

/* --- Quick Action Bar --- */
.quick-action-pill {
  white-space: nowrap;
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.quick-action-pill:hover {
  transform: translateY(-2px);
}

/* --- Animated Counter target --- */
.counting { 
  transition: none; 
}

/* --- Stagger fade-in for course cards --- */
@keyframes staggerUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.stagger-course {
  opacity: 0;
  animation: staggerUp 0.5s cubic-bezier(0.16,1,0.3,1) forwards;
}

/* ========================================================
   ACCORDION — Course Outline Lecture List
   ======================================================== */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.accordion-content.open {
  max-height: 2000px;
}

/* ========================================================
   NOTEBOOK PLACEHOLDER (contenteditable)
   ======================================================== */
#notebook-textarea:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}
#notebook-textarea[data-placeholder="Ghi chép auto-save..."]:empty::before {
  content: "Ghi chép auto-save... ✍️";
}

/* ========================================================
   PREMIUM VIDEO PLAYER ENHANCEMENTS
   ======================================================== */
.video-container {
  padding-bottom: 56.25%;
}
#video-player-wrap iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
}

/* Stat card background fix */
.stats-bento .stat-card-v2 {
  background-color: var(--bg-card);
}

/* ========================================================
   MOBILE-FIRST OPTIMIZATIONS
   ======================================================== */

/* Safe area + tap highlights */
@media (max-width: 1023px) {
  * { -webkit-tap-highlight-color: transparent; }

  .custom-scrollbar {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  #mobile-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom, 0px);
    height: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  .main-view {
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* ========================================================
   BOTTOM SHEET SYSTEM
   ======================================================== */

.bottom-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.bottom-sheet-backdrop.open {
  opacity: 1;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-radius: 1.5rem 1.5rem 0 0;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -20px 60px -10px rgba(0, 0, 0, 0.3);
}
.bottom-sheet.open {
  transform: translateY(0);
}

.bottom-sheet-handle {
  width: 40px;
  height: 5px;
  background: var(--border-color);
  border-radius: 999px;
  margin: 12px auto 0;
  flex-shrink: 0;
}

/* ========================================================
   GLOBAL SEARCH DROPDOWN
   ======================================================== */

#search-dropdown,
#mobile-search-dropdown {
  animation: searchDropIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes searchDropIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.search-result-item:hover {
  background: rgba(249, 115, 22, 0.08);
}
.search-result-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border-color);
}
.search-result-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.search-result-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}
.search-result-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}
.search-section-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 6px 10px 4px;
}

/* ========================================================
   CUSTOM VIDEO PLAYER OVERLAY
   ======================================================== */

.custom-player-overlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 50%);
  border-radius: 1.25rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.custom-player-overlay.visible,
#video-container-wrap:hover .custom-player-overlay:not(.hidden) {
  opacity: 1;
  pointer-events: all;
}
.custom-player-overlay.hidden {
  display: none;
}
.custom-player-inner {
  width: 100%;
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.player-controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.player-ctrl-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: white;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border-radius: 50%;
  padding: 10px;
  transition: background 0.2s ease, transform 0.15s ease;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.2);
}
.player-ctrl-btn:hover, .player-ctrl-btn:active {
  background: rgba(249,115,22,0.4);
  transform: scale(1.1);
}
.player-play-btn {
  padding: 14px;
  background: rgba(249,115,22,0.5);
  border-color: rgba(249,115,22,0.6);
}
.player-speed-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.speed-btn {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  cursor: pointer;
  transition: all 0.15s ease;
}
.speed-btn.active, .speed-btn:hover {
  background: #f97316;
  color: white;
  border-color: #f97316;
}

/* ========================================================
   VIEW TRANSITIONS API
   ======================================================== */

@keyframes vt-slide-in-right {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes vt-slide-out-left {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-30px); }
}

@supports (view-transition-name: none) {
  ::view-transition-old(root) {
    animation: vt-slide-out-left 0.25s ease forwards;
  }
  ::view-transition-new(root) {
    animation: vt-slide-in-right 0.25s ease forwards;
  }
}

/* ========================================================
   ENHANCED SKELETON SCREENS
   ======================================================== */

.skeleton-card {
  background: var(--bg-card);
  border-radius: 1.5rem;
  border: 1px solid var(--border-color);
  padding: 1rem;
  overflow: hidden;
}
.skeleton-line, .skeleton-img, .skeleton-circle, .skeleton-text-sm, .skeleton-text-xs {
  background: linear-gradient(90deg,
    var(--border-color) 25%,
    rgba(150,150,150,0.15) 50%,
    var(--border-color) 75%
  );
  background-size: 600px 100%;
  animation: shimmer 1.6s infinite linear;
  border-radius: 8px;
}
.skeleton-circle {
  border-radius: 50%;
  flex-shrink: 0;
}
.skeleton-text-sm {
  height: 12px;
  border-radius: 6px;
  margin-bottom: 8px;
}
.skeleton-text-xs {
  height: 10px;
  border-radius: 5px;
  margin-bottom: 6px;
}

/* Skeleton for news grid */
.skeleton-news {
  background: var(--bg-card);
  border-radius: 1.25rem;
  border: 1px solid var(--border-color);
  overflow: hidden;
}
.skeleton-news-img {
  width: 100%;
  height: 160px;
  background: linear-gradient(90deg, var(--border-color) 25%, rgba(150,150,150,0.15) 50%, var(--border-color) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.6s infinite linear;
}
.skeleton-news-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Skeleton for docs */
.skeleton-doc {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: 1rem;
  border: 1px solid var(--border-color);
}

/* Skeleton for QA */
.skeleton-qa {
  padding: 16px;
  background: var(--bg-card);
  border-radius: 1.25rem;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.skeleton-qa-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Haptic pulse animation for key actions */
@keyframes hapticPulse {
  0%   { transform: scale(1); }
  30%  { transform: scale(0.92); }
  60%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}
.haptic-pulse {
  animation: hapticPulse 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ========================================================
   LIQUID GLASS EFFECT (cinematic glassmorphism)
   ======================================================== */

.liquid-glass {
  background: rgba(255, 255, 255, 0.01);
  background-blend-mode: luminosity;
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border: none;
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.12),
    0 8px 32px rgba(0, 0, 0, 0.18);
  position: relative;
  overflow: hidden;
}

.liquid-glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.4px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.45) 0%,
    rgba(255, 255, 255, 0.15) 20%,
    rgba(255, 255, 255, 0) 40%,
    rgba(255, 255, 255, 0) 60%,
    rgba(255, 255, 255, 0.15) 80%,
    rgba(255, 255, 255, 0.45) 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ========================================================
   CINEMATIC FADE-RISE ANIMATIONS
   ======================================================== */

@keyframes fade-rise {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-rise {
  animation: fade-rise 0.8s ease-out both;
}

.animate-fade-rise-delay {
  animation: fade-rise 0.8s ease-out 0.2s both;
}

.animate-fade-rise-delay-2 {
  animation: fade-rise 0.8s ease-out 0.4s both;
}

/* ========================================================
   HERO BANNER V3 — VIDEO BACKGROUND UPGRADES
   ======================================================== */

/* Taller banner on large screens */
.hero-banner-v2 {
  min-height: 360px;
}

/* Glass content box in hero */
.hero-banner-content {
  background: rgba(10, 10, 20, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 24px 48px rgba(0, 0, 0, 0.35);
  /* Override liquid-glass bg for hero specifically */
}

/* Instrument Serif display headings */
.display-heading {
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 0.95;
}

/* ========================================================
   HEADER LIQUID GLASS — light & dark mode
   ======================================================== */

/* Light mode: subtle glass over white/cream bg */
header.liquid-glass {
  background: rgba(253, 251, 247, 0.72);
  border-color: rgba(229, 231, 235, 0.6) !important;
}

/* Dark mode: dark glass */
.dark header.liquid-glass {
  background: rgba(20, 20, 20, 0.65);
  border-color: rgba(255, 255, 255, 0.07) !important;
}

/* ========================================================
   SIDEBAR LIQUID GLASS in dark
   ======================================================== */

.dark #global-sidebar {
  background: rgba(22, 22, 22, 0.92) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-right: 1px solid rgba(255,255,255,0.06) !important;
}

/* ========================================================
   VIDEO BANNER — pause parallax for video element
   ======================================================== */

/* The video replaces the img so disable old img parallax */
#hero-banner video#banner-parallax-img {
  transform: scale(1.06);
  transition: transform 8s ease-out;
  will-change: transform;
}

/* Subtle Ken Burns on the video */
@keyframes kenBurns {
  0%   { transform: scale(1.06) translate(0, 0); }
  50%  { transform: scale(1.12) translate(-1%, 1%); }
  100% { transform: scale(1.06) translate(0, 0); }
}
#hero-banner video#banner-parallax-img {
  animation: kenBurns 20s ease-in-out infinite;
}

/* ========================================================
   UPGRADED QUICK ACTION PILLS — rounded-full style
   ======================================================== */

.quick-action-pill {
  border-radius: 9999px !important;
}

/* ========================================================
   GLASS STAT CARDS — subtle upgrade
   ======================================================== */

.stats-bento .stat-card-v2 {
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* ========================================================
   MOBILE BOTTOM NAV — liquid glass
   ======================================================== */

#mobile-bottom-nav {
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.dark #mobile-bottom-nav {
  background: rgba(20, 20, 20, 0.88) !important;
  border-color: rgba(255,255,255,0.07) !important;
}

/* ========================================================
   CUSTOM CURSOR RING
   ======================================================== */

body.use-custom-cursor * { cursor: none !important; }
@media (hover: none) { body.use-custom-cursor * { cursor: auto !important; } }

@media (max-width: 768px) {
  #cursor-ring, #mouse-glow {
    display: none !important;
  }
}

#cursor-ring {
  position: fixed;
  width: 28px;
  height: 28px;
  border: 2px solid rgba(249, 115, 22, 0.6);
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  transform: translate(-50%, -50%);
  transition: width 0.2s ease, height 0.2s ease, background 0.2s ease, border-color 0.2s ease, opacity 0.3s ease;
  mix-blend-mode: difference;
  opacity: 0;
  will-change: left, top;
}
#cursor-ring.visible { opacity: 1; }
#cursor-ring.hovering {
  width: 48px;
  height: 48px;
  background: rgba(249, 115, 22, 0.12);
  border-color: rgba(249, 115, 22, 0.9);
}
#cursor-ring.clicking {
  width: 18px;
  height: 18px;
  background: rgba(249, 115, 22, 0.3);
}

/* ========================================================
   HOLOGRAPHIC CARD EFFECT
   ======================================================== */

.holo-card {
  position: relative;
  isolation: isolate;
  transform-style: preserve-3d;
}
.holo-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: conic-gradient(
    from var(--holo-angle, 0deg) at var(--holo-x, 50%) var(--holo-y, 50%),
    rgba(255,0,128,0.08),
    rgba(255,165,0,0.08),
    rgba(0,255,128,0.08),
    rgba(0,128,255,0.08),
    rgba(128,0,255,0.08),
    rgba(255,0,128,0.08)
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}
.holo-card:hover::after {
  opacity: 1;
}
/* Ensure content stays above holo overlay */
.holo-card > * { position: relative; z-index: 2; }

/* ========================================================
   SHINE TEXT ANIMATION
   ======================================================== */

@keyframes shine-sweep {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.text-shine {
  background: linear-gradient(
    90deg,
    var(--text-main) 0%,
    var(--text-main) 30%,
    rgba(249,115,22,0.9) 45%,
    rgba(251,191,36,1) 50%,
    rgba(249,115,22,0.9) 55%,
    var(--text-main) 70%,
    var(--text-main) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shine-sweep 4s linear infinite;
}

.dark .text-shine {
  background: linear-gradient(
    90deg,
    #EDEDED 0%,
    #EDEDED 30%,
    #fb923c 45%,
    #fbbf24 50%,
    #fb923c 55%,
    #EDEDED 70%,
    #EDEDED 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  animation: shine-sweep 4s linear infinite;
}

/* ========================================================
   STREAK & RANK SYSTEM
   ======================================================== */

#streak-widget { display: flex; }
#rank-badge { display: flex; }

/* Streak fire pulse when active */
@keyframes fire-pulse {
  0%, 100% { transform: scale(1) rotate(-5deg); filter: brightness(1); }
  50% { transform: scale(1.3) rotate(5deg); filter: brightness(1.3); }
}
.streak-active #streak-fire {
  animation: fire-pulse 1s ease-in-out infinite;
}

/* Rank badge colors */
#rank-badge[data-rank="tanbinh"]    { background: rgba(107,114,128,0.1); border-color: rgba(107,114,128,0.4); color: #6b7280; }
#rank-badge[data-rank="chienbbinh"] { background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.4); color: #3b82f6; }
#rank-badge[data-rank="thukhua"]    { background: rgba(234,179,8,0.1); border-color: rgba(234,179,8,0.4); color: #ca8a04; }
#rank-badge[data-rank="huyenthoai"] { background: rgba(168,85,247,0.1); border-color: rgba(168,85,247,0.4); color: #a855f7; }

/* Rank up animation */
@keyframes rank-up-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.5); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); }
}
.rank-up-animate { animation: rank-up-pop 0.6s cubic-bezier(0.34,1.56,0.64,1) forwards; }

/* ========================================================
   POMODORO TIMER
   ======================================================== */

#pomodoro-widget {
  transition: background 0.3s ease, border-color 0.3s ease;
}
#pomodoro-widget.break-mode {
  background: rgba(34,197,94,0.1);
  border-color: rgba(34,197,94,0.3);
}
#pomodoro-widget.break-mode #pomodoro-display { color: #22c55e; }

/* Pomodoro pulse when running */
@keyframes pomodoro-tick {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.pomodoro-running #pomodoro-display {
  animation: pomodoro-tick 1s ease-in-out infinite;
}

/* ========================================================
   LOFI MUSIC WAVE ANIMATION
   ======================================================== */

@keyframes lofi-wave-anim {
  0%, 100% { letter-spacing: 0; }
  50% { letter-spacing: 2px; }
}
.lofi-playing {
  animation: lofi-wave-anim 1.5s ease-in-out infinite;
}

/* ========================================================
   STUDY BUDDY WIDGET
   ======================================================== */

@keyframes ping-slow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.6); opacity: 0.4; }
}
.animate-ping-slow { animation: ping-slow 2s ease-in-out infinite; }

/* ========================================================
   FOCUS LIGHT MODE
   ======================================================== */

.focus-light-active #view-learning section > .max-w-6xl > *:not(#study-buddy-widget):not(.flex) {
  /* Dim everything except video+notebook area */
}

/* Dark overlay for focus light */
#focus-light-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 150;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
#focus-light-overlay.active { opacity: 1; }

/* Video stays bright */
#video-container-wrap { position: relative; z-index: 155; }

/* ========================================================
   ANIMATED LIVE PROGRESS BAR (Learning View)
   ======================================================== */

@keyframes progress-shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

#progress-bar {
  background: linear-gradient(90deg,
    #f97316 0%,
    #ef4444 25%,
    #fbbf24 50%,
    #f97316 75%,
    #ef4444 100%
  );
  background-size: 200% 100%;
  animation: progress-shimmer 2s linear infinite;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================================
   DARK MODE — NEON GLOW (Subject-based)
   ======================================================== */

:root {
  --glow-toan: rgba(59, 130, 246, 0.5);    /* Blue */
  --glow-ly: rgba(239, 68, 68, 0.5);       /* Red */
  --glow-hoa: rgba(168, 85, 247, 0.5);     /* Purple */
  --glow-sinh: rgba(34, 197, 94, 0.5);     /* Green */
  --glow-anh: rgba(20, 184, 166, 0.5);     /* Teal */
  --glow-van: rgba(251, 191, 36, 0.5);     /* Yellow */
  --glow-su: rgba(249, 115, 22, 0.5);      /* Orange */
  --glow-dia: rgba(16, 185, 129, 0.5);     /* Emerald */
}

.dark .course-card[data-subject*="Toán"],
.dark .holo-card[data-subject*="Toán"] { box-shadow: 0 0 20px var(--glow-toan), 0 4px 16px var(--glow-toan); }
.dark .course-card[data-subject*="Lý"],
.dark .holo-card[data-subject*="Lý"]   { box-shadow: 0 0 20px var(--glow-ly), 0 4px 16px var(--glow-ly); }
.dark .course-card[data-subject*="Hóa"],
.dark .holo-card[data-subject*="Hóa"]  { box-shadow: 0 0 20px var(--glow-hoa), 0 4px 16px var(--glow-hoa); }
.dark .course-card[data-subject*="Sinh"],
.dark .holo-card[data-subject*="Sinh"] { box-shadow: 0 0 20px var(--glow-sinh), 0 4px 16px var(--glow-sinh); }
.dark .course-card[data-subject*="Anh"],
.dark .holo-card[data-subject*="Anh"]  { box-shadow: 0 0 20px var(--glow-anh), 0 4px 16px var(--glow-anh); }

/* Global card glow in dark for stat cards */
.dark .stat-card-orange { box-shadow: 0 0 16px rgba(249,115,22,0.25), 0 4px 12px rgba(0,0,0,0.4) !important; }
.dark .stat-card-blue   { box-shadow: 0 0 16px rgba(59,130,246,0.25), 0 4px 12px rgba(0,0,0,0.4) !important; }
.dark .stat-card-green  { box-shadow: 0 0 16px rgba(34,197,94,0.25), 0 4px 12px rgba(0,0,0,0.4) !important; }
.dark .stat-card-purple { box-shadow: 0 0 16px rgba(168,85,247,0.25), 0 4px 12px rgba(0,0,0,0.4) !important; }

/* Enhanced glassmorphism in dark mode */
.dark .glass-card {
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
}
.dark #grain-overlay { opacity: 0.055; }

/* ========================================================
   AMBIENT GLOW (Subject color ambient behind cards)
   ======================================================== */

.ambient-wrap {
  position: relative;
}
.ambient-wrap::before {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: inherit;
  background: var(--ambient-color, transparent);
  filter: blur(24px);
  opacity: 0;
  transition: opacity 0.5s ease;
  z-index: -1;
  pointer-events: none;
}
.ambient-wrap:hover::before { opacity: 0.35; }
.dark .ambient-wrap:hover::before { opacity: 0.55; }

/* ========================================================
   BENTO GRID 2.0 — Varied cell sizes
   ======================================================== */

@media (min-width: 1024px) {
  .stats-bento {
    grid-template-columns: 1.8fr 1fr 1fr 1fr;
    grid-template-rows: auto;
    gap: 1.25rem;
  }
  /* Streak card spans extra on xl */
  .stats-bento .stat-card-orange {
    grid-column: span 2;
  }
}

/* ========================================================
   STREAK WIDGET ENTRANCE ANIMATION
   ======================================================== */

@keyframes streak-bounce-in {
  0% { transform: scale(0.5) rotate(-10deg); opacity: 0; }
  60% { transform: scale(1.15) rotate(3deg); opacity: 1; }
  80% { transform: scale(0.95) rotate(-1deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.streak-bounce { animation: streak-bounce-in 0.6s cubic-bezier(0.34,1.56,0.64,1) both; }

/* ========================================================
   LOFI AUDIO ELEMENT (hidden)
   ======================================================== */

#lofi-audio { display: none; }

/* ========================================================
   PARALLAX 3D STACK — Card inner layers float on Z axis
   ======================================================== */

.stat-card-v2,
[data-course-card] {
  transform-style: preserve-3d;
  perspective: 1200px;
}

.stat-card-v2 .stat-icon-v2 {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.stat-card-v2:hover .stat-icon-v2 {
  transform: translateZ(50px) rotate(10deg);
}
.stat-card-v2 .stat-value-v2 {
  transition: transform 0.35s ease;
}
.stat-card-v2:hover .stat-value-v2 {
  transform: translateZ(30px);
}
.stat-card-v2 .stat-label-v2 {
  transition: transform 0.3s ease;
}
.stat-card-v2:hover .stat-label-v2 {
  transform: translateZ(15px);
}

[data-course-card] h3 {
  transition: transform 0.35s ease;
}
[data-course-card]:hover h3 {
  transform: translateZ(25px);
}

/* ========================================================
   AMBIENT SCENE SYSTEM
   ======================================================== */

body.scene-rain {
  --scene-hue: 220deg;
}
body.scene-forest {
  --scene-hue: 140deg;
}
body.scene-cafe {
  --scene-hue: 30deg;
}
body.scene-night {
  --scene-hue: 250deg;
}

body.scene-rain #grain-overlay { opacity: 0.07; }
body.scene-night #grain-overlay { opacity: 0.06; }

/* Scene-specific sidebar + header tinting */
body.scene-rain header.liquid-glass {
  background: rgba(30, 58, 110, 0.55) !important;
  border-color: rgba(100, 160, 255, 0.15) !important;
}
body.scene-forest header.liquid-glass {
  background: rgba(18, 60, 28, 0.55) !important;
  border-color: rgba(80, 200, 100, 0.15) !important;
}
body.scene-cafe header.liquid-glass {
  background: rgba(78, 42, 12, 0.58) !important;
  border-color: rgba(200, 140, 60, 0.15) !important;
}
body.scene-night header.liquid-glass {
  background: rgba(5, 5, 22, 0.82) !important;
  border-color: rgba(80, 80, 200, 0.15) !important;
}

body.scene-night #global-sidebar {
  background: rgba(5, 5, 22, 0.97) !important;
}
body.scene-night .bg-main {
  filter: brightness(0.82) saturate(0.85);
}
body.scene-rain .bg-main {
  filter: brightness(0.91) hue-rotate(8deg);
}
body.scene-forest .bg-main {
  filter: brightness(0.93) hue-rotate(-12deg) saturate(1.1);
}
body.scene-cafe .bg-main {
  filter: sepia(0.14) brightness(0.95) saturate(1.05);
}

/* ========================================================
   SCENE CARD BUTTONS
   ======================================================== */

.scene-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: 14px;
  border: 2px solid var(--border-color);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}
.scene-btn:hover {
  border-color: rgba(249,115,22,0.5);
  color: var(--text-main);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(249,115,22,0.1);
}
.scene-btn.active {
  border-color: #f97316;
  background: rgba(249,115,22,0.08);
  color: #f97316;
}
.scene-btn .scene-icon { font-size: 26px; line-height: 1; }

#scene-panel.open { left: 0 !important; }
#btn-scene-tab:hover {
  color: var(--text-main) !important;
  background: rgba(249,115,22,0.06) !important;
}

/* ========================================================
   GHOST COMMUNITY TOASTS
   ======================================================== */

.ghost-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  animation: ghost-in 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
  max-width: 280px;
  line-height: 1.4;
  backdrop-filter: blur(12px);
}
.dark .ghost-toast {
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
}
@keyframes ghost-in {
  from { opacity: 0; transform: translateX(-28px) scale(0.88); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes ghost-out {
  from { opacity: 1; transform: translateX(0); max-height: 80px; }
  to   { opacity: 0; transform: translateX(-28px); max-height: 0; margin: 0; padding: 0; }
}
.ghost-toast.removing {
  animation: ghost-out 0.35s ease forwards;
}
.ghost-toast-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #a855f7);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 13px; font-weight: 800; flex-shrink: 0;
}

/* ========================================================
   MASCOT WIDGET
   ======================================================== */

#mascot-widget {
  filter: drop-shadow(0 8px 18px rgba(0,0,0,0.18));
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), filter 0.3s ease;
  user-select: none;
}
#mascot-widget:hover {
  transform: scale(1.12) rotate(5deg) !important;
  filter: drop-shadow(0 14px 28px rgba(249,115,22,0.35));
}

@keyframes mascot-float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-10px); }
}
#mascot-widget.floating {
  animation: mascot-float 3s ease-in-out infinite;
}

@keyframes mascot-sleep-anim {
  0%, 100% { opacity: 1; filter: brightness(0.65) saturate(0.4); }
  50%       { opacity: 0.6; filter: brightness(0.5) saturate(0.3); }
}
#mascot-widget.sleeping {
  animation: mascot-sleep-anim 2.5s ease-in-out infinite;
}

@keyframes mascot-cheer {
  0%   { transform: scale(1) rotate(0); }
  20%  { transform: scale(1.35) rotate(-10deg); }
  40%  { transform: scale(1.35) rotate(10deg); }
  60%  { transform: scale(1.2) rotate(-5deg); }
  80%  { transform: scale(1.1) rotate(3deg); }
  100% { transform: scale(1) rotate(0); }
}
#mascot-widget.cheering {
  animation: mascot-cheer 0.7s cubic-bezier(0.34,1.56,0.64,1) forwards !important;
}

/* Mascot bubble */
#mascot-bubble.show {
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
}
#mascot-bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  right: 18px;
  border: 5px solid transparent;
  border-top-color: var(--border-color);
}
#mascot-bubble::before {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 19px;
  border: 4px solid transparent;
  border-top-color: var(--bg-card);
  z-index: 1;
}

/* ================================================================
   AI CHATBOT — Floating Bubble + 3D Glass Panel
   ================================================================ */

/* ---- Floating Bubble ---- */
#ai-bubble-btn {
  position: fixed;
  bottom: 88px;
  right: 80px; /* Left of mascot */
  z-index: 310;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, rgba(168,85,247,0.9) 0%, rgba(109,40,217,0.95) 100%);
  border: 1.5px solid rgba(168,85,247,0.5);
  border-radius: 20px;
  padding: 10px 14px;
  cursor: pointer;
  box-shadow:
    0 0 0 0 rgba(168, 85, 247, 0.4),
    0 8px 32px rgba(109, 40, 217, 0.4),
    inset 0 1px 0 rgba(255,255,255,0.2);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1),
              box-shadow 0.3s ease,
              background 0.3s ease;
  animation: ai-bubble-float 3.5s ease-in-out infinite;
}

@keyframes ai-bubble-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  30%       { transform: translateY(-8px) rotate(-1deg); }
  70%       { transform: translateY(-4px) rotate(1deg); }
}

@keyframes ai-bubble-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(168,85,247,0.6), 0 8px 32px rgba(109,40,217,0.4), inset 0 1px 0 rgba(255,255,255,0.2); }
  50%       { box-shadow: 0 0 0 12px rgba(168,85,247,0), 0 12px 40px rgba(109,40,217,0.5), inset 0 1px 0 rgba(255,255,255,0.2); }
}

#ai-bubble-btn:hover {
  animation: ai-bubble-pulse 2s ease-in-out infinite;
  transform: scale(1.08) translateY(-4px) !important;
  background: linear-gradient(135deg, rgba(192,132,252,0.95) 0%, rgba(124,58,237,1) 100%);
}

#ai-bubble-btn:active {
  transform: scale(0.94) !important;
  animation: none;
}

#ai-bubble-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

#ai-bubble-label {
  font-size: 10px;
  font-weight: 800;
  color: rgba(255,255,255,0.9);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

#ai-notif-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid var(--bg-card);
  animation: ai-dot-blink 1.5s ease-in-out infinite;
}
@keyframes ai-dot-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.8); }
}

/* Antigravity shadow — follows mouse via JS */
#ai-bubble-btn::before {
  content: '';
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%) scaleX(var(--shadow-scale, 1));
  width: 60%;
  height: 16px;
  background: radial-gradient(ellipse, rgba(109,40,217,0.4) 0%, transparent 70%);
  filter: blur(6px);
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: var(--shadow-opacity, 0.6);
  pointer-events: none;
}

/* ---- Chat Panel (3D Glass) ---- */
.ai-glass-panel {
  position: fixed;
  bottom: 88px;
  right: 80px;
  width: 380px;
  max-height: 580px;
  z-index: 320;
  display: flex;
  flex-direction: column;
  border-radius: 24px;

  /* 3D Glassmorphism */
  background: linear-gradient(
    145deg,
    rgba(255,255,255,0.12) 0%,
    rgba(168,85,247,0.06) 40%,
    rgba(255,255,255,0.08) 100%
  );
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  border: 1px solid rgba(168,85,247,0.25);
  box-shadow:
    0 32px 80px rgba(109,40,217,0.25),
    0 8px 32px rgba(0,0,0,0.2),
    inset 0 1px 0 rgba(255,255,255,0.25),
    inset 0 -1px 0 rgba(168,85,247,0.1);

  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.4s cubic-bezier(0.32,0.72,0,1),
    opacity 0.35s ease;

  /* 3D depth */
  perspective: 800px;
  transform-style: preserve-3d;
}

.ai-glass-panel.open {
  transform: translateY(0) scale(1) rotateX(0deg);
  opacity: 1;
  pointer-events: all;
}

/* Dark mode adjustments */
.dark .ai-glass-panel {
  background: linear-gradient(
    145deg,
    rgba(30,10,60,0.75) 0%,
    rgba(109,40,217,0.12) 40%,
    rgba(15,5,40,0.8) 100%
  );
  border-color: rgba(168,85,247,0.3);
  box-shadow:
    0 32px 80px rgba(109,40,217,0.35),
    0 8px 32px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(168,85,247,0.2);
}

/* Header */
.ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid rgba(168,85,247,0.12);
  flex-shrink: 0;
}

.ai-avatar-ring {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a78bfa, #6d28d9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 0 16px rgba(168,85,247,0.5), 0 4px 12px rgba(109,40,217,0.4);
  animation: ai-avatar-glow 3s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes ai-avatar-glow {
  0%, 100% { box-shadow: 0 0 12px rgba(168,85,247,0.5), 0 4px 12px rgba(109,40,217,0.4); }
  50%       { box-shadow: 0 0 24px rgba(168,85,247,0.8), 0 4px 20px rgba(109,40,217,0.6); }
}

.ai-context-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(168,85,247,0.1);
  border: 1px solid rgba(168,85,247,0.25);
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  color: #a78bfa;
  cursor: default;
  white-space: nowrap;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(168,85,247,0.1);
  border: 1px solid rgba(168,85,247,0.2);
  color: #a78bfa;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
}
.ai-close-btn:hover {
  background: rgba(168,85,247,0.2);
  transform: rotate(90deg) scale(1.1);
}

/* Messages area */
.ai-messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.ai-messages-area::-webkit-scrollbar { width: 4px; }
.ai-messages-area::-webkit-scrollbar-track { background: transparent; }
.ai-messages-area::-webkit-scrollbar-thumb { background: rgba(168,85,247,0.3); border-radius: 4px; }

/* Message bubbles */
.ai-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: ai-msg-in 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
  max-width: 100%;
}
@keyframes ai-msg-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ai-msg-content {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13px;
  line-height: 1.55;
  font-weight: 500;
  word-wrap: break-word;
  white-space: pre-wrap;
}

/* User message — right aligned */
.ai-msg.user {
  flex-direction: row-reverse;
}
.ai-msg.user .ai-msg-content {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: white;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 4px 16px rgba(109,40,217,0.35);
}

/* AI message — left aligned */
.ai-msg.ai .ai-msg-content {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(168,85,247,0.15);
  color: var(--text-main);
  border-radius: 18px 18px 18px 4px;
  backdrop-filter: blur(8px);
}
.dark .ai-msg.ai .ai-msg-content {
  background: rgba(168,85,247,0.08);
}

/* AI icon */
.ai-msg-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a78bfa, #6d28d9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(109,40,217,0.4);
}

/* Typing indicator */
.ai-typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 10px 14px;
}
.ai-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a78bfa;
  animation: ai-typing-bounce 1.2s ease-in-out infinite;
}
.ai-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes ai-typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%            { transform: translateY(-6px); opacity: 1; }
}

/* Input row */
.ai-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px 14px;
  border-top: 1px solid rgba(168,85,247,0.1);
  flex-shrink: 0;
}

.ai-input {
  flex: 1;
  padding: 10px 14px;
  background: rgba(168,85,247,0.06);
  border: 1px solid rgba(168,85,247,0.2);
  border-radius: 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, background 0.2s;
  max-height: 120px;
  overflow-y: auto;
}
.ai-input::placeholder { color: var(--text-muted); }
.ai-input:focus {
  border-color: rgba(168,85,247,0.5);
  background: rgba(168,85,247,0.1);
  box-shadow: 0 0 0 3px rgba(168,85,247,0.1);
}

.ai-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 14px rgba(109,40,217,0.4);
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s ease;
  flex-shrink: 0;
}
.ai-send-btn:hover {
  transform: scale(1.1) rotate(-5deg);
  box-shadow: 0 6px 20px rgba(109,40,217,0.6);
}
.ai-send-btn:active {
  transform: scale(0.94);
}
.ai-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Mobile responsive */
@media (max-width: 480px) {
  .ai-glass-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 70vh;
    border-radius: 24px 24px 0 0;
  }
  #ai-bubble-btn {
    bottom: 130px;
    right: 16px;
    padding: 10px;
    border-radius: 50%;
  }
  #ai-bubble-label {
    display: none;
  }
  #ai-bubble-inner svg {
    width: 24px;
    height: 24px;
  }
}

/* ---- Welcome message ---- */
.ai-welcome {
  text-align: center;
  padding: 24px 16px 8px;
}
.ai-welcome-emoji {
  font-size: 36px;
  display: block;
  margin-bottom: 8px;
  animation: ai-bubble-float 3s ease-in-out infinite;
}
.ai-welcome-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}
.ai-welcome-sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Quick prompt chips */
.ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 0 0;
  justify-content: center;
}
.ai-chip {
  padding: 5px 12px;
  background: rgba(168,85,247,0.08);
  border: 1px solid rgba(168,85,247,0.2);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  color: #a78bfa;
  cursor: pointer;
  transition: all 0.2s ease;
}
.ai-chip:hover {
  background: rgba(168,85,247,0.18);
  border-color: rgba(168,85,247,0.4);
  transform: translateY(-1px);
}


/* Mobile Fixes */
@media (max-width: 768px) {
  #ghost-toast-area, #mascot-widget {
    display: none !important;
  }
}

button, a, input, select, textarea {
  touch-action: manipulation;
}

/* ========================================================
   MOBILE BOTTOM NAV PADDING FIX
   ======================================================== */
@media (max-width: 1023px) {
  #main-views-container,
  #global-sidebar .overflow-y-auto {
    padding-bottom: 90px !important;
  }
}
