/* ──────────────────────────────────────────────
   XiaoZhi Web — Premium Design System
   ────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  /* Default: Deep dark modern palette */
  --bg: #09090c;
  --bg-card: rgba(20, 20, 24, 0.65);
  --bg-input: rgba(28, 28, 35, 0.85);
  --surface: rgba(45, 45, 52, 0.6);
  --border: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(255, 255, 255, 0.18);
  --shadow: rgba(0, 0, 0, 0.6);
  
  /* Text */
  --text: #ffffff;
  --text-dim: #9ca3af;
  
  /* Accents (Teacher theme by default) */
  --accent: #8b5cf6;
  --accent-hover: #9f75ff;
  --accent-glow: rgba(139, 92, 246, 0.4);
  --accent-dark: #6d28d9;
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.3);
  
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.3);
  
  --warning: #f59e0b;
  
  /* Geometry */
  --radius: 24px;
  --radius-sm: 14px;
  --radius-pill: 9999px;
  
  --font: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  --bg-gradient: radial-gradient(circle at 50% 0%, rgba(139, 92, 246, 0.15) 0%, transparent 60%),
                 radial-gradient(circle at 100% 100%, rgba(236, 72, 153, 0.05) 0%, transparent 60%);
}

body.light-theme {
  --bg: #f3f4f6;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-input: rgba(243, 244, 246, 0.95);
  --surface: rgba(229, 231, 235, 0.85);
  --border: rgba(0, 0, 0, 0.09);
  --border-highlight: rgba(0, 0, 0, 0.18);
  --shadow: rgba(0, 0, 0, 0.08);
  
  --text: #111827;
  --text-dim: #4b5563;
  --bg-gradient: radial-gradient(circle at 50% 0%, rgba(139, 92, 246, 0.1) 0%, transparent 60%),
                 radial-gradient(circle at 100% 100%, rgba(236, 72, 153, 0.04) 0%, transparent 60%);
}

* { 
  margin: 0; 
  padding: 0; 
  box-sizing: border-box; 
  /* Hide scrollbar for IE, Edge and Firefox */
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Hide scrollbar for Chrome, Safari and Opera */
::-webkit-scrollbar {
  display: none;
}
body {
  font-family: var(--font);
  background: var(--bg);
  background-image: var(--bg-gradient);
  color: var(--text);
  min-height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition), color var(--transition);
}

/* ─── 5 Chatbot Role Themes ─── */

/* 1. Teacher Theme */
body.theme-teacher {
  --accent: #8b5cf6;
  --accent-hover: #9f75ff;
  --accent-glow: rgba(139, 92, 246, 0.4);
  --accent-dark: #6d28d9;
  --bg-gradient: radial-gradient(circle at 50% 0%, rgba(139, 92, 246, 0.15) 0%, transparent 60%),
                 radial-gradient(circle at 100% 100%, rgba(236, 72, 153, 0.05) 0%, transparent 60%);
}
body.theme-teacher.light-theme {
  --bg-gradient: radial-gradient(circle at 50% 0%, rgba(139, 92, 246, 0.1) 0%, transparent 60%),
                 radial-gradient(circle at 100% 100%, rgba(236, 72, 153, 0.04) 0%, transparent 60%);
}

/* 2. Cashier Theme */
body.theme-cashier {
  --accent: #10b981;
  --accent-hover: #34d399;
  --accent-glow: rgba(16, 185, 129, 0.4);
  --accent-dark: #047857;
  --bg-gradient: radial-gradient(circle at 50% 0%, rgba(16, 185, 129, 0.15) 0%, transparent 60%),
                 radial-gradient(circle at 100% 100%, rgba(59, 130, 246, 0.05) 0%, transparent 60%);
}
body.theme-cashier.light-theme {
  --bg-gradient: radial-gradient(circle at 50% 0%, rgba(16, 185, 129, 0.1) 0%, transparent 60%),
                 radial-gradient(circle at 100% 100%, rgba(59, 130, 246, 0.04) 0%, transparent 60%);
}

/* 3. Receptionist Theme */
body.theme-receptionist {
  --accent: #f59e0b;
  --accent-hover: #fbbf24;
  --accent-glow: rgba(245, 158, 11, 0.4);
  --accent-dark: #b45309;
  --bg-gradient: radial-gradient(circle at 50% 0%, rgba(245, 158, 11, 0.15) 0%, transparent 60%),
                 radial-gradient(circle at 100% 100%, rgba(239, 68, 68, 0.05) 0%, transparent 60%);
}
body.theme-receptionist.light-theme {
  --bg-gradient: radial-gradient(circle at 50% 0%, rgba(245, 158, 11, 0.1) 0%, transparent 60%),
                 radial-gradient(circle at 100% 100%, rgba(239, 68, 68, 0.04) 0%, transparent 60%);
}

/* 4. Airport Theme */
body.theme-airport {
  --accent: #06b6d4;
  --accent-hover: #22d3ee;
  --accent-glow: rgba(6, 182, 212, 0.4);
  --accent-dark: #0891b2;
  --bg-gradient: radial-gradient(circle at 50% 0%, rgba(6, 182, 212, 0.15) 0%, transparent 60%),
                 radial-gradient(circle at 100% 100%, rgba(59, 130, 246, 0.05) 0%, transparent 60%);
}
body.theme-airport.light-theme {
  --bg-gradient: radial-gradient(circle at 50% 0%, rgba(6, 182, 212, 0.1) 0%, transparent 60%),
                 radial-gradient(circle at 100% 100%, rgba(59, 130, 246, 0.04) 0%, transparent 60%);
}

/* 5. Guide Theme */
body.theme-guide {
  --accent: #ef4444;
  --accent-hover: #f87171;
  --accent-glow: rgba(239, 68, 68, 0.4);
  --accent-dark: #b91c1c;
  --bg-gradient: radial-gradient(circle at 50% 0%, rgba(239, 68, 68, 0.15) 0%, transparent 60%),
                 radial-gradient(circle at 100% 100%, rgba(245, 158, 11, 0.05) 0%, transparent 60%);
}
body.theme-guide.light-theme {
  --bg-gradient: radial-gradient(circle at 50% 0%, rgba(239, 68, 68, 0.1) 0%, transparent 60%),
                 radial-gradient(circle at 100% 100%, rgba(245, 158, 11, 0.04) 0%, transparent 60%);
}

/* 6. Shopping Theme */
body.theme-shopping {
  --accent: #ec4899;
  --accent-hover: #f472b6;
  --accent-glow: rgba(236, 72, 153, 0.4);
  --accent-dark: #be185d;
  --bg-gradient: radial-gradient(circle at 50% 0%, rgba(236, 72, 153, 0.15) 0%, transparent 60%),
                 radial-gradient(circle at 100% 100%, rgba(139, 92, 246, 0.05) 0%, transparent 60%);
}
body.theme-shopping.light-theme {
  --bg-gradient: radial-gradient(circle at 50% 0%, rgba(236, 72, 153, 0.1) 0%, transparent 60%),
                 radial-gradient(circle at 100% 100%, rgba(139, 92, 246, 0.04) 0%, transparent 60%);
}

/* ─── Layout ──────────────────────────────── */

.app-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 60px 16px 16px 16px;
  height: 100dvh;
  align-items: stretch;
}

#app {
  grid-column: 1;
  width: 100%;
  max-width: 100%;
  justify-self: stretch;
  height: calc(100dvh - 76px);
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 10px 40px var(--shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: background-color var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.hidden { display: none !important; }

/* ─── Views ───────────────────────────────── */

.view { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* ─── Empty State View ───────────────────── */

#empty-view {
  justify-content: center;
  align-items: center;
  padding: 24px;
  text-align: center;
}

.empty-content {
  animation: fadeInUp 0.6s ease forwards;
}

.empty-avatar {
  width: 120px;
  height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 10px 25px rgba(139, 92, 246, 0.4));
  margin-bottom: 20px;
  animation: float 3s ease-in-out infinite;
}

#empty-view h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#empty-view p {
  color: var(--text-dim);
  line-height: 1.6;
}

/* ─── Sidebars (Left and Right) ───────────── */

.sidebar {
  justify-self: stretch;
  width: 100%;
  height: calc(100dvh - 76px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 30px var(--shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: background-color var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.chatbot-sidebar {
  grid-column: 1;
}

.suggestion-sidebar {
  grid-column: 2;
}

.sidebar-header {
  margin-bottom: 24px;
}

.sidebar-header .logo {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #8b5cf6, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}

.sidebar-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* Chatbot Card Styles */
.chatbot-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.chatbot-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
  color: var(--text);
  text-align: left;
  position: relative;
  width: 100%;
  overflow: hidden;
}

.chatbot-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(139,92,246,0.08), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.chatbot-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 6px 18px rgba(139, 92, 246, 0.1);
}

.chatbot-card:hover::before { opacity: 1; }

.chatbot-card.active {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.12);
  box-shadow: 0 0 15px var(--accent-glow);
}

.chatbot-avatar {
  font-size: 1.8rem;
  background: rgba(255, 255, 255, 0.05);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chatbot-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.chatbot-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.chatbot-name {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-badge {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.online {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.offline {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.chatbot-role {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chatbot-topic {
  font-size: 0.75rem;
  color: var(--accent-hover);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

/* Suggestion Sidebar Styles */
.suggestion-sidebar {
  border-left: 1px solid var(--border);
  transition: var(--transition);
}

.suggestion-sidebar:hover {
  box-shadow: 0 0 35px var(--accent-glow);
  border-color: var(--accent);
}

.suggestion-status-box {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 20px;
  text-align: center;
  border: 1px dashed var(--border-highlight);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.15);
  transition: var(--transition);
}

.suggestion-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  overflow-y: auto !important;
  max-height: 45vh; /* Enforce vertical constraint so it scrolls! */
  padding-right: 4px;
}

.status-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
}

.placeholder-icon {
  font-size: 2rem;
  opacity: 0.5;
}

.suggestion-item {
  background: var(--bg-lighter);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.2s, border-color 0.2s;
  animation: fadeInUp 0.4s ease forwards;
}

.suggestion-item:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.inline-suggestion-container {
  position: absolute;
  bottom: 100%;
  right: 24px;
  margin-bottom: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  border-radius: 20px;
  padding: 4px 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 10;
  max-width: 80%;
  backdrop-filter: blur(8px);
}
.inline-suggestion-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding-bottom: 2px;
}
.inline-suggestion-header .suggestion-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
  margin-top: 1px;
  margin-right: auto;
}
.inline-suggestion-content {
  flex: 1;
  font-size: 0.8rem;
  color: var(--text);
  white-space: normal;
  word-wrap: break-word;
}
.inline-suggestion-header .btn-icon-only {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  font-size: 0.8rem;
}

body.light-theme .suggestion-item {
  background: rgba(255, 255, 255, 0.5);
}

.suggestion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.suggestion-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 0.5px;
  background: rgba(139, 92, 246, 0.15);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

body.theme-cashier .suggestion-badge { background: rgba(16, 185, 129, 0.15); }
body.theme-receptionist .suggestion-badge { background: rgba(245, 158, 11, 0.15); }
body.theme-airport .suggestion-badge { background: rgba(6, 182, 212, 0.15); }
body.theme-guide .suggestion-badge { background: rgba(239, 68, 68, 0.15); }
body.theme-shopping .suggestion-badge { background: rgba(236, 72, 153, 0.15); }

.btn-copy-sug {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  opacity: 0.5;
  transition: opacity 0.2s, transform 0.2s;
  color: var(--text);
}

.btn-copy-sug:hover {
  opacity: 1;
  transform: scale(1.15);
}

.suggestion-en {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 4px;
}

.suggestion-vi {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* Spinner Loader */
.suggestion-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  color: var(--text-dim);
  flex: 1;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

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

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ─── Topic Badge (in header) ──────────── */

.topic-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent);
  border: 1px solid rgba(139, 92, 246, 0.3);
  white-space: nowrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.header-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.header-info-row {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.device-connection-info-badge {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
}

body.light-theme .device-connection-info-badge {
  background: rgba(0, 0, 0, 0.03);
}

.device-info-label {
  font-family: var(--font);
  font-weight: 500;
}

/* ─── Header ─────────────────────────────── */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px;
  background: linear-gradient(to bottom, rgba(5,5,5,0.6) 0%, transparent 100%);
  flex-shrink: 0;
  z-index: 10;
}

.header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-text {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  transition: var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid transparent;
}

.status-idle { 
  background: var(--surface); 
  color: var(--text-dim); 
  border-color: var(--border);
}
.status-connecting { 
  background: rgba(245, 158, 11, 0.1); 
  color: var(--warning); 
  border-color: rgba(245, 158, 11, 0.3);
}
.status-listening { 
  background: rgba(16, 185, 129, 0.1); 
  color: var(--success); 
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 15px var(--success-glow);
  animation: pulse-status 1.5s ease-in-out infinite; 
}
.status-speaking { 
  background: rgba(139, 92, 246, 0.1); 
  color: var(--accent); 
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: 0 0 15px var(--accent-glow);
  animation: pulse-status 1s ease-in-out infinite; 
}

/* ─── Emotion Display ────────────────────── */

.emotion-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2px 16px;
  flex-shrink: 0;
  height: 48px; /* Greatly reduced from 90px to maximize chat log space */
  background: transparent !important; /* Completely transparent to merge with the chat background */
  border-bottom: none !important; /* Remove borders for floating avatar effect */
  transition: background-color var(--transition), border-color var(--transition);
}

body.light-theme .emotion-container {
  background: transparent !important;
}

.emotion-img {
  width: 44px; /* Reduced from 72px for a highly compact and sleek aesthetic */
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
  transition: var(--transition);
}

.emotion-img:hover {
  transform: scale(1.1) translateY(-2px);
  filter: drop-shadow(0 6px 12px var(--accent-glow));
}

/* ─── Chat Log ───────────────────────────── */

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scrollbar-width: none; /* Hide scrollbar for cleaner look */
}
.chat-log::-webkit-scrollbar { display: none; }

.chat-msg {
  padding: 12px 18px;
  border-radius: 20px;
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 85%;
  animation: slideInUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  word-break: break-word;
  position: relative;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.chat-ai {
  background: var(--surface);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 6px;
}

.chat-user {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
}

.chat-system {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  align-self: center;
  font-size: 0.85rem;
  text-align: center;
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.chat-label {
  font-weight: 700;
  font-size: 0.8rem;
  opacity: 0.6;
  margin-right: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Inline translation button and text container */
.chat-actions {
  margin-top: 6px;
  text-align: right;
}

.btn-translate-inline {
  background: transparent;
  border: none;
  font-size: 0.85rem;
  color: #a5b4fc;
  cursor: pointer;
  padding: 0;
  opacity: 0.8;
  transition: opacity 0.2s, color 0.2s;
}

.btn-translate-inline:hover {
  opacity: 1;
  text-decoration: underline;
}

.chat-translation {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.2);
  font-size: 0.95rem;
  color: #e2e8f0;
  font-style: italic;
}

/* Light mode styles for translation */
body.light-theme .btn-translate-inline {
  color: #4f46e5;
  opacity: 0.9;
}

body.light-theme .btn-translate-inline:hover {
  opacity: 1;
}

body.light-theme .chat-translation {
  border-top: 1px dashed rgba(0, 0, 0, 0.1);
  color: #475569;
}

/* ─── Text Input ─────────────────────────── */

.input-row {
  display: flex;
  gap: 12px;
  padding: 10px 24px 16px;
  flex-shrink: 0;
  position: relative;
}

.input-row::before {
  content: '';
  position: absolute;
  top: -20px; left: 0; right: 0; height: 20px;
  background: linear-gradient(to top, var(--bg) 0%, transparent 100%);
  pointer-events: none;
}

.text-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-pill);
  padding: 14px 20px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
}

.text-input:focus {
  border-color: var(--accent);
  background: rgba(30, 30, 35, 0.95);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15), inset 0 2px 5px rgba(0,0,0,0.2);
}

.text-input::placeholder { color: var(--text-dim); }

.btn-send {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #6d28d9);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-send:hover { 
  transform: scale(1.08) rotate(-10deg); 
  box-shadow: 0 6px 20px var(--accent-glow);
}
.btn-send:active { transform: scale(0.95); }

/* ─── Controls ───────────────────────────── */

.controls {
  display: flex;
  gap: 12px;
  padding: 0 24px 24px;
  flex-shrink: 0;
}

.btn {
  flex: 1;
  display: flex;
  flex-direction: row; /* Horizontal flex layout */
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px; /* Greatly reduced vertical height */
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font);
  transition: var(--transition);
  user-select: none;
  -webkit-user-select: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.btn:hover:not(:disabled) { 
  background: rgba(50, 50, 55, 0.8);
  transform: translateY(-2px); 
  border-color: var(--border-highlight);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; filter: grayscale(1); }

.btn-icon { 
  font-size: 1.2rem; /* Reduced from 1.8rem */
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
.btn-label { 
  font-size: 0.85rem; 
  font-weight: 600; 
  color: var(--text);
  letter-spacing: 0.3px;
}

/* Talk Button styling */
.btn-talk {
  background: linear-gradient(145deg, rgba(40,40,45,0.8), rgba(30,30,35,0.8));
  border: 2px solid rgba(255, 255, 255, 0.4) !important;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.btn-talk:hover:not(:disabled) {
  transform: scale(1.03);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}
.btn-talk:active:not(:disabled) {
  background: linear-gradient(135deg, var(--success), #059669);
  border-color: var(--success) !important;
  box-shadow: 0 0 25px var(--success-glow);
}
.btn-talk.recording {
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  border-color: #ef4444 !important;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
  animation: pulse-recording 1.5s ease-in-out infinite;
}
.btn-talk.recording .btn-label {
  color: #fff;
}
.btn-talk.recording .btn-icon {
  animation: mic-bounce 0.6s ease-in-out infinite alternate;
}
@keyframes pulse-recording {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 20px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
@keyframes mic-bounce {
  0% { transform: scale(1); }
  100% { transform: scale(1.15); }
}


/* Stop Button styling */
.btn-stop { 
  background: rgba(239, 68, 68, 0.05);
  border: 2px solid rgba(239, 68, 68, 0.5) !important; 
}
.btn-stop:hover:not(:disabled) { 
  background: rgba(239, 68, 68, 0.15); 
  border-color: var(--danger); 
  box-shadow: 0 8px 20px var(--danger-glow);
}
.btn-stop:active:not(:disabled) {
  background: var(--danger);
}

/* Secondary Button */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover { 
  background: var(--border-highlight); 
  transform: translateY(-2px);
}

/* ─── Debug Panel ────────────────────────── */

.debug-panel {
  margin: 0 24px 20px;
  padding: 0;
  flex-shrink: 0;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.debug-panel summary {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  padding: 12px 16px;
  background: rgba(0,0,0,0.2);
  user-select: none;
}

.debug-panel summary:hover { color: var(--text); background: rgba(0,0,0,0.4); }

.debug-panel-content {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.debug-panel pre {
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: #a0a0ab;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
  margin-bottom: 12px;
}

/* ─── Animations ─────────────────────────── */

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

@keyframes slideInUp {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pulse-border {
  0%, 100% { border-color: var(--border-highlight); box-shadow: inset 0 2px 10px rgba(0,0,0,0.5); }
  50% { border-color: var(--accent); box-shadow: inset 0 2px 10px rgba(0,0,0,0.5), 0 0 20px var(--accent-glow); }
}

@keyframes pulse-status {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.95); }
}

/* ─── Responsive ─────────────────────────── */

.hidden-desktop { display: none !important; }

@media (max-width: 900px) {
  .global-brand-panel {
    top: 18px;
    left: 48px; /* Room for hamburger menu */
  }
  .global-brand-panel h1 {
    font-size: 1.1rem;
  }
  .app-layout {
    display: flex;
    flex-direction: column;
    padding: 0;
    gap: 0;
  }
  
  #app {
    max-width: 100%;
    border-radius: 0;
    border: none;
    box-shadow: none;
    height: 100dvh;
  }

  .sidebar {
    display: none; /* Hide sidebar on mobile by default */
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    border-radius: 0;
    border: none;
  }

  .sidebar.show-mobile {
    display: flex;
    z-index: 10001;
    background: var(--bg);
  }
  
  .hidden-desktop {
    display: flex !important;
  }
  .global-control-panel {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100dvh;
    background: var(--bg);
    border: none;
    border-right: 1px solid var(--border-highlight);
    border-radius: 0;
    padding: 20px 16px;
    box-shadow: none;
    z-index: 10000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 12px;
  }
  .global-control-panel.show-dropdown {
    left: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.8);
  }
  
  .global-btn {
    padding: 12px;
    border-radius: 8px;
    width: 100%;
    justify-content: flex-start;
  }
  
  .global-btn .btn-label {
    display: inline-block; /* Show labels in dropdown */
  }

  .inline-suggestion-container {
    right: 16px;
    left: 16px; /* Let it stretch if text is long, but max-width will constrain it */
    max-width: none;
    margin-bottom: 4px;
    padding: 6px 12px;
  }

  .sidebar.show-mobile {
    display: flex;
  }

  .hidden-desktop { display: inline-flex !important; }
  .header-left h1 { font-size: 0.95rem; } /* Sync brand name on mobile */
}

@media (max-width: 480px) {
  .emotion-img { width: 180px; }
  .controls { padding: 0 16px 20px; }
  .input-row { padding: 10px 16px 16px; }
}

@media (min-width: 901px) {
  .emotion-img { width: 72px; max-height: 72px; }
}

.btn-danger-outline {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-danger-outline:hover {
  background: var(--danger);
  color: white;
}

/* ─── Settings View ─── */


.btn-icon-only {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--text-dim);
  cursor: pointer;
  transition: var(--transition);
  padding: 4px;
}
.btn-icon-only:hover {
  color: var(--text);
  transform: scale(1.1) rotate(15deg);
}

/* Connection button — glowing icon with custom tooltip */
.btn-connection {
  position: relative;
  font-size: 1.35rem !important;
  color: #60a5fa !important;
  filter: drop-shadow(0 0 4px rgba(96, 165, 250, 0.5));
  transition: all 0.3s ease;
}
.btn-connection:hover {
  color: #93c5fd !important;
  filter: drop-shadow(0 0 8px rgba(96, 165, 250, 0.8));
  transform: scale(1.2) rotate(0deg) !important;
}
.btn-connection::after {
  content: 'Cấu hình kết nối cho Chatbot hiện tại';
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  white-space: nowrap;
  background: rgba(15, 23, 42, 0.95);
  color: #e2e8f0;
  font-size: 0.8rem;
  font-weight: 400;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(96, 165, 250, 0.3);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4), 0 0 12px rgba(96, 165, 250, 0.15);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
}

body.light-theme .btn-connection::after {
  background: #ffffff;
  color: #1f2937;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.btn-connection:hover::after {
  opacity: 1;
  transform: translateY(0);
}

/* Connection Overlay — full-screen modal */
.connection-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.connection-overlay.hidden {
  display: flex !important; /* Must be flex to animate */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.connection-modal {
  background: var(--bg-card, #1e1e2e);
  border: 1px solid var(--border, #333);
  border-radius: 16px;
  width: 90vw;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05);
  transform: translateY(0) scale(1);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.connection-overlay.hidden .connection-modal {
  transform: translateY(20px) scale(0.95);
}
.connection-modal > .header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border, #333);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.connection-modal > .header h1 {
  font-size: 1.15rem;
  margin: 0;
}
.connection-modal > .settings-content {
  overflow-y: auto;
  flex: 1;
}

/* Removed old modal animations as we use transitions now */

.settings-content {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.settings-section h2 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--text);
}

.settings-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.emoji-mapping-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mapping-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mapping-row label {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-dim);
}

.emoji-pool {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.emoji-draggable {
  width: 48px;
  height: 48px;
  object-fit: contain;
  cursor: grab;
  transition: transform 0.2s;
  background: var(--surface);
  border-radius: 8px;
  padding: 4px;
}

.emoji-draggable:active {
  cursor: grabbing;
  transform: scale(1.1);
}

.emoji-slot {
  width: 56px;
  height: 56px;
  border: 2px dashed var(--border-highlight);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
}

.emoji-slot.drag-over {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.1);
  transform: scale(1.05);
}

.emoji-slot img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  pointer-events: none; /* Let events pass to the slot */
}

/* ──────────────────────────────────────────────
   Light Theme Override Settings
   ────────────────────────────────────────────── */

body.light-theme {
  background-color: var(--bg);
}

/* Chatbot Cards in Light Mode */
body.light-theme .chatbot-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

body.light-theme .chatbot-card:hover {
  background: rgba(255, 255, 255, 0.98);
  border-color: var(--accent);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

body.light-theme .chatbot-card.active {
  background: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.05), inset 4px 0 0 var(--accent);
}

body.light-theme .chatbot-avatar {
  background: rgba(0, 0, 0, 0.03);
}

body.light-theme .chatbot-name {
  color: #111827;
}

body.light-theme .chatbot-sidebar .sidebar-header .logo {
  background: linear-gradient(135deg, var(--accent), var(--success));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Header in Light Mode */
body.light-theme .header {
  background: linear-gradient(to bottom, rgba(243, 244, 246, 0.95) 0%, transparent 100%);
}

body.light-theme .header h1, 
body.light-theme .header-left h1 {
  color: #111827;
}

body.light-theme .status-idle {
  background: #e5e7eb;
  color: #4b5563;
  border-color: rgba(0, 0, 0, 0.08);
}

body.light-theme .status-text {
  box-shadow: none;
}

/* Chat AI Bubbles in Light Mode */
body.light-theme .chat-ai {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
  color: #1f2937;
}

body.light-theme .chat-system {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.2);
  color: #b45309; /* Darker amber for readability */
}

/* Text Input in Light Mode */
body.light-theme .text-input {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: #111827;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

body.light-theme .text-input:focus {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(var(--accent), 0.1), inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

body.light-theme .text-input::placeholder {
  color: #9ca3af;
}

/* Controls in Light Mode */
body.light-theme .btn {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

body.light-theme .btn:hover:not(:disabled) {
  background: #f9fafb;
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
}

body.light-theme .btn-label {
  color: #374151;
}

body.light-theme .btn-talk {
  background: linear-gradient(145deg, #ffffff, #f3f4f6);
  border: 2px solid rgba(0, 0, 0, 0.15) !important;
}

body.light-theme .btn-talk:active:not(:disabled) {
  background: linear-gradient(135deg, var(--success), #059669);
  border-color: var(--success) !important;
}

body.light-theme .btn-talk:active:not(:disabled) .btn-label {
  color: #ffffff;
}

body.light-theme .btn-stop {
  background: rgba(239, 68, 68, 0.03);
  border: 2px solid rgba(239, 68, 68, 0.3) !important;
}

body.light-theme .btn-stop:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--danger);
}

body.light-theme .btn-secondary {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: #374151;
}

body.light-theme .btn-secondary:hover {
  background: #f9fafb;
  border-color: rgba(0, 0, 0, 0.18);
}

/* Settings View in Light Mode */
body.light-theme .settings-section {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

body.light-theme .settings-section h2 {
  color: #111827;
}

body.light-theme .emoji-pool {
  background: #f3f4f6;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

body.light-theme .emoji-slot {
  background: #f9fafb;
  border: 2px dashed rgba(0, 0, 0, 0.12);
}

body.light-theme .emoji-slot.drag-over {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.05);
}

body.light-theme .debug-panel {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

body.light-theme .debug-panel summary {
  background: #f9fafb;
  color: #374151;
}

body.light-theme .debug-panel summary:hover {
  background: #f3f4f6;
  color: #111827;
}

body.light-theme .debug-panel-content {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

body.light-theme .debug-panel pre {
  color: #4b5563;
}

body.light-theme .btn-danger-outline {
  border-color: var(--danger);
  color: var(--danger);
  background: transparent;
}

body.light-theme .btn-danger-outline:hover {
  background: var(--danger);
  color: #ffffff;
}

/* Glassmorphism sidebar titles in light theme */
body.light-theme .sidebar-header .logo {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Translation Container ─── */
.translation-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 15px;
}

.translation-input-group,
.translation-output-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.translation-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.meta-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.translation-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
}

.translation-select:hover {
  border-color: var(--accent);
}

.translation-textarea {
  width: 100%;
  height: 120px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  line-height: 1.5;
  resize: none;
  outline: none;
  transition: border-color var(--transition), background-color var(--transition);
}

.translation-textarea:focus {
  border-color: var(--accent);
  background: rgba(30, 30, 35, 0.95);
  box-shadow: 0 0 10px var(--accent-glow);
}

body.light-theme .translation-textarea:focus {
  background: #ffffff;
}

.btn-translate {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 15px var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-translate:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-translate:active:not(:disabled) {
  transform: translateY(0);
}

.btn-translate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.translation-output {
  min-height: 100px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  transition: border-color var(--transition);
}

.translation-output.placeholder {
  color: var(--text-dim);
  font-style: italic;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.btn-copy-trans {
  background: transparent;
  border: none;
  color: var(--accent-hover);
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity var(--transition);
}

.btn-copy-trans:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Light theme overrides */
body.light-theme .translation-select {
  background: rgba(0, 0, 0, 0.03);
}

body.light-theme .translation-textarea {
  background: rgba(0, 0, 0, 0.03);
}

body.light-theme .translation-output {
  background: rgba(0, 0, 0, 0.02);
}

/* ─── Horizontal Chatbot Nav ─── */
.chatbot-horizontal-nav {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.2);
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  overflow: visible; /* CRITICAL: Prevent clipping of absolute tooltips */
  flex-shrink: 0;
  width: 100%;
  position: relative;
  z-index: 50;
}

.chatbot-horizontal-nav::-webkit-scrollbar {
  display: none;
}

body.light-theme .chatbot-horizontal-nav {
  background: rgba(0, 0, 0, 0.02);
}

.chatbot-horizontal-nav .chatbot-card {
  flex: 1 1 0%; /* Equal width flex tabs */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill); /* Pill style for horizontal menu */
  cursor: pointer;
  transition: var(--transition);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.8rem;
  overflow: visible;
  min-width: 0; /* Allow equal compression on one line */
}

body.light-theme .chatbot-horizontal-nav .chatbot-card {
  background: rgba(255, 255, 255, 0.85);
}

.chatbot-horizontal-nav .chatbot-card::before {
  display: none; /* Remove vertical-card specific backgrounds */
}

.chatbot-horizontal-nav .chatbot-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.chatbot-horizontal-nav .chatbot-card.active {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.12);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* Color thematic variations for horizontal buttons */
body.theme-teacher .chatbot-horizontal-nav .chatbot-card.active { border-color: #8b5cf6; background: rgba(139, 92, 246, 0.15); box-shadow: 0 0 10px rgba(139, 92, 246, 0.4); }
body.theme-cashier .chatbot-horizontal-nav .chatbot-card.active { border-color: #10b981; background: rgba(16, 185, 129, 0.15); box-shadow: 0 0 10px rgba(16, 185, 129, 0.4); }
body.theme-receptionist .chatbot-horizontal-nav .chatbot-card.active { border-color: #f59e0b; background: rgba(245, 158, 11, 0.15); box-shadow: 0 0 10px rgba(245, 158, 11, 0.4); }
body.theme-airport .chatbot-horizontal-nav .chatbot-card.active { border-color: #06b6d4; background: rgba(6, 182, 212, 0.15); box-shadow: 0 0 10px rgba(6, 182, 212, 0.4); }
body.theme-guide .chatbot-horizontal-nav .chatbot-card.active { border-color: #ef4444; background: rgba(239, 68, 68, 0.15); box-shadow: 0 0 10px rgba(239, 68, 68, 0.4); }
body.theme-shopping .chatbot-horizontal-nav .chatbot-card.active { border-color: #ec4899; background: rgba(236, 72, 153, 0.15); box-shadow: 0 0 10px rgba(236, 72, 153, 0.4); }

.chatbot-horizontal-nav .chatbot-avatar {
  font-size: 1rem;
  background: transparent;
  width: auto;
  height: auto;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chatbot-horizontal-nav .chatbot-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.chatbot-horizontal-nav .chatbot-name {
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.chatbot-horizontal-nav .chatbot-role {
  font-size: 0.6rem;
  color: var(--text-dim);
  margin-top: 0;
  white-space: nowrap;
}

/* Tooltip on hover */
.chatbot-horizontal-nav .chatbot-card[data-tooltip] {
  position: relative;
}

.chatbot-horizontal-nav .chatbot-card[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px); /* Position exactly below the card to avoid vertical margins */
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  background: rgba(15, 15, 20, 0.98);
  border: 1px solid var(--border-highlight);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  width: 240px;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  text-align: center;
  line-height: 1.4;
}

body.light-theme .chatbot-horizontal-nav .chatbot-card[data-tooltip]::after {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  color: #1f2937;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.chatbot-horizontal-nav .chatbot-card:hover[data-tooltip]::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Tooltip alignment for first (leftmost) chatbot to prevent clipping on the left edge */
.chatbot-horizontal-nav .chatbot-card[data-chatbot="teacher"][data-tooltip]::after {
  left: 0;
  transform: translateY(5px);
}
.chatbot-horizontal-nav .chatbot-card[data-chatbot="teacher"]:hover[data-tooltip]::after {
  transform: translateY(0);
}

/* Tooltip alignment for last (rightmost) chatbot to prevent clipping on the right edge */
.chatbot-horizontal-nav .chatbot-card[data-chatbot="shopping"][data-tooltip]::after {
  left: auto;
  right: 0;
  transform: translateY(5px);
}
.chatbot-horizontal-nav .chatbot-card[data-chatbot="shopping"]:hover[data-tooltip]::after {
  transform: translateY(0);
}

/* Elegant custom scrollbar styles for panels */
.chat-log, .suggestion-list, .chatbot-list {
  scrollbar-width: thin !important;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent !important;
}

.chat-log::-webkit-scrollbar, 
.suggestion-list::-webkit-scrollbar, 
.chatbot-list::-webkit-scrollbar {
  display: block !important;
  width: 5px !important;
  height: 5px !important;
}

.chat-log::-webkit-scrollbar-track, 
.suggestion-list::-webkit-scrollbar-track, 
.chatbot-list::-webkit-scrollbar-track {
  background: transparent !important;
}

.chat-log::-webkit-scrollbar-thumb, 
.suggestion-list::-webkit-scrollbar-thumb, 
.chatbot-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2) !important;
  border-radius: var(--radius-pill) !important;
  transition: var(--transition);
}

.chat-log::-webkit-scrollbar-thumb:hover, 
.suggestion-list::-webkit-scrollbar-thumb:hover, 
.chatbot-list::-webkit-scrollbar-thumb:hover {
  background: var(--accent) !important;
}

/* Gentle popup toast notification in the center of the screen */
.toast-notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: rgba(15, 15, 20, 0.96);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 16px 28px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.65), 0 0 25px var(--accent-glow);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.toast-notification.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.toast-icon {
  font-size: 1.2rem;
  color: var(--warning);
}

body.light-theme .toast-notification {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--accent);
  color: #111827;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), 0 0 15px var(--accent-glow);
}

/* ──────────────────────────────────────────────
   Hệ thống Đăng nhập (Login System)
   ────────────────────────────────────────────── */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, rgba(15, 15, 20, 0.95) 0%, rgba(5, 5, 8, 0.98) 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 20000;
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

body.light-theme .login-overlay {
  background: radial-gradient(circle at center, rgba(243, 244, 246, 0.98) 0%, rgba(229, 231, 235, 0.99) 100%);
}

.login-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.login-card {
  width: 90%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 40px rgba(139, 92, 246, 0.15);
  text-align: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: loginCardFadeIn 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

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

.login-logo {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text) 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 15px rgba(139, 92, 246, 0.2);
}

.login-subtitle {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-bottom: 35px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-align: left;
}

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

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

.form-group input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  outline: none;
  transition: all var(--transition);
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.btn-login-submit {
  width: 100%;
  padding: 14px;
  margin-top: 10px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px var(--accent-glow);
  transition: all var(--transition);
}

.btn-login-submit:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-login-submit:active {
  transform: translateY(0);
}

.login-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--danger);
  color: #fca5a5;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  text-align: center;
  margin-top: 5px;
  animation: shake 0.4s ease;
}

body.light-theme .login-error {
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ──────────────────────────────────────────────
   Admin Dashboard & Modals
   ────────────────────────────────────────────── */
.admin-modal {
  max-width: 900px !important;
  width: 95% !important;
}

.admin-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.admin-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.admin-tab-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.admin-tab-btn.active {
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 4px 10px var(--accent-glow);
}

body.light-theme .admin-tab-btn.active {
  color: #ffffff;
}

.admin-tab-content {
  overflow-y: auto;
  max-height: 60vh;
}

.admin-tab-content.hidden {
  display: none !important;
}

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

.admin-form-row input {
  flex: 1;
  min-width: 0;
}

.admin-table-container {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-top: 10px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.admin-table th, .admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

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

body.light-theme .admin-table th {
  background: rgba(0, 0, 0, 0.05);
}

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

body.light-theme .admin-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

.btn-action-delete {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--danger);
  padding: 4px 8px;
  font-size: 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-action-delete:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.btn-action-reset {
  background: transparent;
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--warning);
  padding: 4px 8px;
  font-size: 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
  margin-right: 4px;
}
.btn-action-reset:hover {
  background: var(--warning);
  color: white;
  border-color: var(--warning);
}

.admin-stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
  margin-top: 10px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.stat-num {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 5px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-creation-container {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.admin-creation-col {
  flex: 1;
  min-width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 15px;
}
.admin-creation-col h3 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 0.95rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.admin-form-grid-single {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.form-group-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}
.form-group-item label {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 500;
  margin-left: 2px;
}
.form-group-item input {
  width: 100% !important;
}

.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 25px;
  margin-bottom: 12px;
  gap: 15px;
  flex-wrap: wrap;
}
.admin-search-input {
  min-width: 250px;
}

.admin-table td input[type="checkbox"], .admin-table th input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.admin-bulk-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--accent);
  border-radius: 50px;
  padding: 10px 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 10000;
  min-width: 320px;
  animation: slideUp 0.3s ease-out;
}
.admin-bulk-bar.hidden {
  display: none !important;
}
.bulk-bar-content {
  display: flex;
  align-items: center;
  gap: 20px;
  justify-content: space-between;
}
.bulk-bar-content span {
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
}
.bulk-actions-group {
  display: flex;
  gap: 8px;
}
.btn-flat {
  background: transparent !important;
  border: 1px solid transparent !important;
  color: var(--text-dim) !important;
}
.btn-flat:hover {
  color: var(--text) !important;
}

.pool-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.pool-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.pool-stat-num {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}
.pool-stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
}
.pool-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.pool-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.admin-stats-container {
  display: flex;
  gap: 20px;
  margin-top: 25px;
  flex-wrap: wrap;
}
.stats-left, .stats-right {
  flex: 1;
  min-width: 300px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 15px;
}
.stats-left h3, .stats-right h3 {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.rank-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rank-name {
  width: 100px;
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: right;
  white-space: nowrap;
}
.rank-bar-wrapper {
  flex: 1;
  height: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.rank-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #818cf8);
  border-radius: 6px;
  transition: width 0.5s ease;
}
.rank-count {
  width: 30px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}
.top-users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.top-user-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}
.top-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.top-user-name {
  font-weight: 600;
  font-size: 0.9rem;
}
.top-user-rank-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}
.top-user-stats {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.rank-newbie { background: rgba(148, 163, 184, 0.2); color: #94a3b8; }
.rank-bronze { background: rgba(180, 83, 9, 0.2); color: #f59e0b; }
.rank-silver { background: rgba(100, 116, 139, 0.2); color: #cbd5e1; }
.rank-gold { background: rgba(234, 179, 8, 0.2); color: #facc15; }
.rank-platinum { background: rgba(45, 212, 191, 0.2); color: #2dd4bf; }
.rank-diamond { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.rank-master { background: rgba(168, 85, 247, 0.2); color: #a855f7; }
.rank-grandmaster { background: rgba(239, 68, 68, 0.2); color: #ef4444; }

@keyframes slideUp {
  from {
    transform: translate(-50%, 100px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

/* ──────────────────────────────────────────────
   User Profile Badge UI in Header
   ────────────────────────────────────────────── */
.user-profile-badge {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  margin-right: 12px;
  font-size: 0.85rem;
  line-height: 1.25;
}

.user-profile-badge .user-name {
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
}

.user-profile-badge .user-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  padding: 1px 6px;
  border-radius: 4px;
  margin-top: 2px;
  display: inline-block;
}

.user-profile-badge .user-points {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 1px;
}

.user-progress-bar-container {
  width: 90px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}

.user-progress-bar {
  height: 100%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
  width: 0%;
  transition: width 0.5s ease-out;
}

/* ──────────────────────────────────────────────
   Bảng xếp hạng (Leaderboard) & Tabbed Aside
   ────────────────────────────────────────────── */
.sidebar-tabs {
  display: flex;
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border);
  padding: 4px;
  border-radius: var(--radius) var(--radius) 0 0;
}

body.light-theme .sidebar-tabs {
  background: rgba(0, 0, 0, 0.03);
}

.sidebar-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 12px 6px;
  cursor: pointer;
  border-radius: calc(var(--radius) - 6px);
  transition: all var(--transition);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.sidebar-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-tab.active {
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 4px 12px var(--accent-glow);
}

body.light-theme .sidebar-tab.active {
  color: #ffffff;
}

.sidebar-tab-content-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  height: calc(100% - 50px);
}

.sidebar-tab-content-panel.hidden {
  display: none !important;
}

.leaderboard-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.leaderboard-header-row {
  display: grid;
  grid-template-columns: 45px 1fr 70px 70px;
  padding: 8px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 62vh;
  overflow-y: auto;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 45px 1fr 70px 70px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  align-items: center;
  transition: all var(--transition);
}

body.light-theme .leaderboard-row {
  background: rgba(0, 0, 0, 0.01);
}

.leaderboard-row:hover {
  border-color: var(--border-highlight);
  background: rgba(255, 255, 255, 0.04);
  transform: translateX(2px);
}

.leaderboard-row.my-row {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.08);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.1);
}

.leaderboard-row .rank-cell {
  font-weight: 700;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.leaderboard-row.rank-1 .rank-cell { color: #f59e0b; font-size: 1.1rem; }
.leaderboard-row.rank-2 .rank-cell { color: #94a3b8; font-size: 1.1rem; }
.leaderboard-row.rank-3 .rank-cell { color: #b45309; font-size: 1.1rem; }

.leaderboard-row .name-cell {
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-row .score-cell {
  font-weight: 700;
  color: var(--accent);
}

.leaderboard-row .chat-cell {
  color: var(--text-dim);
}

/* ──────────────────────────────────────────────
   Hoạt ảnh Chúc mừng Mốc (Achievement Celebration)
   ────────────────────────────────────────────── */
.achievement-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 30000;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.achievement-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.achievement-card {
  width: 90%;
  max-width: 400px;
  background: var(--bg-card);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 50px var(--accent-glow);
  transform: scale(0.7);
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.achievement-overlay:not(.hidden) .achievement-card {
  transform: scale(1);
}

.achievement-icon {
  font-size: 4rem;
  margin-bottom: 15px;
  animation: bouncePulse 2s infinite ease-in-out;
}

@keyframes bouncePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15) rotate(5deg); }
}

.achievement-card h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
}

.achievement-card p {
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.4;
  margin-bottom: 15px;
}

.achievement-points-bonus {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--success);
  text-shadow: 0 0 10px var(--success-glow);
  margin-bottom: 10px;
}

/* 🔧 Global Brand Panel (Top-Left Floating) 🔧 */
.global-brand-panel {
  position: fixed;
  top: 14px;
  left: 24px;
  z-index: 9999;
}

.global-brand-panel h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 🔧 Global Control Panel (Top-Right Floating) 🔧 */
.global-control-panel {
  position: fixed;
  top: 8px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 9999;
}

.global-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: rgba(20, 20, 24, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  user-select: none;
}

.global-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 18px var(--accent-glow);
}

.global-btn:active {
  transform: translateY(0) scale(0.97);
}

.global-btn .btn-icon {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
}

.global-btn .btn-label {
  letter-spacing: 0.2px;
}

/* Connection button custom glow for global panel */
.global-btn.btn-connection {
  border-color: rgba(96, 165, 250, 0.2);
  color: #60a5fa;
}

.global-btn.btn-connection:hover {
  border-color: #60a5fa;
  color: #93c5fd;
  box-shadow: 0 6px 25px rgba(96, 165, 250, 0.35);
}

/* Light Theme overrides for global panel */
body.light-theme .global-btn {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #111827;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

body.light-theme .global-btn:hover {
  background: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 6px 20px var(--accent-glow);
}

body.light-theme .global-btn.btn-connection {
  border-color: rgba(37, 99, 235, 0.2);
  color: #2563eb;
}

body.light-theme .global-btn.btn-connection:hover {
  border-color: #2563eb;
  color: #1d4ed8;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.2);
}
