/**
 * Family Radio - Streaming Radio Player Styles
 * KLOVE-inspired design with responsive layout
 */

{% scope_css %}

/* ========================================
   CSS Custom Properties
   ======================================== */

/* ========================================
   Radio Bar Container
   ======================================== */

.radio-bar {
  /* CSS custom properties defined here so they scope correctly with HubSpot's scope_css */
  --radio-primary: #66d8ff;
  --radio-primary-hover: #4dc9ff;
  --radio-bg: #242021;
  --radio-bg-light: #2d2829;
  --radio-text: #ffffff;
  --radio-text-muted: #868686;
  --radio-border: #3a3536;
  --radio-hover: rgba(102, 216, 255, 0.1);
  --radio-active: rgba(102, 216, 255, 0.2);
  --radio-shadow: rgba(0, 0, 0, 0.3);

  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;

  padding: 1.25rem 1.5rem;
  background: linear-gradient(to bottom, #2d2829 0%, #242021 100%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 2px solid var(--radio-border);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);

  min-height: 96px;
  color: var(--radio-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* ========================================
   Now Playing Section
   ======================================== */

.radio-bar__now-playing {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 280px;
  max-width: 400px;
  flex: 1;
}

.radio-bar__artwork {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--radio-border);
  flex-shrink: 0;
}

.radio-bar__info {
  flex: 1;
  min-width: 0; /* Allow text truncation */
}

.radio-bar__label {
  margin: 0 0 0.25rem 0;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--radio-primary);
}

.radio-bar__title {
  margin: 0 0 0.25rem 0;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--radio-text);

  /* Text truncation */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.radio-bar__artist {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--radio-text);

  /* Text truncation */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========================================
   Up Next Section
   ======================================== */

.radio-bar__up-next {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 320px;
  flex: 1;
}

.radio-bar__caret-left {
  color: rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

.radio-bar__next-artwork {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
  opacity: 0.6;
  flex-shrink: 0;
}

.radio-bar__next-content {
  flex: 1;
  min-width: 0;
}

.radio-bar__next-info {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--radio-text-muted);
  line-height: 1.4;

  /* Text truncation after 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ========================================
   Center Controls
   ======================================== */

.radio-bar__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-shrink: 0;
}

.radio-bar__play,
.radio-bar__expand,
.radio-bar__volume {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 50%;
  background: var(--radio-hover);
  color: var(--radio-text);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-sizing: border-box;
}

/* Ensure SVG icons are visible */
.radio-bar__play svg,
.radio-bar__expand svg,
.radio-bar__volume svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  stroke: currentColor;
  pointer-events: none;
}

.radio-bar__play {
  width: 64px;
  height: 64px;
  background: var(--radio-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(102, 216, 255, 0.3);
}

.radio-bar__play svg {
  width: 28px;
  height: 28px;
  fill: #ffffff;
}

.radio-bar__play:hover {
  background: var(--radio-primary-hover);
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(102, 216, 255, 0.4);
}

.radio-bar__expand:hover,
.radio-bar__volume:hover {
  background: var(--radio-active);
}

.radio-bar__play:active,
.radio-bar__expand:active,
.radio-bar__volume:active {
  transform: scale(0.95);
}

/* Volume Container & Dropdown */
.radio-bar__volume-container {
  position: relative;
}

/* Invisible bridge filling the gap between button and dropdown so
   hover state doesn't break when moving the mouse between them */
.radio-bar__volume-container::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  height: 0.5rem; /* matches dropdown margin-bottom */
}

.radio-bar__volume-dropdown {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 0.5rem;

  display: none;
  padding: 1rem 0.75rem;
  background: var(--radio-bg);
  border: 1px solid var(--radio-border);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.radio-bar__volume-container:hover .radio-bar__volume-dropdown {
  display: block;
}

.radio-bar__volume-slider-container {
  height: 120px;
  width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radio-bar__volume-slider {
  width: 110px;
  height: 4px;
  /* Rotate a standard horizontal slider into a vertical one.
     -90deg puts min (left) at bottom and max (right) at top,
     so dragging up increases volume naturally. */
  transform: rotate(-90deg);
  -webkit-appearance: none;
  appearance: none;
  background: var(--radio-hover);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.radio-bar__volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--radio-primary);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.1s;
}

.radio-bar__volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.radio-bar__volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--radio-primary);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.1s;
}

.radio-bar__volume-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
}

/* ========================================
   Station Selector
   ======================================== */

.radio-bar__station-selector {
  position: relative;
  flex-shrink: 0;
}

.radio-bar__station-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border: none;
  border-radius: 9999px;
  background: var(--radio-hover);
  color: var(--radio-text);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.radio-bar__station-button:hover {
  background: var(--radio-active);
}

.radio-bar__station-logo {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--radio-border);
}

.radio-bar__dropdown-icon {
  margin-left: 0.5rem;
  transition: transform 0.2s ease;
}

/* Station Dropdown */
.radio-bar__dropdown {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 0.5rem;

  display: none;
  min-width: 200px;
  max-height: 400px;
  overflow-y: auto;

  background: var(--radio-bg);
  border: 1px solid var(--radio-border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.radio-bar__dropdown.open {
  display: block;
}

.radio-bar__station-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
}

.radio-bar__station-item {
  margin: 0;
  padding: 0;
}

.radio-bar__station-item-button {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  color: var(--radio-text);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.radio-bar__station-item-button:hover {
  background: var(--radio-hover);
}

.radio-bar__station-item-button.active {
  background: var(--radio-active);
  font-weight: 700;
}

.radio-bar__station-item-button img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

/* ========================================
   Loading Indicator
   ======================================== */

.radio-bar__loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  align-items: center;
  justify-content: center;

  padding: 1rem;
  background: rgba(36, 32, 33, 0.9);
  border-radius: 8px;
  pointer-events: none;
}

.radio-bar__spinner {
  color: var(--radio-primary);
}

/* ========================================
   Responsive Design
   ======================================== */

/* Tablet (768px - 1366px) */
@media (max-width: 1366px) {
  .radio-bar {
    gap: 0.75rem;
    padding: 1rem;
  }

  .radio-bar__now-playing {
    min-width: 200px;
    max-width: 300px;
  }

  .radio-bar__up-next {
    max-width: 240px;
  }

  .radio-bar__title {
    font-size: 0.9375rem;
  }

  .radio-bar__artist {
    font-size: 0.8125rem;
  }
}

/* Mobile (max 768px) */
@media (max-width: 768px) {
  .radio-bar {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    min-height: auto;
  }

  .radio-bar__now-playing {
    order: 1;
    flex: 1 1 calc(100% - 160px);
    min-width: 0;
  }

  .radio-bar__controls {
    order: 2;
    gap: 0.5rem;
  }

  .radio-bar__play {
    width: 56px;
    height: 56px;
  }

  .radio-bar__expand,
  .radio-bar__volume {
    width: 40px;
    height: 40px;
  }

  .radio-bar__up-next {
    order: 3;
    flex: 1 1 50%;
    max-width: none;
  }

  .radio-bar__station-selector {
    order: 4;
    flex: 1 1 45%;
  }

  .radio-bar__station-button {
    width: 100%;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
  }

  .radio-bar__artwork {
    width: 56px;
    height: 56px;
  }

  .radio-bar__title {
    font-size: 0.875rem;
  }

  .radio-bar__artist {
    font-size: 0.75rem;
  }

  /* Volume dropdown on mobile - position from button */
  .radio-bar__volume-dropdown {
    left: auto;
    right: 0;
    transform: none;
  }
}

/* Small Mobile (max 480px) */
@media (max-width: 480px) {
  .radio-bar {
    padding: 0.625rem;
  }

  .radio-bar__up-next {
    order: 5;
    flex: 1 1 100%;
    padding-top: 0.5rem;
    border-top: 1px solid var(--radio-border);
  }

  .radio-bar__station-selector {
    order: 4;
    flex: 1 1 100%;
  }

  .radio-bar__station-button {
    width: 100%;
  }

  .radio-bar__expand {
    display: none; /* Hide expand button on small mobile */
  }

  .radio-bar__label {
    font-size: 0.5625rem;
  }

  .radio-bar__title {
    font-size: 0.8125rem;
  }

  .radio-bar__artist {
    font-size: 0.6875rem;
  }
}

/* ========================================
   Accessibility
   ======================================== */

/* Focus styles for keyboard navigation */
button:focus-visible {
  outline: 2px solid var(--radio-primary);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .radio-bar {
    border-top: 2px solid var(--radio-text);
  }

  .radio-bar__play {
    border: 2px solid var(--radio-bg);
  }
}

{% end_scope_css %}
