/* Modern Dark Live Audio Streaming Design System */
:root {
  --bg-color: #0a0c10;
  --bg-card: rgba(18, 22, 30, 0.85);
  --bg-card-hover: rgba(26, 32, 44, 0.9);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: rgba(255, 255, 255, 0.18);
  
  --text-main: #f0f6fc;
  --text-muted: #8b949e;
  --text-dim: #6e7681;

  --accent-red: #ff3355;
  --accent-red-glow: rgba(255, 51, 85, 0.35);
  --accent-blue: #38bdf8;
  --accent-blue-glow: rgba(56, 189, 248, 0.3);
  --accent-purple: #a855f7;
  --accent-green: #10b981;
  --accent-yellow: #f59e0b;

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-full: 9999px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

*::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255, 51, 85, 0.04) 0%, transparent 40%);
  color: var(--text-main);
  font-family: var(--font-family);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Glass Card */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
}

/* Live Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: var(--transition);
}

.status-badge.live {
  background: rgba(255, 51, 85, 0.12);
  color: #ff4d6d;
  border: 1px solid rgba(255, 51, 85, 0.3);
  box-shadow: 0 0 15px var(--accent-red-glow);
}

.status-badge.offline {
  background: rgba(110, 118, 129, 0.15);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.status-badge.live .status-dot {
  background-color: var(--accent-red);
  box-shadow: 0 0 10px var(--accent-red);
  animation: pulse-dot 1.8s infinite;
}

.status-badge.offline .status-dot {
  background-color: var(--text-dim);
}

@keyframes pulse-dot {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

/* Base Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  user-select: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, #ff3366, #ff1744);
  color: #fff;
  box-shadow: 0 6px 20px rgba(255, 23, 68, 0.4);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(255, 23, 68, 0.6);
}

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

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--border-active);
}

/* Form Controls */
.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control, .form-select {
  background: rgba(10, 12, 16, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
  width: 100%;
}

.form-control:focus, .form-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.3s ease;
  padding: 20px;
}

.modal-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.modal-content {
  width: 100%;
  max-width: 440px;
  background: #131720;
  border: 1px solid var(--border-active);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

/* Footer note */
.app-footer {
  margin-top: 24px;
  font-size: 0.8rem;
  color: var(--text-dim);
  text-align: center;
}
.app-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}
.app-footer a:hover {
  color: var(--text-main);
}

/* =========================================================
   Live Chat System Styling
   ========================================================= */
.chat-panel {
  display: flex;
  flex-direction: column;
  background: rgba(14, 18, 26, 0.9);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 520px;
}

.chat-header {
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-title {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.04);
  position: relative;
  word-break: break-word;
}

.chat-msg.is-host {
  background: rgba(255, 51, 85, 0.08);
  border-color: rgba(255, 51, 85, 0.25);
}

.chat-msg-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
}

.chat-user {
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: color 0.15s ease, text-decoration 0.15s ease;
  user-select: none;
}
.chat-user:hover {
  color: var(--accent-blue);
  text-decoration: underline;
}

.host-badge {
  background: linear-gradient(135deg, #ff3366, #ff1744);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chat-time {
  color: var(--text-dim);
  font-size: 0.7rem;
  margin-left: auto;
}

.chat-delete-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0 4px;
  font-size: 0.9rem;
  line-height: 1;
  opacity: 0.5;
  transition: opacity 0.2s;
}
.chat-delete-btn:hover {
  opacity: 1;
  color: var(--accent-red);
}

.chat-text {
  font-size: 0.88rem;
  color: #e6edf3;
  line-height: 1.4;
}

.chat-gif-img {
  max-width: 140px;
  max-height: 105px;
  width: auto;
  height: auto;
  border-radius: 8px;
  margin-top: 4px;
  object-fit: contain; /* Giữ nguyên tỉ lệ ảnh, không bị cắt */
  display: block;
}

@media (max-width: 768px) {
  .chat-gif-img {
    max-width: 120px;
    max-height: 90px;
  }
}

/* Quick Emoji bar */
.quick-emoji-bar {
  display: flex;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  overflow-x: auto;
}

.quick-emoji-btn {
  background: none;
  border: none;
  font-size: 1.15rem;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 6px;
  transition: transform 0.15s;
}
.quick-emoji-btn:hover {
  transform: scale(1.3);
}

/* Chat Input Bar */
.chat-input-bar {
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
}
.chat-input:focus {
  border-color: var(--accent-blue);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-icon:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* GIF Picker Modal */
.gif-tags-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0 8px 0;
  scrollbar-width: none;
}
.gif-tags-row::-webkit-scrollbar {
  display: none;
}

.gif-tag-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}
.gif-tag-btn:hover, .gif-tag-btn.active {
  background: var(--accent-blue);
  color: #000;
  border-color: var(--accent-blue);
}

.gif-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  margin-top: 8px;
  scrollbar-width: none;
}
.gif-grid::-webkit-scrollbar {
  display: none;
}

.gif-item {
  width: 100%;
  height: 85px;
  border-radius: 8px;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
  background: #111;
}
.gif-item:hover {
  transform: scale(1.05);
  border-color: var(--accent-blue);
}

/* Thumbnail Center Player Button */
.thumb-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.9);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  z-index: 5;
  transition: opacity 0.25s ease, transform 0.2s ease, background 0.2s ease;
  outline: none;
}

.thumb-play-btn:hover {
  transform: translate(-50%, -50%) scale(1.1);
  background: rgba(0, 0, 0, 0.85);
  border-color: var(--accent-blue);
  box-shadow: 0 0 20px var(--accent-blue-glow);
}

.thumb-play-btn:active {
  transform: translate(-50%, -50%) scale(0.95);
}

.thumb-icon {
  display: block;
  pointer-events: none;
}

.hidden {
  display: none !important;
}

/* Wake Lock Screen Indicator / Toggle Button */
.wakelock-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  transition: var(--transition);
  user-select: none;
}
.wakelock-pill.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

