/**
 * Embed player popup styles.
 * Compact layout for ~320px width popup window.
 * Layout: large image + overlaid play -> ad -> similar radios -> meta.
 */

.embed-page {
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
}

.embed {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  padding: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Ad slot */
.embed__ad {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60px;
}

.embed__ad .ad-container-banner,
.embed__ad .ad-container-square,
.embed__ad .ad-container-rectangle {
  max-width: 100%;
  overflow: hidden;
}

/* Player section: image + overlaid play button */
.embed-player {
  display: flex;
  flex-direction: column;
}

.embed-player__top {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.embed-player__image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
}

.embed-player__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  background: var(--color-play-button);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-fast), opacity var(--transition-fast), background var(--transition-fast);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.embed-player__play:hover {
  transform: translate(-50%, -50%) scale(1.08);
  background: var(--color-play-button-hover);
}

.embed-player__play:disabled {
  background: var(--color-text-muted);
  cursor: not-allowed;
}

/* Playing state: red button */
.embed-player__play--playing {
  background: var(--color-play-button-playing);
}

.embed-player__play--playing:hover {
  background: var(--color-play-button-playing-hover);
}

/* Connecting/loading state */
.embed-player__play--connecting {
  background: #ff9800;
  animation: embed-pulse 1.5s ease-in-out infinite;
}

@keyframes embed-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.embed-player__play-icon {
  width: 34px;
  height: 34px;
  fill: currentColor;
}

/* Playing bars overlay */
.embed-player__bars-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.55) 0%,
    rgba(0, 0, 0, 0.15) 60%,
    transparent 100%
  );
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast), visibility var(--transition-fast);
  z-index: 1;
  pointer-events: none;
}

.embed-player__top.is-playing .embed-player__bars-overlay {
  opacity: 1;
  visibility: visible;
}

.embed-player__bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-evenly;
  height: 100%;
  width: 100%;
  gap: 2px;
  padding: 4px 6px;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.35));
}

.embed-player__bar {
  flex: 1 1 0;
  max-width: 10px;
  height: 100%;
  border-radius: 999px;
  --bar-color: #22c55e;
  --bar-low: 0.2;
  --bar-high: 0.8;
  --bar-delay: 0s;
  --bar-duration: 0.9s;
  animation: embed-bar-bounce var(--bar-duration) var(--bar-delay) ease-in-out infinite alternate;
  background: linear-gradient(
    to top,
    transparent 0%,
    var(--bar-color) 100%
  );
}

/* Rainbow gradient: red -> orange -> yellow -> green -> cyan -> blue -> violet */
.embed-player__bar--1  { --bar-color: #ef4444; --bar-low: 0.22; --bar-high: 0.76; --bar-duration: 0.90s; }
.embed-player__bar--2  { --bar-color: #f05a3a; --bar-low: 0.30; --bar-high: 0.88; --bar-delay: 0.08s; --bar-duration: 0.98s; }
.embed-player__bar--3  { --bar-color: #f17030; --bar-low: 0.16; --bar-high: 0.64; --bar-delay: 0.14s; --bar-duration: 0.85s; }
.embed-player__bar--4  { --bar-color: #f28626; --bar-low: 0.28; --bar-high: 0.96; --bar-delay: 0.02s; --bar-duration: 1.02s; }
.embed-player__bar--5  { --bar-color: #f49c1c; --bar-low: 0.18; --bar-high: 0.78; --bar-delay: 0.11s; --bar-duration: 0.92s; }
.embed-player__bar--6  { --bar-color: #f5b212; --bar-low: 0.34; --bar-high: 1.00; --bar-delay: 0.05s; --bar-duration: 0.86s; }
.embed-player__bar--7  { --bar-color: #f6c808; --bar-low: 0.20; --bar-high: 0.72; --bar-delay: 0.18s; --bar-duration: 0.94s; }
.embed-player__bar--8  { --bar-color: #e0d206; --bar-low: 0.38; --bar-high: 0.92; --bar-delay: 0.09s; --bar-duration: 1.00s; }
.embed-player__bar--9  { --bar-color: #c0d810; --bar-low: 0.26; --bar-high: 0.84; --bar-delay: 0.15s; --bar-duration: 0.96s; }
.embed-player__bar--10 { --bar-color: #a0de1a; --bar-low: 0.24; --bar-high: 0.82; --bar-delay: 0.03s; --bar-duration: 0.88s; }
.embed-player__bar--11 { --bar-color: #6dd62a; --bar-low: 0.32; --bar-high: 0.94; --bar-delay: 0.12s; --bar-duration: 1.04s; }
.embed-player__bar--12 { --bar-color: #3ace3a; --bar-low: 0.18; --bar-high: 0.70; --bar-delay: 0.06s; --bar-duration: 0.82s; }
.embed-player__bar--13 { --bar-color: #22c55e; --bar-low: 0.36; --bar-high: 0.98; --bar-delay: 0.16s; --bar-duration: 0.97s; }
.embed-player__bar--14 { --bar-color: #1ebf78; --bar-low: 0.20; --bar-high: 0.74; --bar-delay: 0.01s; --bar-duration: 0.91s; }
.embed-player__bar--15 { --bar-color: #1ab892; --bar-low: 0.28; --bar-high: 0.86; --bar-delay: 0.10s; --bar-duration: 1.01s; }
.embed-player__bar--16 { --bar-color: #16b2ac; --bar-low: 0.14; --bar-high: 0.68; --bar-delay: 0.17s; --bar-duration: 0.84s; }
.embed-player__bar--17 { --bar-color: #12abc6; --bar-low: 0.34; --bar-high: 0.90; --bar-delay: 0.04s; --bar-duration: 0.95s; }
.embed-player__bar--18 { --bar-color: #0e9ed8; --bar-low: 0.22; --bar-high: 0.80; --bar-delay: 0.13s; --bar-duration: 0.89s; }
.embed-player__bar--19 { --bar-color: #0a8fea; --bar-low: 0.30; --bar-high: 0.96; --bar-delay: 0.07s; --bar-duration: 1.03s; }
.embed-player__bar--20 { --bar-color: #1a7ee0; --bar-low: 0.16; --bar-high: 0.72; --bar-delay: 0.19s; --bar-duration: 0.87s; }
.embed-player__bar--21 { --bar-color: #2a6dd6; --bar-low: 0.26; --bar-high: 0.88; --bar-delay: 0.02s; --bar-duration: 0.93s; }
.embed-player__bar--22 { --bar-color: #3a5ccc; --bar-low: 0.38; --bar-high: 1.00; --bar-delay: 0.11s; --bar-duration: 0.99s; }
.embed-player__bar--23 { --bar-color: #5a4cc4; --bar-low: 0.20; --bar-high: 0.76; --bar-delay: 0.08s; --bar-duration: 0.86s; }
.embed-player__bar--24 { --bar-color: #7a3cbc; --bar-low: 0.32; --bar-high: 0.90; --bar-delay: 0.14s; --bar-duration: 1.02s; }
.embed-player__bar--25 { --bar-color: #9b2cb4; --bar-low: 0.24; --bar-high: 0.82; --bar-delay: 0.06s; --bar-duration: 0.92s; }

@keyframes embed-bar-bounce {
  0%   { transform: scaleY(var(--bar-low)); }
  100% { transform: scaleY(var(--bar-high)); }
}

@media (prefers-reduced-motion: reduce) {
  .embed-player__bars-overlay {
    transition: none;
  }
  .embed-player__bar {
    animation: none;
    transform: scaleY(0.6);
  }
}

/* Meta section: h1, slogan, categories (below similar radios) */
.embed-player__meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.embed-player__title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  line-height: 1.2;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.embed-player__slogan {
  color: var(--color-text-muted);
  font-style: italic;
  font-size: var(--font-size-sm);
}

.embed-player__categories {
  font-size: var(--font-size-sm);
  color: var(--color-text);
}

.embed-player__categories-label {
  font-weight: var(--font-weight-semibold);
}

/* Similar radios section */
.embed-similar {
  background: transparent;
}

.embed-similar__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  max-width: 100%;
  padding: 5px;
}

.embed-similar__item {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  text-decoration: none;
  color: inherit;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  min-width: 0;
}

.embed-similar__item:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

.embed-similar__image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
}

.embed-similar__name {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Responsive adjustments for very narrow screens */
@media (max-width: 340px) {
  .embed {
    padding: var(--space-xs);
  }

  .embed-player__play {
    width: 64px;
    height: 64px;
  }

  .embed-player__play-icon {
    width: 30px;
    height: 30px;
  }

  .embed-player__bars-overlay {
    padding: 8px;
  }

  .embed-player__bars {
    gap: 3px;
    height: 58%;
  }

  .embed-player__bar {
    width: 5px;
  }
}
