/* Modern Dark Theme with Subtle Colors */
:root {
  --primary-bg: #18181b;
  --secondary-bg: #27272a;
  --accent: #6b7280; /* Màu xám xanh nhẹ, hiện đại */
  --accent-hover: #9ca3af; /* Xám xanh sáng hơn */
  --text: #e4e4e7;
  --text-light: #a1a1aa;
  --success: #22c55e;
  --error: #ef4444;
  --glow: rgba(107, 114, 128, 0.2);
  --shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
  --glass-bg: rgba(39, 39, 42, 0.85);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--primary-bg);
  color: var(--text);
  font-family: 'Poppins', 'Roboto', sans-serif;
  min-height: 100vh;
  padding: 16px;
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.5;
}

.bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--secondary-bg) 0%, var(--primary-bg) 50%, var(--secondary-bg) 100%);
  z-index: -1;
  animation: gradientShift 20s ease infinite;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.container {
  max-width: 1000px;
  margin: 24px auto;
  background: var(--glass-bg);
  border-radius: 10px;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.container::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, var(--glow) 0%, transparent 70%);
  opacity: 0.1;
  pointer-events: none;
  animation: pulseGlow 15s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.1; }
  50% { opacity: 0.25; }
}

h1 {
  text-align: center;
  font-size: 1.6rem; /* Tiêu đề nhỏ hơn */
  font-weight: 600;
  margin-bottom: 24px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

h1::after {
  content: '';
  display: block;
  width: 80px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  margin: 10px auto 0;
  border-radius: 2px;
}

/* Category Sections */
.category-section {
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.category-section.visible {
  opacity: 1;
  transform: translateY(0);
}

.category-header {
  position: relative;
  cursor: pointer;
  user-select: none;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.category-header:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.header-content {
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 2;
}

.glow-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 3px;
  background: linear-gradient(to bottom, var(--accent), var(--accent-hover));
  transition: width 0.3s ease;
}

.category-header:hover .glow-bar {
  width: 6px;
}

.toggle-icon {
  font-size: 0.8rem;
  color: var(--accent);
  transition: transform 0.3s ease;
}

.category-section.collapsed .toggle-icon {
  transform: rotate(-180deg);
}

.category-title {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--text);
  flex-grow: 1;
  margin: 0;
}

.count-badge {
  background: rgba(107, 114, 128, 0.15);
  color: var(--accent);
  padding: 5px 10px;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid rgba(107, 114, 128, 0.25);
  transition: transform 0.2s ease;
}

.count-badge:hover {
  transform: scale(1.05);
}

/* Buttons Grid */
.buttons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); /* Nút nhỏ hơn */
  gap: 8px;
  padding: 8px;
  transition: max-height 0.4s ease, opacity 0.4s ease;
}

.category-section.collapsed .buttons-grid {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
}

/* Button Styles */
.button {
  position: relative;
  padding: 9px 5px; /* Nút nhỏ hơn */
  font-size: 0.8rem; /* Font nhỏ hơn */
  font-weight: 500;
  background: var(--secondary-bg);
  color: var(--text);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--accent) 0%, transparent 70%);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  color: var(--text);
}

.button:hover::before {
  opacity: 0.25;
}

.button.active {
  background: var(--accent);
  color: white;
}

.btn-hover-effect {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
  transform: translateY(100%);
  transition: transform 0.4s ease;
  z-index: -1;
}

.button:hover .btn-hover-effect {
  transform: translateY(0);
}

.button.clicked {
  animation: buttonClick 0.3s ease;
}

@keyframes buttonClick {
  0% { transform: scale(1); }
  50% { transform: scale(0.92); }
  100% { transform: scale(1); }
}

/* Skeleton Loading */
.skeleton-loading {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.skeleton-section {
  opacity: 0;
  animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

.skeleton-header {
  height: 28px;
  width: 180px;
  background: var(--secondary-bg);
  border-radius: 6px;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
}

.skeleton-button {
  height: 36px; /* Skeleton nút nhỏ hơn */
  background: var(--secondary-bg);
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}

.skeleton-header::after,
.skeleton-button::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Error & Empty States */
.error-state, .no-data {
  text-align: center;
  padding: 32px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  box-shadow: var(--shadow);
}

.no-data {
  background: rgba(161, 161, 170, 0.1);
  border-color: rgba(161, 161, 170, 0.2);
}

.error-icon, .no-data-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  color: var(--error);
}

.no-data-icon {
  color: var(--text-light);
}

.retry-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  margin-top: 12px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.retry-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Particle Animation */
.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}

.particle {
  position: absolute;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.15;
  animation: float 25s infinite;
}

@keyframes float {
  0% { transform: translateY(0); opacity: 0.15; }
  50% { opacity: 0.3; }
  100% { transform: translateY(-100vh); opacity: 0; }
}