/* ============================================
   SAF Radio Player - Fixed Right Center
   ============================================ */

.saf-radio-player {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: row;
  align-items: center;
}

/* Toggle Button */
.radio-toggle-btn {
  position: relative;
  width: 48px;
  height: 48px;
  background: #000;
  color: #fff;
  border: none;
  border-radius: 8px 0 0 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
  box-shadow: -2px 0 12px rgba(0, 0, 0, 0.15);
}

.radio-toggle-btn:hover {
  background: #333;
}

.radio-toggle-btn.is-playing {
  background: #000;
}

.radio-toggle-btn.is-playing:hover {
  background: #333;
}

.radio-toggle-btn.is-playing .radio-icon {
  color: #39b54a;
  animation: iconPulse 1.5s ease-in-out infinite;
}

@keyframes iconPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.2); }
}

/* Pulse animation when playing */
.radio-icon-pulse {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 8px 0 0 8px;
  animation: none;
  pointer-events: none;
}

.radio-toggle-btn.is-playing .radio-icon-pulse {
  animation: radioPulse 2s ease-in-out infinite;
}

@keyframes radioPulse {
  0%, 100% { opacity: 0; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}

/* Panel */
.radio-panel {
  width: 85px;
  background: #eaeaea;
  color: #000;
  border-radius: 0;
  box-shadow: none;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  transform: translateX(100%) translateY(-50%);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
  pointer-events: none;
  position: absolute;
  right: 0;
  top: 50%;
}

.radio-panel.is-open {
  transform: translateX(0) translateY(-50%);
  opacity: 1;
  pointer-events: all;
}

/* When panel is open, hide toggle */
.saf-radio-player.panel-open .radio-toggle-btn {
  transform: translateX(-85px);
}

/* Panel Header - Vertical text */
.radio-panel-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
  writing-mode: vertical-rl;
  transform: rotate(360deg);
  min-height: 220px;
}

/* Station Name */
.radio-station-name {
  font-family: 'FranklinGothicDemi', 'Franklin Gothic Medium', sans-serif;
  font-size: 1.8em;
  font-weight: 600;
  text-transform: uppercase;
  color: #000;
  white-space: nowrap;
}

/* Status Badge */
.radio-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 999px;
  border: 1px solid #666;
  white-space: nowrap;
}

.radio-status-badge.is-live {
  border-color: #000;
}

.radio-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #666;
  flex-shrink: 0;
}

.radio-status-badge.is-live .radio-status-dot {
  background: #39b54a;
  animation: dotPulse 1.5s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(57, 181, 74, 0.5); }
  50% { box-shadow: 0 0 0 4px rgba(57, 181, 74, 0); }
}

.radio-status-text {
  font-family: 'FranklinGothicBook', 'Franklin Gothic Book', sans-serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #666;
}

.radio-status-badge.is-live .radio-status-text {
  color: #000;
}

/* Separator */
.radio-controls-separator {
  width: 100%;
  height: 1px;
  background: #000;
  margin-bottom: 12px;
}

/* Controls */
.radio-controls {
  display: flex;
  align-items: center;
  justify-content: center;
}

.radio-play-btn {
  width: 48px;
  height: 48px;
  background: #000;
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
}

.radio-play-btn:hover {
  background: #333;
  transform: scale(1.05);
}

.radio-play-btn:active {
  transform: scale(0.95);
}

.radio-play-btn.is-loading {
  pointer-events: none;
  opacity: 0.7;
}

/* Play button wrapper */
.radio-play-wrap {
  position: relative;
  display: inline-block;
}

/* Tooltip */
.radio-tooltip {
  display: none;
  position: absolute;
  top: 50%;
  right: calc(100% + 10px);
  transform: translateY(-50%);
  background: #000;
  color: #fff;
  font-family: 'FranklinGothicBook', 'Franklin Gothic Book', sans-serif;
  font-size: 1rem;
  line-height: 1.3;
  padding: 6px 10px;
  border-radius: 4px;
  white-space: normal;
  width: max-content;
  max-width: 300px;
  pointer-events: none;
  z-index: 10;
}

.radio-tooltip::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-left-color: #000;
}

.radio-play-wrap:hover .radio-tooltip.has-track {
  display: block;
}

/* Loading Spinner */
.radio-loading-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: radioSpin 0.7s linear infinite;
}

@keyframes radioSpin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* RTL Support */
html[dir="rtl"] .saf-radio-player {
  right: auto;
  left: 0;
}

html[dir="rtl"] .radio-toggle-btn {
  border-radius: 0 8px 8px 0;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
}

html[dir="rtl"] .radio-icon-pulse {
  border-radius: 0 8px 8px 0;
}

html[dir="rtl"] .radio-panel {
  border-radius: 0;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
  right: auto;
  left: 0;
  transform: translateX(-100%) translateY(-50%);
}

html[dir="rtl"] .radio-panel.is-open {
  transform: translateX(0) translateY(-50%);
}

html[dir="rtl"] .saf-radio-player.panel-open .radio-toggle-btn {
  transform: translateX(85px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .radio-toggle-btn {
    width: 40px;
    height: 40px;
  }

  .radio-toggle-btn .radio-icon {
    width: 18px;
    height: 18px;
  }

  html[dir="rtl"] .saf-radio-player.panel-open .radio-toggle-btn {
    transform: translateX(85px);
  }

  .saf-radio-player.panel-open .radio-toggle-btn {
    transform: translateX(-85px);
  }
}

/* Very small screens */
@media (max-width: 480px) {
  .radio-toggle-btn {
    width: 36px;
    height: 36px;
  }

  .radio-toggle-btn .radio-icon {
    width: 16px;
    height: 16px;
  }

  .saf-radio-player.panel-open .radio-toggle-btn {
    transform: translateX(-85px);
  }

  html[dir="rtl"] .saf-radio-player.panel-open .radio-toggle-btn {
    transform: translateX(85px);
  }
}
