/* Stylesheet for Song Request & Danmaku Inspection Tool - Mobile & Desktop Harmonized */

.song-glow {
  background-color: var(--secondary) !important;
  box-shadow: 0 0 10px var(--secondary) !important;
}

.song-badge {
  background: rgba(0, 242, 254, 0.15) !important;
  border-color: rgba(0, 242, 254, 0.3) !important;
  color: var(--secondary) !important;
}

.song-accent {
  color: var(--secondary) !important;
}

.panel-subtitle {
  display: block;
  font-size: 11px;
  font-weight: normal;
  color: var(--text-muted);
  margin-top: 2px;
}

.song-dashboard-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

/* Control Header layout */
.song-app-container .control-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 20px;
}

.header-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.controls-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

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

.primary-controls {
  flex-shrink: 0;
}

.secondary-controls {
  flex: 1;
  min-width: 0;
}

.secondary-controls .search-wrapper {
  width: 100%;
}

.secondary-controls .search-wrapper input {
  width: 100%;
}

/* Mobile Tabs Bar (Hidden on Desktop) */
.mobile-tabs-nav {
  display: none;
  background: rgba(14, 22, 38, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 4px;
  gap: 6px;
  margin-bottom: 4px;
  backdrop-filter: blur(12px);
  position: relative;
  z-index: 10;
}

.m-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}

.m-tab-btn.active {
  background: linear-gradient(135deg, rgba(255, 127, 0, 0.25), rgba(0, 242, 254, 0.2));
  color: #fff;
  border: 1px solid rgba(0, 242, 254, 0.4);
  box-shadow: 0 2px 10px rgba(0, 242, 254, 0.15);
}

.tab-count-badge {
  background: rgba(255, 127, 0, 0.25);
  color: #ffaa00;
  border: 1px solid rgba(255, 127, 0, 0.4);
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 11px;
}

.tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--secondary);
  display: none;
  box-shadow: 0 0 6px var(--secondary);
}
.tab-dot.active {
  display: inline-block;
}

/* Collapsible Simulator Bar */
.simulate-bar {
  background: rgba(13, 23, 42, 0.85);
  border: 1px dashed rgba(0, 242, 254, 0.3);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  animation: fadeIn 0.2s ease-out;
  margin-bottom: 2px;
}

.sim-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--secondary);
  white-space: nowrap;
}

.sim-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.sim-inputs input {
  background: rgba(8, 12, 20, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #fff;
  padding: 6px 10px;
  font-size: 12px;
  outline: none;
}
.sim-inputs input:focus {
  border-color: var(--secondary);
}

#testNickname { width: 90px; }
#testUserId { width: 75px; }
#testGiftName { width: 85px; }
#testDanmakuTxt { flex: 1; min-width: 150px; }

/* Danmaku Keyword Filter Box */
.danmaku-filter-box {
  display: flex;
  align-items: center;
}

.danmaku-keyword-input {
  background: rgba(8, 12, 20, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #fff;
  padding: 5px 10px;
  font-size: 12px;
  width: 150px;
  outline: none;
  transition: all 0.25s ease;
}

.danmaku-keyword-input:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 8px rgba(0, 242, 254, 0.3);
  width: 180px;
}

@media (max-width: 768px) {
  .danmaku-keyword-input {
    width: 100% !important;
  }
  .danmaku-filter-box {
    width: 100%;
  }
}

/* Custom Form elements */
.custom-select {
  background: rgba(8, 12, 20, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #fff;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  outline: none;
}
.custom-select:focus {
  border-color: var(--secondary);
}

.btn-clear {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.btn-clear:hover {
  background: rgba(255, 51, 102, 0.15);
  color: var(--error);
  border-color: rgba(255, 51, 102, 0.3);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-outline:hover, .btn-outline.active {
  background: rgba(0, 242, 254, 0.15);
  color: #fff;
  border-color: var(--secondary);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
}

/* Gift Cards in Song Request tool */
.song-gift-card {
  display: flex;
  flex-direction: column;
  background: rgba(13, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.song-gift-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 242, 254, 0.4);
  background: rgba(18, 32, 60, 0.7);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.song-gift-card:active {
  transform: scale(0.985);
}

.song-gift-card.active-selected {
  border-left-color: var(--secondary) !important;
  border-color: var(--secondary) !important;
  background: linear-gradient(90deg, rgba(0, 242, 254, 0.14), rgba(13, 23, 42, 0.8)) !important;
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.25) !important;
}

.song-gift-card.has-song-hint {
  border-left-color: #00ff87;
}

.song-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.song-user-col {
  display: flex;
  align-items: center;
  gap: 12px;
}

.song-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  object-fit: cover;
  background: #080c14;
  flex-shrink: 0;
}

.song-user-text {
  display: flex;
  flex-direction: column;
}

.song-username {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.song-tag {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0, 255, 135, 0.15);
  color: #00ff87;
  border: 1px solid rgba(0, 255, 135, 0.3);
  font-weight: 600;
  white-space: nowrap;
}

.song-meta-info {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: 'JetBrains Mono', monospace;
}

.song-action-hint {
  display: flex;
  align-items: center;
  gap: 8px;
}

.click-hint-badge {
  font-size: 12px;
  color: var(--secondary);
  background: rgba(0, 242, 254, 0.1);
  border: 1px solid rgba(0, 242, 254, 0.25);
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 600;
  white-space: nowrap;
}

.song-gift-summary {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
}

.song-gift-item {
  color: #ffaa00;
  font-weight: 600;
}

.song-last-danmaku {
  margin-top: 8px;
  font-size: 13px;
  color: #d1e0f0;
  background: rgba(0, 0, 0, 0.35);
  padding: 8px 12px;
  border-radius: 6px;
  border-left: 3px solid var(--secondary);
  word-break: break-all;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.song-last-danmaku .icon {
  font-size: 14px;
}

/* Selected User Header Bar in Danmaku Panel */
.selected-user-bar {
  background: rgba(8, 14, 26, 0.9);
  border-bottom: 1px solid rgba(0, 242, 254, 0.25);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: fadeIn 0.25s ease-out;
  gap: 10px;
}

.selected-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.selected-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.selected-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--secondary);
  object-fit: cover;
  background: #000;
}

.selected-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.selected-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.selected-nickname {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selected-uid {
  font-size: 12px;
  color: var(--secondary);
  font-family: 'JetBrains Mono', monospace;
  background: rgba(0, 242, 254, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.selected-gift-summary {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selected-user-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-refresh {
  background: rgba(0, 242, 254, 0.1);
  color: var(--secondary);
  border: 1px solid rgba(0, 242, 254, 0.3);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-refresh:hover {
  background: var(--secondary);
  color: #000;
}

.btn-close {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-close:hover {
  background: rgba(255, 51, 102, 0.2);
  color: var(--error);
  border-color: rgba(255, 51, 102, 0.4);
}

/* Danmaku Items */
.danmaku-item {
  background: rgba(13, 23, 42, 0.45);
  border-left: 3px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 8px;
  transition: all 0.2s ease;
  position: relative;
}

.danmaku-item:hover {
  background: rgba(18, 32, 60, 0.65);
  border-left-color: var(--secondary);
}

.danmaku-item.is-song-request {
  background: linear-gradient(90deg, rgba(0, 255, 135, 0.12), rgba(13, 23, 42, 0.65));
  border-left-color: #00ff87;
  border: 1px solid rgba(0, 255, 135, 0.25);
  border-left-width: 4px;
}

.danmaku-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.danmaku-user-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.danmaku-username {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.danmaku-uid {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.danmaku-time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.danmaku-content {
  font-size: 14px;
  color: #e2e8f0;
  line-height: 1.45;
  word-break: break-all;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.danmaku-item.is-song-request .danmaku-content {
  color: #00ff87;
  font-weight: 600;
  font-size: 15px;
}

.song-copy-btn {
  background: rgba(0, 242, 254, 0.15);
  color: var(--secondary);
  border: 1px solid rgba(0, 242, 254, 0.35);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.song-copy-btn:hover, .song-copy-btn:active {
  background: var(--secondary);
  color: #000;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: rgba(14, 22, 38, 0.95);
  border: 1px solid var(--secondary);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideInRight 0.25s ease-out;
  pointer-events: auto;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Floating Switcher for Mobile */
.mobile-float-switch {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
}

.float-btn {
  background: linear-gradient(135deg, var(--primary), #ff4500);
  color: #fff;
  border: none;
  border-radius: 30px;
  padding: 12px 20px;
  box-shadow: 0 8px 25px rgba(255, 127, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  animation: bounceIn 0.3s ease-out;
}

@keyframes bounceIn {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}

/* ==========================================================================
   📱 Mobile Responsive Media Queries (Phones & Small Tablets <= 768px)
   ========================================================================== */
@media (max-width: 768px) {
  body.mobile-optimized {
    height: 100%;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .song-app-container {
    padding: 8px;
    gap: 10px;
    height: 100vh;
    display: flex;
    flex-direction: column;
  }

  /* Compact Header for mobile */
  .song-app-container .control-header {
    padding: 10px 12px;
    border-radius: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .control-header .brand h1 {
    font-size: 15px;
    letter-spacing: 0.5px;
  }

  .controls-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
  }

  .control-row {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
  }

  .primary-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
  }

  .room-input-wrap {
    flex: 1;
    min-width: 0;
  }

  .room-input-wrap input {
    width: 100% !important;
    padding: 7px 10px;
    font-size: 13px;
  }

  .secondary-controls {
    width: 100%;
  }

  .search-wrapper {
    width: 100% !important;
    margin-left: 0 !important;
  }

  .search-wrapper input {
    width: 100% !important;
    padding: 7px 12px !important;
    font-size: 13px;
  }

  .control-header .btn {
    padding: 7px 12px;
    font-size: 13px;
    white-space: nowrap;
  }

  .status-indicator {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
  }

  /* Reveal Mobile Nav Tabs */
  .mobile-tabs-nav {
    display: flex;
    padding: 3px;
    gap: 4px;
    border-radius: 10px;
  }

  .m-tab-btn {
    padding: 7px 10px;
    font-size: 13px;
  }

  /* Dashboard Grid switches to single view controlled by active tab */
  .song-dashboard-grid {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 0;
  }

  .m-panel-view {
    display: none !important;
    flex: 1;
    min-height: 0;
  }

  .m-panel-view.active {
    display: flex !important;
  }

  .panel-header {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .panel-header .panel-title {
    width: 100%;
  }

  .panel-header .panel-stats {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }

  .panel-header .panel-stats .filter-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
  }

  .panel-header .panel-stats .custom-select {
    flex: 1;
    max-width: 160px;
  }

  .panel-header .panel-actions {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
  }

  .panel-header .panel-actions .danmaku-filter-box {
    flex: 1;
    min-width: 0;
  }

  .panel-header .panel-actions .danmaku-keyword-input {
    width: 100% !important;
    padding: 5px 8px;
    font-size: 12px;
  }

  .panel-header .panel-actions .btn {
    padding: 5px 8px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .hide-on-tiny {
    display: none !important;
  }

  .song-gift-card {
    padding: 10px 12px;
  }

  .click-hint-badge {
    font-size: 11px;
    padding: 3px 6px;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .mobile-float-switch {
    display: block;
  }
}
