/* Custom Premium CSS design system for Douyu Monitor */
:root {
  --bg-darker: #080c14;
  --bg-dark: #0e1626;
  --bg-panel: rgba(18, 28, 48, 0.7);
  --border-color: rgba(255, 127, 0, 0.15);
  --border-hover: rgba(255, 127, 0, 0.4);
  
  --primary: #ff7f00; /* Douyu Orange */
  --primary-glow: rgba(255, 127, 0, 0.3);
  --secondary: #00f2fe; /* Cyber Cyan */
  --secondary-glow: rgba(0, 242, 254, 0.3);
  
  --text-main: #f0f4f8;
  --text-muted: #8fa0ba;
  
  --success: #00ff87;
  --error: #ff3366;
  --warning: #ffb800;
  
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  --backdrop-blur: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-darker);
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Ambient breathing lights on both sides of the screen */
body::before, body::after {
  content: "";
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(140px);
  z-index: 0;
  opacity: 0.15;
  pointer-events: none;
  animation: ambientBreathe 10s infinite alternate ease-in-out;
}

body::before {
  top: 10%;
  left: -250px;
  background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
}

body::after {
  bottom: 10%;
  right: -250px;
  background: radial-gradient(circle, var(--secondary) 0%, transparent 70%);
  animation-delay: -5s;
}

@keyframes ambientBreathe {
  0% { transform: scale(0.9); opacity: 0.1; }
  100% { transform: scale(1.2); opacity: 0.22; }
}

/* Highly diffused vertical breathing neon glow on both edges of the screen */
.side-neon-bar {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 0px; /* Zero width to completely hide hard border lines */
  z-index: 0; /* Changed from -1 to 0 to keep it visible in front of body background */
  pointer-events: none;
}

.side-neon-bar.left-bar {
  left: 0;
  animation: neonBarPulseLeft 6s infinite alternate ease-in-out;
}

.side-neon-bar.right-bar {
  right: 0;
  animation: neonBarPulseRight 6s infinite alternate ease-in-out;
}

@keyframes neonBarPulseLeft {
  0% {
    box-shadow: 0 0 30px 10px rgba(255, 127, 0, 0.15);
  }
  100% {
    box-shadow: 0 0 60px 18px rgba(255, 127, 0, 0.38);
  }
}

@keyframes neonBarPulseRight {
  0% {
    box-shadow: 0 0 30px 10px rgba(0, 242, 254, 0.15);
  }
  100% {
    box-shadow: 0 0 60px 18px rgba(0, 242, 254, 0.38);
  }
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(8, 12, 20, 0.5);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 127, 0, 0.25);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 16px;
  gap: 16px;
  position: relative; /* Keep container context above ambient background glow */
  z-index: 1;         /* Render dashboard content in front of background glow layers */
}

/* Header styling */
.control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(var(--backdrop-blur));
  padding: 16px 24px;
  border-radius: 16px;
  box-shadow: var(--glass-shadow);
}

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

.logo-dot {
  width: 12px;
  height: 12px;
  background-color: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--primary);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 15px var(--primary); }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.brand h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1.5px;
  background: linear-gradient(45deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 127, 0, 0.15);
  border: 1px solid rgba(255, 127, 0, 0.3);
  color: var(--primary);
  font-weight: bold;
}

/* Controls */
.controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.input-wrapper {
  position: relative;
}

.input-wrapper input {
  background: rgba(8, 12, 20, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: 8px;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  width: 260px;
  transition: all 0.3s ease;
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  font-family: 'Outfit', sans-serif;
  transition: all 0.3s ease;
}

.btn-connect {
  background: linear-gradient(135deg, #ff7f00, #ff4500);
  color: #fff;
  box-shadow: 0 4px 15px rgba(255, 127, 0, 0.3);
}

.btn-connect:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 127, 0, 0.5);
}

.btn-disconnect {
  background: rgba(255, 51, 102, 0.1);
  color: var(--error);
  border: 1px solid rgba(255, 51, 102, 0.3);
}

.btn-disconnect:hover:not(:disabled) {
  background: var(--error);
  color: #fff;
  box-shadow: 0 4px 15px rgba(255, 51, 102, 0.4);
}

.btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Status Indicator */
.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(8, 12, 20, 0.4);
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.disconnected {
  background-color: var(--error);
  box-shadow: 0 0 8px var(--error);
}

.status-dot.connecting {
  background-color: var(--warning);
  box-shadow: 0 0 8px var(--warning);
  animation: flash 1s infinite alternate;
}

.status-dot.connected {
  background-color: var(--success);
  box-shadow: 0 0 10px var(--success);
}

@keyframes flash {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}

.status-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Dashboard Grid Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  flex: 1;
  min-height: 0; /* Important for inner scrolls to work */
}

.dashboard-grid.three-columns {
  grid-template-columns: 1fr 1fr 1fr;
}

/* Panel Card */
.panel-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(var(--backdrop-blur));
  border-radius: 16px;
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(8, 12, 20, 0.3);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-title .icon {
  font-size: 20px;
}

.panel-title h2 {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.5px;
}

.panel-stats {
  display: flex;
  gap: 16px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-value {
  font-size: 18px;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
}

.stat-value.accent {
  color: var(--primary);
  text-shadow: 0 0 10px rgba(255, 127, 0, 0.2);
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-sm:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Toggles */
.toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
}

.toggle-wrapper input {
  cursor: pointer;
}

/* Feed Container */
.feed-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  color: var(--text-muted);
  gap: 12px;
}

.empty-icon {
  font-size: 48px;
  opacity: 0.5;
}

/* Gift Cards style */
.gift-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(13, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-left: 4px solid var(--primary);
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: border-color 0.2s ease, border-left-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.new-card-slide {
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.gift-card:hover {
  border-color: rgba(255, 127, 0, 0.3);
  border-left-color: var(--secondary);
  background: rgba(13, 23, 42, 0.8);
  transform: translateX(4px);
}

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

.gift-user-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gift-username {
  font-weight: 600;
  color: #fff;
  font-size: 14px;
}

.gift-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.gift-meta-id {
  font-family: 'JetBrains Mono', monospace;
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 6px;
}

.gift-details {
  display: flex;
  align-items: center;
  gap: 16px;
}

.gift-name-tag {
  background: rgba(255, 127, 0, 0.1);
  color: var(--primary);
  border: 1px solid rgba(255, 127, 0, 0.2);
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
}

/* High value gift highlight */
.gift-card.high-value {
  border-left-color: var(--secondary);
  background: linear-gradient(90deg, rgba(0, 242, 254, 0.08), rgba(13, 23, 42, 0.6));
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.15);
}

.gift-card.high-value .gift-name-tag {
  background: rgba(0, 242, 254, 0.1);
  color: var(--secondary);
  border-color: rgba(0, 242, 254, 0.2);
}

.gift-count {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
}

.gift-count span {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-right: 2px;
}

.gift-price {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--secondary);
  width: 90px;
  text-align: right;
}

/* Raw Feed Inspector code layout */
.raw-feed {
  background: #04060a;
}

.raw-item {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  padding: 10px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

.raw-item-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  color: var(--text-muted);
}

.raw-type-badge {
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: bold;
}

.raw-type-badge.type-dgb {
  background: rgba(255, 127, 0, 0.15);
  color: var(--primary);
}

.raw-time {
  opacity: 0.6;
}

.raw-body {
  color: #c4d3e6;
  white-space: pre-wrap;
  word-break: break-all;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
  margin-top: 4px;
}

/* Pulse animation for combo updates */
.pulse-animation {
  animation: cardPulse 0.3s ease-out;
  transition: none !important;
}

@keyframes cardPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); box-shadow: 0 0 15px var(--primary-glow); }
  100% { transform: scale(1); }
}

.free-gift-card {
  border-left-color: var(--text-muted) !important;
}

.free-badge {
  color: var(--text-muted) !important;
  font-size: 12px;
  font-style: italic;
}

.raw-fold-badge {
  background: rgba(0, 242, 254, 0.15);
  color: var(--secondary);
  border: 1px solid rgba(0, 242, 254, 0.3);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  margin-left: 8px;
  font-weight: bold;
}

/* Linkage interactivity style */
.gift-card {
  cursor: pointer;
}

.raw-item.highlighted-raw {
  background: rgba(0, 242, 254, 0.12) !important;
  border: 1px solid var(--secondary) !important;
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.3);
  transition: all 0.3s ease;
}

/* Settings button styling */
.btn-settings {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-settings:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-secondary-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

/* Unknown price red dot indicator */
.unknown-price-dot {
  width: 8px;
  height: 8px;
  background-color: var(--error);
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  box-shadow: 0 0 8px var(--error);
  animation: unknownPulse 1.5s infinite alternate;
}

@keyframes unknownPulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  100% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 12px var(--error); }
}

/* Settings Modal Dialog styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 6, 10, 0.8);
  backdrop-filter: blur(12px);
  z-index: 1000;
  display: none; /* Controlled by JS */
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: var(--bg-dark);
  border: 1px solid var(--border-hover);
  border-radius: 16px;
  width: 500px;
  max-width: 90%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleUp {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(8, 12, 20, 0.4);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.close-modal-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.close-modal-btn:hover {
  color: var(--error);
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.setting-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
  color: #fff;
  font-size: 14px;
}

.setting-checkbox-label input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.setting-input-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: -2px;
}

.setting-group input[type="text"],
.setting-group textarea {
  background: rgba(8, 12, 20, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-main);
  padding: 10px 14px;
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  transition: all 0.3s ease;
  resize: vertical;
}

.setting-group input[type="text"]:focus,
.setting-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(8, 12, 20, 0.4);
}/* deserve-gift-card and superchat-gift-card styling */
.gift-card.deserve-gift-card {
  border-left-color: #e040fb !important;
  background: linear-gradient(90deg, rgba(224, 64, 251, 0.08), rgba(13, 23, 42, 0.6));
  box-shadow: 0 0 15px rgba(224, 64, 251, 0.15);
}
.gift-card.deserve-gift-card .gift-name-tag {
  background: rgba(224, 64, 251, 0.1);
  color: #e040fb;
  border-color: rgba(224, 64, 251, 0.2);
}
.gift-card.superchat-gift-card {
  border-left-color: #ffeb3b !important;
  background: linear-gradient(90deg, rgba(255, 235, 59, 0.08), rgba(13, 23, 42, 0.6));
  box-shadow: 0 0 15px rgba(255, 235, 59, 0.15);
  flex-direction: column;
  align-items: flex-start;
}
.gift-card.superchat-gift-card .gift-name-tag {
  background: rgba(255, 235, 59, 0.1);
  color: #ffeb3b;
  border-color: rgba(255, 235, 59, 0.2);
}
.gift-card.noble-gift-card {
  border-left-color: #ffb800 !important;
  background: linear-gradient(90deg, rgba(255, 184, 0, 0.08), rgba(13, 23, 42, 0.6));
  box-shadow: 0 0 15px rgba(255, 184, 0, 0.15);
}
.gift-card.noble-gift-card .gift-name-tag {
  background: rgba(255, 184, 0, 0.1);
  color: #ffb800;
  border-color: rgba(255, 184, 0, 0.2);
}
.gift-card.noble-gift-card .gift-price,
.gift-card.noble-gift-card .gift-count {
  color: #ffb800 !important;
}
.raw-type-badge.type-deserve {
  background: rgba(224, 64, 251, 0.15);
  color: #e040fb;
}
.raw-type-badge.type-superchat {
  background: rgba(255, 235, 59, 0.15);
  color: #ffeb3b;
}
.raw-type-badge.type-noble {
  background: rgba(255, 184, 0, 0.15);
  color: #ffb800;
}

/* Aligned and Expandable Raw Card Styles */
.raw-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: rgba(13, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-left: 4px solid var(--secondary);
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin-bottom: 8px;
  transition: all 0.2s ease;
  font-family: inherit;
  font-size: inherit;
}
.raw-item:hover {
  border-color: rgba(0, 242, 254, 0.3);
  background: rgba(13, 23, 42, 0.8);
}
.raw-item-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  cursor: pointer;
  user-select: none;
}
.raw-item-user {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.raw-item-username {
  font-weight: 600;
  color: #fff;
  font-size: 14px;
}
.raw-item-meta {
  font-size: 12px;
  color: var(--text-muted);
}
.raw-item-details {
  display: flex;
  align-items: center;
  gap: 16px;
}
.raw-item-name-tag {
  background: rgba(0, 242, 254, 0.1);
  color: var(--secondary);
  border: 1px solid rgba(0, 242, 254, 0.2);
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
}
.raw-item-toggle-btn {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.raw-item-toggle-btn:hover {
  background: rgba(0, 242, 254, 0.2);
  color: #fff;
}
.raw-body {
  display: none;
  margin-top: 12px;
  padding: 12px;
  background: #04060a;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #a3be8c;
  overflow-x: auto;
  max-height: 400px;
  white-space: pre-wrap;
  word-break: break-all;
}
.raw-item.expanded .raw-body {
  display: block;
}

#editorSearchInput {
  transition: all 0.25s ease;
}
#editorSearchInput:focus {
  outline: none !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 8px var(--primary-glow) !important;
}
