/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0a0a0e;
  --bg-secondary: #0f0f14;
  --bg-card: #111116;
  --bg-input: #16161c;
  --bg-elevated: #1a1a22;

  --accent-green: #22c55e;
  --accent-green-hover: #16a34a;
  --accent-green-glow: rgba(34, 197, 94, 0.15);
  --accent-green-border: rgba(34, 197, 94, 0.3);
  --accent-pink: #f43f5e;
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;

  --glow-color: rgba(34, 197, 94, 0.08);
  --glow-border: rgba(34, 197, 94, 0.12);
  --glow-outer: rgba(56, 189, 248, 0.06);

  --text-primary: rgba(255, 255, 255, 0.92);
  --text-secondary: rgba(255, 255, 255, 0.55);
  --text-muted: rgba(255, 255, 255, 0.3);

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 100px;

  --transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-fast: all 0.15s ease;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  min-height: 100vh;
  color: var(--text-primary);
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Custom scrollbar cho body */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: rgba(34, 197, 94, 0.5);
  border-radius: 5px;
  border: 2px solid var(--bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-green);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(34, 197, 94, 0.5) var(--bg-secondary);
}

/* ===== HEADER ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 14, 0.85);
  backdrop-filter: blur(30px) saturate(130%);
  -webkit-backdrop-filter: blur(30px) saturate(130%);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.logo-icon {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 24px;
}

.logo-bar {
  width: 4px;
  border-radius: 2px;
  background: var(--accent-green);
  animation: equalizerBounce 1.2s ease-in-out infinite;
}

.logo-bar:nth-child(1) { height: 60%; animation-delay: 0s; }
.logo-bar:nth-child(2) { height: 100%; animation-delay: 0.15s; }
.logo-bar:nth-child(3) { height: 40%; animation-delay: 0.3s; }
.logo-bar:nth-child(4) { height: 80%; animation-delay: 0.45s; }

@keyframes equalizerBounce {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.4); }
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.logo-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.premium-badge {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #ff0000, #cc0000);
  color: white;
  padding: 2px 5px;
  border-radius: 3px;
  box-shadow: 0 2px 4px rgba(255, 0, 0, 0.2);
}

.logo-tagline {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin-top: 2px;
}

/* Search Bar */
.header-center {
  flex: 1;
  max-width: 700px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-bar {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-bar input {
  width: 100%;
  padding: 9px 16px 9px 38px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  outline: none;
  transition: var(--transition);
}

.search-bar input::placeholder {
  color: var(--text-muted);
}

.search-bar input:focus {
  border-color: var(--accent-green-border);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.08);
  background: var(--bg-elevated);
}

.search-bar .search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: var(--text-muted);
  pointer-events: none;
}

.btn-search {
  padding: 9px 18px;
  background: var(--accent-green);
  border: none;
  border-radius: var(--radius-pill);
  color: #000;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.btn-search:hover {
  background: var(--accent-green-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
}

.btn-search:active {
  transform: scale(0.96);
}

.btn-favorites {
  padding: 9px 16px;
  background: transparent;
  border: 1px solid rgba(244, 63, 94, 0.3);
  border-radius: var(--radius-pill);
  color: var(--accent-pink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn-favorites::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(244, 63, 94, 0.4) 0%, transparent 70%);
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.4s ease;
  pointer-events: none;
}

.btn-favorites:hover {
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.5);
  box-shadow: 0 0 20px rgba(244, 63, 94, 0.2);
}

.btn-favorites.active {
  animation: heartbeat 0.8s ease-in-out;
}

.btn-favorites.active::before {
  opacity: 1;
  transform: scale(1.5);
  animation: glowPulse 1s ease-out;
}

/* Explore Button */
.btn-explore {
  padding: 9px 16px;
  background: transparent;
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-pill);
  color: var(--accent-cyan);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn-explore::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(6, 182, 212, 0.4) 0%, transparent 70%);
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.4s ease;
  pointer-events: none;
}

.btn-explore:hover {
  background: rgba(6, 182, 212, 0.08);
  border-color: rgba(6, 182, 212, 0.5);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.2);
}

.btn-explore.active {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-cyan);
}

.btn-explore.active::before {
  opacity: 1;
  transform: scale(1);
}

.btn-explore .explore-icon {
  width: 14px;
  height: 14px;
}

@keyframes heartbeat {
  0% { transform: scale(1); }
  15% { transform: scale(1.15); }
  30% { transform: scale(1); }
  45% { transform: scale(1.08); }
  60% { transform: scale(1); }
  100% { transform: scale(1); }
}

@keyframes glowPulse {
  0% { opacity: 0.6; transform: scale(0.8); }
  50% { opacity: 0.3; transform: scale(1.2); }
  100% { opacity: 0; transform: scale(1.8); }
}

.btn-favorites .heart-icon {
  display: inline-block;
  transition: transform 0.2s ease;
}

.btn-favorites.active .heart-icon {
  animation: heartBounce 0.6s ease;
}

@keyframes heartBounce {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.3) rotate(-10deg); }
  50% { transform: scale(1.1) rotate(5deg); }
  75% { transform: scale(1.2) rotate(-5deg); }
}

/* Confetti Effect */
.confetti-container {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
}

.confetti {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: confetti-fall 1s ease-out forwards;
}

@keyframes confetti-fall {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) rotate(720deg) scale(0.5);
  }
}

/* Thank You Toast */
.thank-you-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.95), rgba(225, 29, 72, 0.95));
  color: white;
  padding: 12px 24px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(244, 63, 94, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
  opacity: 0;
  pointer-events: none;
  z-index: 10000;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.thank-you-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.thank-you-toast::before {
  content: '✨';
  font-size: 16px;
  animation: sparkle 1s ease-in-out infinite;
}

@keyframes sparkle {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.2) rotate(10deg); }
}

/* Error Toast */
.error-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(220, 38, 38, 0.95));
  color: white;
  padding: 12px 24px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(239, 68, 68, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
  opacity: 0;
  pointer-events: none;
  z-index: 10000;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.error-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Floating Hearts Effect */
.floating-heart {
  position: fixed;
  font-size: 20px;
  pointer-events: none;
  z-index: 9999;
  animation: float-up 2s ease-out forwards;
  filter: drop-shadow(0 2px 4px rgba(244, 63, 94, 0.3));
}

@keyframes float-up {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.3) rotate(0deg);
  }
  10% {
    opacity: 1;
    transform: translate(var(--sway1), -60px) scale(1.2) rotate(-8deg);
  }
  100% {
    opacity: 0;
    transform: translate(var(--sway2), -450px) scale(0.4) rotate(8deg);
  }
}

/* Navigation Tabs */
.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.nav-tab {
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.nav-tab:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-light);
  color: var(--text-primary);
}

.nav-tab.active {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: #000;
  font-weight: 600;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  height: calc(100vh - 60px - 40px);
  display: none; /* Ẩn mặc định, sẽ hiển thị khi có video hoặc playlist */
  flex-direction: column;
  position: relative;
}

.main-content.visible {
  display: flex;
}

/* Glow wrapper */
.content-glow {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin: 16px;
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
  background: var(--bg-secondary);
  border: 1px solid var(--glow-border);
  box-shadow:
    0 0 60px var(--glow-outer),
    0 0 120px rgba(34, 197, 94, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.content-glow::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(34, 197, 94, 0.25),
    rgba(56, 189, 248, 0.2),
    transparent
  );
  z-index: 2;
}

.content-glow::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(34, 197, 94, 0.15),
    transparent
  );
  z-index: 2;
}

/* ===== 2-COLUMN LAYOUT ===== */
.content-body {
  flex: 1;
  display: flex;
  flex-direction: row;
  min-height: 0;
  position: relative;
}

/* Resizer Handle */
.resizer {
  width: 8px;
  margin-left: -4px;
  margin-right: -4px;
  background: transparent;
  cursor: col-resize;
  transition: background 0.15s ease;
  position: relative;
  z-index: 100;
  flex-shrink: 0;
}

.resizer:hover,
.resizer.dragging {
  background: var(--accent-green);
}

.resizer::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 40px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.resizer:hover::after,
.resizer.dragging::after {
  opacity: 1;
  background: rgba(34, 197, 94, 0.5);
}

/* Player Area */
.player-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  border-right: 1px solid var(--border-subtle);
  position: relative;
  min-height: 420px;
  transition: flex 0.2s ease;
}

.player-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-muted);
  animation: fadeInUp 0.6s ease forwards;
}

.player-placeholder-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  opacity: 0.3;
}

.player-placeholder-text {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
}

/* Video playing state */
.player-area.playing {
  padding: 0;
}

.player-area.playing .video-frame {
  width: 100%;
  height: 100%;
  display: flex;
}

.player-area.playing .video-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Playlist Sidebar */
.playlist-area {
  width: 340px;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  transition: width 0.2s ease, min-width 0.2s ease;
}

.playlist-area.hidden {
  width: 0 !important;
  min-width: 0 !important;
  border: none;
}

.playlist-area.hidden .playlist-header,
.playlist-area.hidden .playlist-search,
.playlist-area.hidden .playlist-items {
  display: none;
}

/* Toggle Playlist Button */
.toggle-playlist-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 60px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: var(--transition-fast);
}

.toggle-playlist-btn:hover {
  background: rgba(34, 197, 94, 0.1);
  border-color: var(--accent-green-border);
  color: var(--accent-green);
}

.playlist-area.hidden ~ .toggle-playlist-btn {
  right: 8px;
  background: var(--bg-card);
}

/* Hide resizer when playlist is hidden */
.resizer.hidden {
  display: none;
}

.playlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.playlist-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.playlist-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.playlist-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.playlist-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-light);
  color: var(--text-secondary);
}

.playlist-btn.active {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: #000;
}

.btn-clear-text {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-clear-text:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.playlist-search {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.playlist-search input {
  width: 100%;
  max-width: 100%;
  padding: 8px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  outline: none;
  transition: var(--transition);
  box-sizing: border-box;
}

.playlist-search input::placeholder {
  color: var(--text-muted);
}

.playlist-search input:focus {
  border-color: var(--accent-green-border);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.06);
}

.playlist-items {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  max-height: 70vh;
}

.playlist-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 400;
  padding: 40px 20px;
  text-align: center;
}

.playlist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  cursor: pointer;
  transition: var(--transition-fast);
  border-left: 3px solid transparent;
}

.playlist-item:hover {
  background: rgba(255, 255, 255, 0.03);
  border-left-color: var(--accent-green);
}

.playlist-item.active {
  background: rgba(34, 197, 94, 0.06);
  border-left-color: var(--accent-green);
}

.playlist-item-thumb {
  width: 48px;
  height: 36px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-elevated);
}

.playlist-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.playlist-item-info {
  flex: 1;
  min-width: 0;
}

.playlist-item-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-item-duration {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.playlist-item-remove {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: var(--transition-fast);
  opacity: 0;
  flex-shrink: 0;
}

.playlist-item:hover .playlist-item-remove {
  opacity: 1;
}

.playlist-item-remove:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* ===== FOOTER ===== */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: auto;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 4px;
}

.footer-links a:hover {
  color: var(--text-secondary);
}

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

.footer-eq {
  display: flex;
  align-items: flex-end;
  gap: 1.5px;
  height: 14px;
}

.footer-eq-bar {
  width: 2.5px;
  border-radius: 1px;
  background: var(--accent-green);
  animation: eqSmall 0.8s ease-in-out infinite;
}

.footer-eq-bar:nth-child(1) { height: 40%; animation-delay: 0s; }
.footer-eq-bar:nth-child(2) { height: 70%; animation-delay: 0.1s; }
.footer-eq-bar:nth-child(3) { height: 30%; animation-delay: 0.2s; }
.footer-eq-bar:nth-child(4) { height: 55%; animation-delay: 0.3s; }

@keyframes eqSmall {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.3); }
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-version {
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}

.footer-volume {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 11px;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.shake { animation: shake 0.4s ease; }

/* Custom scrollbar */
.playlist-items::-webkit-scrollbar {
  width: 4px;
}

.playlist-items::-webkit-scrollbar-track {
  background: transparent;
}

.playlist-items::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

.playlist-items::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ===== SEARCH RESULTS ===== */
.search-results-section {
  margin: 20px;
  border-radius: var(--radius-xl);
  background: var(--bg-secondary);
  border: 1px solid var(--glow-border);
  overflow: hidden;
  display: none;
  animation: fadeInUp 0.4s ease forwards;
}

.search-results-section.visible {
  display: block;
}

.search-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px 12px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  cursor: pointer;
}

.search-results-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

#searchResultsContent {
  overflow: visible;
}

.search-results-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-results-count {
  padding: 2px 8px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-green);
}

.btn-clear-search {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-clear-search:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.search-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 16px 24px 20px;
}

.search-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.search-card:hover {
  border-color: var(--accent-green-border);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 20px var(--accent-green-glow);
}

.search-card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--bg-elevated);
}

.search-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.search-card:hover .search-card-thumb img {
  transform: scale(1.05);
}

.search-card-duration {
  position: absolute;
  bottom: 6px;
  right: 6px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
}

.search-card-add {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(34, 197, 94, 0.9);
  color: #000;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  transition: var(--transition);
  z-index: 2;
}

.search-card:hover .search-card-add {
  opacity: 1;
  transform: scale(1);
}

.search-card-add:hover {
  background: var(--accent-green);
  box-shadow: 0 2px 12px rgba(34, 197, 94, 0.4);
  transform: scale(1.1) !important;
}

.search-card-info {
  padding: 10px 12px 12px;
}

.search-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.search-card-channel {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Search Loading */
.search-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 12px;
  color: var(--text-muted);
}

.search-loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.search-loading-text {
  font-size: 13px;
  font-weight: 400;
}

.search-error {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  color: #ef4444;
  font-size: 13px;
  gap: 8px;
}

.search-results-grid::-webkit-scrollbar {
  display: none;
}

/* ===== EXPLORE SECTION ===== */
.explore-section {
  margin: 20px;
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  max-height: 2000px;
  display: flex;
  flex-direction: column;
}

/* Khi main-content hiển thị, explore thu nhỏ */
.main-content.visible ~ .explore-section {
  max-height: none;
}

.explore-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-secondary) 100%);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: var(--transition-fast);
}

.explore-header:hover {
  background: var(--bg-elevated);
}

.explore-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.explore-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.explore-title-icon {
  width: 22px;
  height: 22px;
  color: var(--accent-green);
}

.explore-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

.explore-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
}

.explore-category {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.explore-category-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.explore-category-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.explore-icon-svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
}

.explore-category-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.explore-category-videos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.explore-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border-subtle);
  position: relative;
}

.explore-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-light);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.explore-card-thumb {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--bg-elevated);
}

.explore-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.explore-card:hover .explore-card-thumb img {
  transform: scale(1.05);
}

.explore-card-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.explore-card-add {
  position: absolute;
  bottom: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  background: rgba(0, 0, 0, 0.8);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  font-weight: 500;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.explore-card:hover .explore-card-add {
  opacity: 1;
  transform: translateY(0);
}

.explore-card-add:hover {
  background: var(--accent-green);
  color: #000;
}

.explore-card-info {
  padding: 12px;
}

.explore-card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.explore-card-channel {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.explore-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  gap: 16px;
  color: var(--text-muted);
}

.explore-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.explore-loading-text {
  font-size: 14px;
  font-weight: 500;
}

.explore-error {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: #ef4444;
  font-size: 14px;
  gap: 8px;
}

.explore-load-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 24px;
  margin-top: 8px;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.explore-load-more:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-green-border);
  color: var(--text-primary);
}

.explore-load-more:active {
  transform: scale(0.98);
}

.explore-load-more svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.explore-load-more:hover svg {
  transform: translateY(2px);
}

/* Hide explore when search results are visible */
.search-results-section.visible ~ .explore-section {
  display: none;
}

.explore-section.collapsed .explore-content {
  display: none;
}

.btn-toggle-explore {
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-toggle-explore:hover {
  background: var(--bg-input);
  border-color: var(--border-light);
  color: var(--text-primary);
}

.btn-toggle-explore svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.explore-section.collapsed .btn-toggle-explore svg {
  transform: rotate(180deg);
}

.explore-section.hidden {
  display: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .main-content {
    height: auto;
    min-height: auto;
  }

  .content-glow {
    flex: none;
  }

  .content-body {
    flex-direction: column;
  }

  .resizer {
    display: none;
  }

  /* Hide default toggle button on mobile */
  .toggle-playlist-btn {
    display: none !important;
  }

  .player-area {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    min-height: auto;
    flex: none;
  }

  .player-area.playing {
    min-height: auto;
    width: 100%;
    aspect-ratio: 16 / 9;
  }

  .player-area.playing .video-frame {
    width: 100%;
    aspect-ratio: 16 / 9;
  }

  .playlist-area {
    min-height: auto;
    width: 100% !important;
    max-width: none;
    max-height: 500px;
    transition: max-height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }

  .playlist-area.collapsed {
    max-height: 60px;
    overflow: hidden;
  }

  .playlist-area.collapsed .playlist-search,
  .playlist-area.collapsed .playlist-items {
    display: none;
  }

  .main-content:not(.visible) .playlist-area {
    display: none;
  }

  /* Mobile toggle button in header */
  .playlist-controls {
    position: relative;
  }

  .btn-toggle-playlist-mobile {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
  }

  .btn-toggle-playlist-mobile:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-light);
    color: var(--text-secondary);
  }

  .playlist-area.collapsed .btn-toggle-playlist-mobile {
    transform: rotate(180deg);
  }

  .header {
    padding: 0 12px;
    gap: 10px;
  }

  .header-center {
    max-width: none;
  }

  .btn-explore {
    display: none;
  }

  .content-glow {
    margin: 10px;
  }

  .search-results-section {
    margin: 10px;
  }

  .search-results-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    padding: 12px 16px 16px;
  }

  .explore-section {
    margin: 10px;
  }

  .explore-content {
    padding: 16px;
    gap: 20px;
  }

  .explore-category-videos {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
}

@media (max-width: 640px) {
  .header {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 12px;
    gap: 8px;
  }

  .header-left { order: 1; }
  .header-right { order: 2; margin-left: auto; }
  .header-center { order: 3; width: 100%; max-width: 100%; }

  .logo-tagline { display: none; }

  /* Hide text in Search and Favorites buttons, show only icons */
  .btn-search {
    padding: 9px;
    width: 38px;
    height: 38px;
    font-size: 0;
    position: relative;
  }

  .btn-search::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
  }

  .btn-favorites {
    padding: 0;
    width: 38px;
    height: 38px;
    justify-content: center;
  }

  .btn-favorites .favorites-text {
    display: none;
  }

  .btn-favorites .heart-icon {
    font-size: 16px;
  }

  .nav-tab {
    padding: 5px 12px;
    font-size: 12px;
  }

  .player-area {
    min-height: 240px;
    padding: 24px;
  }

  .content-glow {
    margin: 8px;
    border-radius: var(--radius-lg);
  }

  .search-results-section {
    margin: 8px;
    border-radius: var(--radius-lg);
  }

  .search-results-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    padding: 10px 12px 14px;
  }

  .explore-section {
    margin: 8px;
    border-radius: var(--radius-lg);
  }

  .explore-header {
    padding: 16px;
  }

  .explore-title {
    font-size: 16px;
    gap: 8px;
  }

  .explore-title-icon {
    width: 20px;
    height: 20px;
  }

  .explore-content {
    padding: 12px;
    gap: 16px;
  }

  .explore-category-videos {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .explore-card-title {
    font-size: 12px;
  }
}

/* ===== ONLINE USERS ===== */
.online-users {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-input);
  border-radius: var(--radius-pill);
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  border: 1px solid var(--border-subtle);
}

.online-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.1); }
}

.online-count {
  color: var(--accent-green);
  font-weight: 600;
}

/* ===== SERVER SELECTOR ===== */
.server-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-input);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
}

.server-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.server-selector select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  padding-right: 4px;
}

.server-selector select option {
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 8px;
}

.server-selector:hover {
  border-color: var(--border-light);
}

@media (max-width: 768px) {
  .server-selector {
    padding: 4px 8px;
  }
  
  .server-label {
    display: none;
  }
}
