/* live-radio.css */
/* Styling for Rex Live Radio Streaming Interface */

/* Live Indicator */
.rex-live-indicator {
  position: fixed;
  top: max(20px, calc(10px + env(safe-area-inset-top, 0px)));
  right: max(20px, env(safe-area-inset-right, 0px));
  background: rgba(0, 0, 0, 0.9);
  border: 2px solid #ff0000;
  border-radius: 8px;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(255, 0, 0, 0.5);
  font-family: 'Courier New', monospace;
  color: #00ffae;
}

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

.live-pulse {
  font-size: 1.2em;
  animation: pulse 1.5s ease-in-out infinite;
}

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

.live-text {
  font-weight: bold;
  color: #ff0000;
  font-size: 1.1em;
  letter-spacing: 2px;
}

.live-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.live-host {
  font-size: 0.9em;
  font-weight: bold;
  color: #ffaa00;
}

.live-title {
  font-size: 0.8em;
  opacity: 0.8;
}

/* Animations */
.slide-in {
  animation: slideIn 0.3s ease-out;
}

.slide-out {
  animation: slideOut 0.3s ease-out;
}

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

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* Live Chat Interface */
.rex-live-chat {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 350px;
  max-height: 500px;
  background: rgba(0, 0, 0, 0.95);
  border: 2px solid #00ffae;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  z-index: 9998;
  font-family: 'Courier New', monospace;
  box-shadow: 0 4px 20px rgba(0, 255, 174, 0.3);
}

.chat-header {
  background: #00ffae;
  color: #000;
  padding: 10px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  border-radius: 6px 6px 0 0;
}

.chat-title {
  font-size: 0.9em;
  letter-spacing: 1px;
}

.chat-close {
  background: none;
  border: none;
  color: #000;
  font-size: 1.2em;
  cursor: pointer;
  padding: 0 5px;
  line-height: 1;
}

.chat-close:hover {
  color: #ff0000;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  max-height: 350px;
  min-height: 200px;
  scrollbar-width: thin;
  scrollbar-color: #00ffae rgba(0, 0, 0, 0.5);
}

.chat-messages::-webkit-scrollbar {
  width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.5);
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #00ffae;
  border-radius: 4px;
}

.chat-message {
  margin-bottom: 8px;
  padding: 6px 8px;
  background: rgba(0, 255, 174, 0.05);
  border-radius: 4px;
  font-size: 0.85em;
  line-height: 1.4;
  word-wrap: break-word;
}

.chat-message-host {
  background: rgba(255, 170, 0, 0.1);
  border-left: 3px solid #ffaa00;
}

.chat-timestamp {
  color: #888;
  font-size: 0.9em;
  margin-right: 5px;
}

.chat-username {
  color: #00ffae;
  font-weight: bold;
  margin-right: 5px;
}

.chat-text {
  color: #ccc;
}

.chat-input-container {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #00ffae;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 0 0 6px 6px;
}

.chat-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid #00ffae;
  color: #00ffae;
  padding: 8px 10px;
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
  border-radius: 4px;
}

.chat-input:focus {
  outline: none;
  border-color: #ffaa00;
  box-shadow: 0 0 5px rgba(255, 170, 0, 0.5);
}

.chat-send {
  background: #00ffae;
  color: #000;
  border: none;
  padding: 8px 15px;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.chat-send:hover {
  background: #ffaa00;
  transform: scale(1.05);
}

.chat-send:active {
  transform: scale(0.95);
}

.chat-minimized .chat-messages,
.chat-minimized .chat-input-container {
  display: none;
}

.chat-minimized {
  max-height: 50px;
}

.fade-in {
  animation: fadeIn 0.3s ease-in;
}

.fade-out {
  animation: fadeOut 0.3s ease-out;
}

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

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

/* External Stream Embed */
.rex-external-embed {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 400px;
  height: 225px;
  border: 2px solid #00ffae;
  border-radius: 8px;
  z-index: 9997;
  display: none;
  box-shadow: 0 4px 20px rgba(0, 255, 174, 0.3);
}

/* Admin Controls */
.rex-admin-controls {
  position: fixed;
  top: max(20px, calc(10px + env(safe-area-inset-top, 0px)));
  left: max(20px, env(safe-area-inset-left, 0px));
  width: 400px;
  background: rgba(0, 0, 0, 0.95);
  border: 2px solid #ffaa00;
  border-radius: 8px;
  z-index: 9999;
  font-family: 'Courier New', monospace;
  color: #00ffae;
  box-shadow: 0 4px 20px rgba(255, 170, 0, 0.5);
}

.admin-header {
  background: #ffaa00;
  color: #000;
  padding: 12px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
}

.admin-header h3 {
  margin: 0;
  font-size: 1em;
  letter-spacing: 1px;
}

#admin-toggle {
  background: none;
  border: none;
  color: #000;
  font-size: 1.2em;
  cursor: pointer;
  padding: 0 5px;
}

.admin-body {
  padding: 15px;
  max-height: 600px;
  overflow-y: auto;
}

.admin-body.collapsed {
  display: none;
}

.admin-status {
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  margin-bottom: 15px;
  text-align: center;
}

#admin-status-text {
  font-weight: bold;
  font-size: 1.1em;
  color: #888;
}

.admin-section {
  margin-bottom: 15px;
}

.admin-section label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.9em;
  color: #ffaa00;
}

.admin-actions {
  display: flex;
  gap: 10px;
  margin: 20px 0;
}

.admin-preset {
  padding: 8px 12px;
  background: rgba(0, 255, 174, 0.1);
  border: 1px solid #00ffae;
  color: #00ffae;
  font-family: 'Courier New', monospace;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.85em;
  transition: all 0.2s;
}

.admin-preset:hover {
  background: rgba(0, 255, 174, 0.2);
  transform: scale(1.05);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .rex-live-indicator {
    top: 10px;
    right: 10px;
    padding: 10px 12px;
    font-size: 0.85em;
  }

  .rex-live-chat {
    width: 300px;
    max-height: 400px;
    bottom: 10px;
    right: 10px;
  }

  .chat-messages {
    max-height: 250px;
  }

  .rex-external-embed {
    width: 320px;
    height: 180px;
    bottom: 10px;
    left: 10px;
  }

  .rex-admin-controls {
    width: 95%;
    left: 2.5%;
    top: 10px;
    max-height: 80vh;
  }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
  .rex-admin-controls {
    width: 350px;
  }
}

/* ============================================================
   PIP-BOY RADIO TAB UI (Slim Horizontal Design)
   Redesigned from circular 280px jukebox dial to 50px horizontal bar
   to match Pip-Boy minimalist CRT aesthetic
   ============================================================ */

.radio-dial-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  background: rgba(16, 35, 16, 0.4);
  border: 2px solid #304b2b;
  border-radius: 6px;
  box-shadow: 
    inset 0 0 20px rgba(0, 0, 0, 0.5),
    0 0 10px rgba(159, 232, 141, 0.1);
  margin: 10px 0;
  position: relative;
}

.radio-dial-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 0%, rgba(159, 232, 141, 0.03) 0%, transparent 70%);
  border-radius: 6px;
  pointer-events: none;
}

/* Horizontal frequency bar */
.radio-dial {
  position: relative;
  width: 100%;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radio-dial-face {
  position: relative;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, rgba(5, 7, 5, 0.9) 0%, rgba(16, 35, 16, 0.6) 100%);
  border-radius: 4px;
  border: 1px solid #304b2b;
  box-shadow: 
    inset 0 2px 8px rgba(0, 0, 0, 0.8),
    0 0 8px rgba(159, 232, 141, 0.15);
  display: flex;
  align-items: center;
  padding: 0 15px;
  overflow: hidden;
}

/* Horizontal frequency markers */
.radio-frequency-markers {
  position: absolute;
  width: calc(100% - 30px);
  height: 100%;
  top: 0;
  left: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.frequency-marker {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  pointer-events: none;
}

.frequency-marker::before {
  content: '';
  width: 1px;
  height: 12px;
  background: linear-gradient(to bottom, #9fe88d 0%, #5a854d 100%);
  box-shadow: 0 0 3px rgba(159, 232, 141, 0.6);
  margin-bottom: 3px;
}

.frequency-text {
  font-family: 'Courier New', monospace;
  font-size: 9px;
  font-weight: bold;
  color: #9fe88d;
  text-shadow: 0 0 4px rgba(159, 232, 141, 0.6);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0.7;
}

/* Horizontal needle indicator */
.radio-needle {
  position: absolute;
  width: 3px;
  height: 100%;
  background: linear-gradient(to bottom, 
    rgba(255, 170, 0, 0) 0%, 
    rgba(255, 170, 0, 0.3) 20%,
    #ffaa00 40%, 
    #ffaa00 60%,
    rgba(255, 170, 0, 0.3) 80%,
    rgba(255, 170, 0, 0) 100%);
  left: 15px;
  top: 0;
  transition: left 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
  z-index: 10;
  filter: drop-shadow(0 0 6px rgba(255, 170, 0, 0.9));
  pointer-events: none;
}

.radio-needle::before {
  content: '▼';
  position: absolute;
  top: -3px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  color: #ffaa00;
  text-shadow: 0 0 6px rgba(255, 170, 0, 1);
  filter: drop-shadow(0 0 4px rgba(255, 170, 0, 1));
}

.radio-needle::after {
  content: '▲';
  position: absolute;
  bottom: -3px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  color: #ffaa00;
  text-shadow: 0 0 6px rgba(255, 170, 0, 1);
  filter: drop-shadow(0 0 4px rgba(255, 170, 0, 1));
}

.radio-center-knob {
  /* Not needed in horizontal design */
  display: none;
}

/* Station display */
.radio-station-display {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(5, 7, 5, 0.7);
  border: 1px solid #304b2b;
  border-radius: 4px;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
}

.radio-station-name {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  font-weight: bold;
  color: #9fe88d;
  text-shadow: 0 0 6px rgba(159, 232, 141, 0.6);
  letter-spacing: 1px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.radio-frequency-display {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #9fe88d;
  text-shadow: 0 0 4px rgba(159, 232, 141, 0.5);
  letter-spacing: 0.5px;
  opacity: 0.8;
}

/* Tuning Animation */
.radio-tuning .radio-dial-face {
  animation: dial-pulse 0.4s ease-in-out;
}

.radio-tuning .radio-station-name {
  animation: text-flicker 0.4s steps(3, end);
}

.radio-tuning .radio-needle {
  filter: drop-shadow(0 0 10px rgba(255, 170, 0, 1));
}

@keyframes dial-pulse {
  0%, 100% {
    box-shadow: 
      inset 0 2px 8px rgba(0, 0, 0, 0.8),
      0 0 8px rgba(159, 232, 141, 0.15);
  }
  50% {
    box-shadow: 
      inset 0 2px 8px rgba(0, 0, 0, 0.8),
      0 0 12px rgba(159, 232, 141, 0.3);
  }
}

@keyframes text-flicker {
  0%, 100% { opacity: 1; }
  33% { opacity: 0.4; }
  66% { opacity: 0.7; }
}

/* Responsive adjustments for radio dial */
@media (max-width: 768px) {
  .radio-dial {
    height: 40px;
  }

  .radio-station-name {
    font-size: 12px;
  }

  .radio-frequency-display {
    font-size: 10px;
  }

  .frequency-text {
    font-size: 8px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .radio-dial {
    height: 45px;
  }
}

/* ============================================================
   NARROW PHONE FIX — 320px screens (BUG-009)
   ============================================================ */
@media (max-width: 400px) {
  .rex-live-chat {
    width: calc(100vw - 20px);
    right: 10px;
    left: 10px;
  }
}
