/*
 * X1 Radio — Player Styles
 * Top panels, channel selector, controls panel, play button, track info,
 * wallet connect, bottom bar, mobile responsive
 */

/* ===== TOP LEFT — BRANDING & TRACK INFO ===== */
.top-left {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 100;
}

.top-left .logo {
  height: 48px;
  width: auto;
  margin-bottom: 8px;
}

.track-name {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--neon-green);
  opacity: 0.8;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.track-name:hover {
  color: var(--color-gold);
  text-shadow: 0 0 10px rgba(218, 165, 32, 0.5);
}

/* ===== TOP RIGHT — DOS RADIO PANEL ===== */
.top-right {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  background: rgba(0, 0, 128, 0.5);
  backdrop-filter: blur(10px);
  border: 3px double var(--dos-border);
  font-family: var(--font-dos);
}

.top-right .dos-titlebar {
  padding: 2px 8px;
  font-size: 11px;
}

.top-right .dos-content {
  padding: 8px 10px;
}

.top-right-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-right .track-name {
  max-width: 280px;
  font-size: 11px;
  color: var(--neon-green);
  text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

/* ===== CONTROLS DROPDOWN TOGGLE ===== */
.controls-dropdown {
  position: relative;
  display: inline-block;
}

.controls-toggle {
  font-family: var(--font-dos);
  font-size: 10px;
  color: var(--dos-border);
  background: var(--bg-button);
  border: 2px outset var(--text-muted);
  padding: 3px 8px;
  cursor: pointer;
}

.controls-toggle:hover {
  background: var(--bg-button-hover);
  color: var(--text-primary);
}

.controls-toggle:active {
  border: 2px inset var(--text-muted);
}

/* ===== CHANNEL SELECTOR ===== */
.channel-selector {
  display: flex;
  border: 2px outset var(--text-muted);
  background: var(--bg-button);
  overflow: hidden;
}

.channel-selector button {
  font-family: var(--font-dos);
  font-size: 10px;
  color: var(--dos-border);
  background: var(--bg-button);
  border: none;
  padding: 3px 8px;
  cursor: pointer;
  border-right: 1px solid var(--border-panel);
}

.channel-selector button:last-child {
  border-right: none;
}

.channel-selector button:hover {
  background: var(--bg-button-hover);
  color: var(--text-primary);
}

.channel-selector button.active {
  background: var(--dos-border);
  color: var(--dos-navy);
  font-weight: bold;
}

/* ===== CHAIN STATS PANEL (CH2) ===== */
.chain-dropdown {
  position: relative;
  display: inline-block;
}

.chain-stats-panel {
  display: none;
  position: fixed;
  top: 87px;
  right: 20px;
  background: rgba(0, 0, 128, 0.5);
  backdrop-filter: blur(10px);
  border: 3px double var(--dos-border);
  font-family: var(--font-dos);
  z-index: 99;
  isolation: isolate;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  width: 300px;
}

.chain-stats-panel.visible {
  display: block;
}

.chain-stats-panel .dos-titlebar {
  padding: 2px 8px;
  font-size: 10px;
}

.chain-stats-panel .dos-content {
  padding: 8px 10px;
}

.chain-stats-panel .chain-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 10px;
  color: var(--dos-border);
}

.chain-stats-panel .chain-stat-row span:first-child {
  flex: 1;
  text-align: left;
}

.chain-stats-panel .chain-stat-row .value {
  flex: 0 0 85px;
  text-align: right;
  color: var(--neon-green);
  font-weight: bold;
  white-space: nowrap;
}

.chain-stats-panel .chain-stat-row .mapped {
  flex: 0 0 85px;
  text-align: right;
  color: var(--text-dim);
  font-size: 9px;
}

.chain-stats-panel .chain-stat-row.primary-metric {
  cursor: pointer;
  color: var(--neon-cyan);
  border-bottom: 1px solid var(--border-muted);
  margin-bottom: 4px;
  padding-bottom: 6px;
}

.chain-stats-panel .chain-stat-row.primary-metric:hover {
  color: var(--neon-green);
}

.chain-stats-panel .dps-control,
.chain-stats-panel .noise-control {
  border-top: 1px solid var(--border-muted);
  margin-top: 6px;
  padding-top: 6px;
  align-items: center;
}

.chain-stats-panel .mode-info {
  border-top: 1px solid var(--border-muted);
  margin-top: 8px;
  padding-top: 8px;
}

.chain-stats-panel .mode-info-text {
  font-size: 9px;
  color: var(--text-dim);
  line-height: 1.5;
  white-space: pre-line;
}

/* ===== MESH CONTROLS PANEL ===== */
.controls-panel {
  display: none;
  position: fixed;
  top: 87px;
  right: 20px;
  background: rgba(0, 0, 128, 0.5);
  backdrop-filter: blur(10px);
  padding: 0;
  border-radius: 0;
  border: 3px double var(--dos-border);
  width: 280px !important;
  min-width: 280px !important;
  max-width: 280px !important;
  box-sizing: border-box;
  max-height: 80vh;
  font-family: var(--font-dos);
  flex-direction: column;
  z-index: 100;
  isolation: isolate;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: transform;
}

.controls-panel .dos-titlebar {
  padding: 3px 10px;
  font-size: 12px;
  flex-shrink: 0;
}

.controls-panel .dos-titlebar span {
  color: var(--dos-titlebar-fg);
  min-width: auto;
  text-align: left;
}

.controls-panel .dos-content {
  padding: 12px 16px;
  overflow-y: auto;
  flex: 1;
}

.controls-panel.open {
  display: flex;
}

.controls-section {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-muted);
}

.controls-section:last-of-type {
  border-bottom: none;
  margin-bottom: 10px;
}

.section-title {
  font-family: var(--font-dos);
  font-size: 12px;
  color: var(--neon-yellow);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.controls-panel label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 5px 0;
  font-family: var(--font-dos);
  font-size: 12px;
  color: var(--text-primary);
  position: relative;
}

.control-name {
  min-width: 70px;
  color: var(--neon-cyan);
}

.controls-panel input[type="range"] {
  -webkit-appearance: none;
  width: 120px;
  height: 8px;
  margin: 0 8px;
  background: var(--bg-black);
  border-radius: 0;
  border: 1px solid var(--dos-border);
}

.controls-panel input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 8px;
  height: 18px;
  background: var(--dos-border);
  border-radius: 0;
  cursor: pointer;
}

.controls-panel input[type="range"]::-webkit-slider-thumb:hover {
  background: var(--text-primary);
}

.controls-panel span {
  color: var(--neon-green);
  font-size: 12px;
  min-width: 40px;
  text-align: right;
  font-family: var(--font-dos);
}

.controls-panel button {
  padding: 6px 12px;
  background: var(--dos-border);
  color: var(--dos-navy);
  border: 2px outset var(--dos-border-light);
  cursor: pointer;
  font-family: var(--font-dos);
  font-size: 12px;
  margin-right: 8px;
  border-radius: 0;
  font-weight: bold;
}

.controls-panel button:hover {
  background: var(--dos-border-light);
}

.controls-panel button:active {
  border-style: inset;
}

.controls-panel button.secondary {
  background: var(--text-muted);
  color: var(--text-primary);
  border-color: var(--text-dim);
}

.controls-panel button.secondary:hover {
  background: var(--text-dim);
}

/* Wallet-locked controls */
.controls-panel.locked .controls-section,
.controls-panel.locked .button-row {
  opacity: 0.3;
  pointer-events: none;
  filter: grayscale(100%);
}

.controls-panel.locked .wallet-lock-overlay {
  display: flex;
}

/* Save as Default - hidden by default, shown for admin wallets */
.controls-panel button.admin-only {
  display: none;
}
.controls-panel button.admin-only.visible {
  display: inline-block;
}

/* ===== MODE TOGGLE ===== */
.mode-toggle {
  display: flex;
  gap: 4px;
}

.mode-btn {
  flex: 1;
  padding: 6px 10px;
  background: var(--bg-button);
  border: 2px outset var(--text-muted);
  color: var(--dos-border);
  font-family: var(--font-dos);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.1s;
  border-radius: 0;
}

.mode-btn:hover {
  background: var(--bg-button-hover);
  color: var(--text-primary);
}

.mode-btn.active {
  background: var(--dos-border);
  border: 2px inset var(--text-dim);
  color: var(--dos-navy);
  font-weight: bold;
}

.spin-reset {
  position: absolute;
  right: 28px;
  color: var(--bg-button);
  font-size: 8px;
  cursor: pointer;
}

.spin-reset:hover {
  color: var(--neon-blue);
}

.button-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

#statusMsg {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  min-height: 16px;
  max-width: 248px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== WALLET CONNECT ===== */
.wallet-connect-btn {
  font-family: var(--font-dos);
  font-size: 14px;
  color: var(--dos-navy);
  background: var(--dos-border);
  border: 2px outset var(--dos-border-light);
  padding: 8px 16px;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.1s;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
}

.wallet-connect-btn:hover {
  background: var(--dos-border-light);
}

.wallet-connect-btn:active {
  border-style: inset;
}

.wallet-connect-btn.connected {
  background: var(--color-connected);
  color: var(--text-primary);
  font-size: 12px;
}

.wallet-address {
  font-family: var(--font-dos);
  font-size: 11px;
  color: var(--neon-cyan);
  margin-top: 8px;
}

/* Show wallet status when unlocked */
.wallet-status {
  display: none;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 12px;
  background: rgba(0, 170, 0, 0.2);
  border: 1px solid var(--color-connected);
  border-radius: 0;
}

.wallet-status.connected {
  display: flex;
}

.wallet-status .status-info {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.wallet-status .status-dot {
  width: 6px;
  height: 6px;
  background: var(--neon-green);
  border-radius: 0;
  box-shadow: 0 0 6px var(--neon-green);
  flex-shrink: 0;
}

.wallet-status .status-text {
  font-family: var(--font-dos);
  font-size: 11px;
  color: var(--neon-green);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wallet-status .status-address {
  color: var(--neon-cyan);
}

.wallet-status .disconnect-btn {
  font-family: var(--font-dos);
  font-size: 12px;
  color: var(--color-danger);
  background: none;
  border: 1px solid var(--color-danger);
  width: 18px;
  height: 18px;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 16px;
  text-align: center;
}

.wallet-status .disconnect-btn:hover {
  background: var(--color-danger);
  color: var(--bg-black);
}

/* ===== CENTER PLAY BUTTON ===== */
.center-play {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 200;
  transition: opacity 0.15s ease;
}

.center-play.hidden {
  opacity: 0;
  pointer-events: none;
}

.center-play.ch3-hidden {
  display: none !important;
}

.play-btn {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid var(--neon-green);
  background: var(--accent-backdrop);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.play-btn:hover {
  background: rgba(0, 255, 0, 0.15);
  box-shadow: 0 0 40px rgba(0, 255, 0, 0.4);
  transform: scale(1.05);
}

.play-btn.playing {
  animation: pulse 2s infinite;
}

.play-btn svg {
  width: 50px;
  height: 50px;
  fill: var(--neon-green);
  margin-left: 8px;
}

.play-btn.playing svg.play-icon { display: none; }
.play-btn.playing svg.pause-icon { display: block; }
.play-btn svg.pause-icon { display: none; margin-left: 0; }

/* ===== BOTTOM BAR ===== */
.bottom-left {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 100;
}

.bottom-left .tagline {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 2px;
}

.bottom-right {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
}

.how-it-works-btn {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}

.how-it-works-btn:hover {
  color: var(--dos-border);
}

/* ===== TRACK INFO POPUP ===== */
.track-info-popup {
  max-width: 500px;
}

.track-info-name {
  font-family: var(--font-dos);
  font-size: 16px;
  color: var(--neon-green);
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-muted);
}

.track-info-section {
  margin-bottom: 15px;
}

.info-label {
  font-family: var(--font-dos);
  font-size: 11px;
  color: var(--neon-yellow);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.info-item {
  background: rgba(0, 0, 0, 0.4);
  padding: 8px 10px;
  border-radius: 0;
  border: 1px solid var(--text-muted);
}

.info-item-label {
  font-family: var(--font-dos);
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 3px;
}

.info-item-value {
  font-family: var(--font-dos);
  font-size: 14px;
  color: var(--neon-green);
}

.info-mappings {
  font-family: var(--font-dos);
  font-size: 12px;
  color: var(--dos-border);
  line-height: 1.7;
}

.info-mapping-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.info-mapping-row .data-value {
  color: var(--neon-green);
  font-weight: bold;
}

.info-mapping-row .arrow {
  color: var(--text-muted);
}

.info-mapping-row .music-param {
  color: var(--neon-cyan);
}

.info-prompt {
  font-family: var(--font-dos);
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
  background: rgba(0, 0, 0, 0.4);
  padding: 10px;
  border-radius: 0;
  border: 1px solid var(--text-muted);
}

/* ===== MOBILE HEADER ===== */
.mobile-header {
  display: none;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 767px) {
  /* Hide desktop logo */
  .top-left { display: none; }

  /* Show mobile header */
  .mobile-header {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 44px;
    background: rgba(0, 0, 128, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--dos-border);
    z-index: 200;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
  }

  .mobile-logo {
    height: 28px;
    width: auto;
  }

  .mobile-toggles {
    display: flex;
    gap: 6px;
  }

  .mobile-toggle {
    font-family: var(--font-dos);
    font-size: 10px;
    color: var(--dos-border);
    background: var(--bg-button);
    border: 2px outset var(--text-muted);
    padding: 6px 10px;
    cursor: pointer;
  }

  .mobile-toggle:hover,
  .mobile-toggle.active {
    background: var(--bg-button-hover);
    color: var(--text-primary);
  }

  .mobile-toggle:active {
    border: 2px inset var(--text-muted);
  }

  /* Hide top-right panel by default on mobile */
  .top-right {
    display: none !important;
    position: fixed;
    top: 44px;
    left: 0;
    right: 0;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    border-radius: 0;
    border-left: none;
    border-right: none;
    z-index: 150;
  }

  .top-right.mobile-open {
    display: block !important;
  }

  /* Mobile panel positioning - full width, below header */
  .controls-panel {
    top: 44px !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    border-radius: 0;
    border-left: none;
    border-right: none;
    z-index: 150;
  }

  /* Hide mesh panel when not open on mobile */
  .controls-panel:not(.open) {
    display: none !important;
  }

  .chain-stats-panel {
    top: 44px !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    border-radius: 0;
    border-left: none;
    border-right: none;
    z-index: 150;
  }

  /* Hide chain panel when not visible on mobile */
  .chain-stats-panel:not(.visible) {
    display: none !important;
  }

  /* Hide MESH CONTROLS button inside RADIO panel on mobile */
  .controls-dropdown {
    display: none !important;
  }

  /* RADIO panel row layout - track left, channel right */
  .top-right-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .top-right-row .track-name {
    flex: 1;
    min-width: 0;
  }

  .top-right-row .chain-dropdown {
    flex-shrink: 0;
    margin-left: auto;
  }

  /* Adjust control panel widths */
  .controls-panel .controls-section input[type="range"] {
    width: 100%;
    flex: 1;
  }

  /* Larger touch targets */
  .controls-panel button,
  .chain-dropdown button {
    min-height: 44px;
    padding: 10px 16px;
  }

  .channel-selector button {
    min-height: 44px;
    padding: 10px 12px;
  }

  /* Adjust bottom elements to not overlap */
  .bottom-left,
  .bottom-right {
    bottom: 10px;
  }

  .bottom-left .tagline {
    font-size: 11px;
  }

  /* Adjust play button position on mobile */
  .center-play {
    top: calc(50% + 22px);
  }
}
