/* =========================================================
   ERADIO PLAYER
   Clean light compact design
   Desktop:
   - station text left
   - prev/play/next centered in controls area
   - favorite/cast near center
   - volume right
   - Skan left, Iepriekš right
   Mobile:
   - station centered
   - controls centered
   - volume hidden
   - Skan row left
   - Iepriekš row left, hidden if no data
   ========================================================= */

.eradio-player {
  width: 100%;
  box-sizing: border-box;
  position: relative;
  z-index: 30;
  margin: 0 auto 1px;
  color: #0f172a;
  overflow: visible;
}

.eradio-player * {
  box-sizing: border-box;
}

.player-section,
.player-inner {
  overflow: visible;
}

.eradio-player + * {
  margin-top: 0;
}

/* =========================================================
   Main shell
   ========================================================= */

.erp-hero {
  width: 100%;
  position: relative;
  z-index: 20;
  overflow: visible;

  border-radius: 18px;
  border: 1px solid rgba(75, 0, 130, 0.08);
  border-bottom: 0;

  background: linear-gradient(180deg, #fbfcff 0%, #e9ecf7 100%);
  box-shadow: 0 10px 28px rgba(27, 22, 67, 0.08);
}

/* =========================================================
   Top row
   ========================================================= */

.erp-top {
  min-height: 86px;

  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(760px, 1fr);
  align-items: center;
  gap: 18px;

  padding: 6px 24px;
  background: transparent;
}

.erp-station {
  min-width: 0;
}

.erp-title {
  font-size: 26px;
  line-height: 1.05;
  font-weight: 800;
  color: #0f172a;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.erp-meta {
  margin-top: 8px;

  font-size: 16px;
  line-height: 1.25;
  color: #6b7280;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================================
   Controls
   ========================================================= */

.erp-controls {
  position: relative;

  width: 100%;
  min-height: 86px;
  padding-right: 240px;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
}

.erp-btn {
  width: 50px;
  height: 50px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  -webkit-appearance: none;
  appearance: none;

  padding: 0;
  margin: 0;

  border: 1px solid rgba(15, 23, 42, 0.045);
  border-radius: 999px;

  color: #8b92a0;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);

  cursor: pointer;

  line-height: 1;
  font-family: inherit;
  vertical-align: middle;

  transition:
    transform 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease,
    opacity 0.15s ease,
    color 0.15s ease;
}

.erp-btn:hover {
  transform: translateY(-1px);
  background: #f7f8fb;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.11);
}

.erp-btn:active {
  transform: translateY(0);
}

.erp-btn svg,
.erp-row-icon svg,
.erp-volume-icon svg,
.erp-play-icon svg {
  display: block;
  flex: 0 0 auto;
  margin: 0;
  transform: translateZ(0);
}

.erp-btn svg,
.erp-row-icon svg,
.erp-volume-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.erp-btn svg {
  width: 23px;
  height: 23px;
}

/* Previous / Next */
.erp-prev svg,
.erp-next svg {
  width: 23px;
  height: 23px;
  stroke-width: 2.6;
}

.erp-prev svg path,
.erp-next svg path {
  fill: currentColor;
  stroke: none;
}

.erp-prev svg line,
.erp-next svg line {
  stroke: currentColor;
  stroke-width: 2.7;
  stroke-linecap: round;
}

.erp-prev.is-disabled,
.erp-next.is-disabled,
.erp-prev:disabled,
.erp-next:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
}

/* Play / Pause */
.erp-play {
  width: 62px;
  height: 62px;
  margin: 0 8px;

  border: 0;

  color: #ffffff;
  background: var(--orange, #ff7a00);

  display: inline-flex;
  align-items: center;
  justify-content: center;

  box-shadow:
    0 0 0 8px rgba(255, 255, 255, 0.98),
    0 0 0 9px rgba(15, 23, 42, 0.04),
    0 10px 20px rgba(244, 122, 0, 0.18);
}

.erp-play:hover {
  transform: translateY(-1px);
  background: var(--orange-dark, #e46600) !important;
  box-shadow:
    0 0 0 8px rgba(255, 255, 255, 0.98),
    0 0 0 9px rgba(15, 23, 42, 0.045),
    0 12px 24px rgba(244, 122, 0, 0.24) !important;
}

.eradio-player.is-playing .erp-play {
  background: var(--orange-dark, #e46600);
}

.eradio-player.is-playing .erp-play:hover {
  background: #d85c00 !important;
}

.erp-play svg {
  stroke: none;
  fill: currentColor;
}

.erp-play-icon {
  width: 32px;
  height: 32px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  line-height: 1;
}

.erp-play-icon svg {
  display: block;
  margin: 0;
}

.erp-play-svg {
  width: 30px !important;
  height: 30px !important;
}

.erp-play-svg-play {
  display: block !important;
}

.erp-play-svg-pause {
  display: none !important;
}

.eradio-player.is-playing .erp-play-svg-play {
  display: none !important;
}

.eradio-player.is-playing .erp-play-svg-pause {
  display: block !important;
}

/* Favorite */
.erp-fav {
  color: #d7dbe3;
}

.erp-fav svg {
  width: 24px;
  height: 24px;
}

.erp-fav svg path {
  fill: currentColor;
  stroke: none;
}

.erp-fav.is-fav,
.erp-fav[aria-pressed="true"] {
  color: #e33a62;
}

.erp-fav:hover {
  background: #f7f8fb;
}

/* Chromecast & Airplay*/
.erp-cast {
  color: #b7bdc8;
  opacity: 1;
}

.erp-cast svg {
  width: 23px;
  height: 23px;
  display: block;
  stroke-width: 2.2 !important;
  transform: translateY(-0.5px);
}

.erp-cast.is-cast-loading {
  color: #9aa1af;
  cursor: wait;
}

.erp-cast.is-cast-unavailable,
.erp-cast:disabled {
  color: #d5d9e1;
  cursor: not-allowed;
  filter: none;
}

.erp-cast.is-cast-available {
  color: #6f7684;
}

.erp-cast.is-cast-connecting,
.erp-cast.is-cast-connected {
  color: var(--orange, #ff7a00);
}

.erp-cast.is-cast-connected {
  background: #ffffff;
  box-shadow:
    0 0 0 2px rgba(255, 122, 0, 0.28),
    0 8px 22px rgba(15, 23, 42, 0.08);
}

.erp-cast.is-airplay.is-cast-available {
  color: rgba(17, 24, 39, 0.88);
  opacity: 1;
}

.erp-cast.is-airplay.is-cast-unavailable {
  opacity: 0.42;
}

/* =========================================================
   Volume
   ========================================================= */

.erp-volume-row {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);

  min-width: 220px;
  margin-left: 0;

  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.erp-volume-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  position: relative;
  top: -1px;

  color: #9aa1af;
  line-height: 1;

  background: transparent;
  border: 0;
  box-shadow: none;
}

.erp-volume-icon svg {
  width: 25px;
  height: 25px;
  stroke-width: 2.4;
}

.erp-volume {
  --erp-volume-pct: 100%;

  appearance: none;
  -webkit-appearance: none;

  width: 150px;
  max-width: 150px;
  height: 6px;

  margin: 0;
  padding: 0;

  border: 0;
  border-radius: 999px;
  outline: none;

  background: linear-gradient(
    to right,
    var(--orange, #ff7a00) 0%,
    var(--orange, #ff7a00) var(--erp-volume-pct),
    #d9dde6 var(--erp-volume-pct),
    #d9dde6 100%
  );

  cursor: pointer;
}

@media (max-width: 700px) {
  .erp-volume-row {
    display: none !important;
  }
}

/* Chrome / Edge / Safari */
.erp-volume::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: transparent;
}

.erp-volume::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;

  width: 18px;
  height: 18px;

  margin-top: -6px;

  border: 0;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.18);

  cursor: pointer;
}

/* Firefox */
.erp-volume::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: transparent;
}

.erp-volume::-moz-range-thumb {
  width: 18px;
  height: 18px;

  border: 0;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.18);

  cursor: pointer;
}

/* =========================================================
   Now playing row
   ========================================================= */

.erp-now-row {
  min-height: 42px;

  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "now history"
    "panel panel";

  align-items: center;
  gap: 0 12px;

  width: 100%;
  padding: 7px 24px;

  position: relative;
  overflow: visible;

  border-top: 1px solid rgba(75, 0, 130, 0.08);
  border-bottom: 0;

  background: linear-gradient(
    180deg,
    #e9ecf7 0%,
    #eef0f6 60%,
    #f3f4f8 100%
  );
}

.eradio-player:not(.is-history-open) .erp-now-row {
  padding-bottom: 7px;
}

.eradio-player.is-history-open .erp-now-row {
  padding-bottom: 0;
}

.erp-now {
  grid-area: now;

  width: 100%;
  min-width: 0;
  max-width: 100%;

  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;

  font-size: 17px;
  line-height: 1;
  color: #111827;

  white-space: nowrap;
  overflow: hidden;
}

.erp-history-wrap {
  grid-area: history;

  width: 100%;
  min-width: 0;
  max-width: 100%;

  display: flex;
  align-items: center;
  justify-content: flex-end;
  overflow: hidden;
}

.erp-history {
  width: 100%;
  min-width: 0;
  max-width: 100%;

  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;

  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;

  font: inherit;
  font-size: 17px;
  line-height: 1;
  color: #111827;
  text-align: right;

  white-space: nowrap;
  overflow: hidden;
}

.erp-row-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  margin-right: 6px;
}

.erp-now strong,
.erp-history strong {
  flex: 0 0 auto;
  color: #111827;
  font-weight: 700;
  line-height: 1;
  margin-right: 10px;
}

.erp-nowplaying,
.erp-history-text {
  display: inline-block;
  min-width: 0;

  color: #111827;
  font-weight: 400;
  line-height: 1;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.erp-nowplaying {
  max-width: 100%;
}

.erp-history-text {
  max-width: 100%;
}

.erp-history-arrow {
  flex: 0 0 auto;
  color: #8f96a3;
  opacity: 0.85;
  margin-left: 8px;
}

.erp-now-icon {
  color: var(--orange, #ff7a00);
}

.erp-history-icon {
  color: #8f96a3;
}

.erp-now-icon svg,
.erp-history-icon svg {
  display: block;
  width: 23px;
  height: 23px;
}

.erp-now-icon svg {
  stroke-width: 2.8;
}

.erp-history-icon svg,
.erp-history-icon svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2 !important;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.erp-history-wrap[hidden],
.erp-history[hidden],
.erp-history-panel[hidden] {
  display: none !important;
}

/* No history: only Skan row */
.eradio-player.no-history .erp-now-row {
  grid-template-areas:
    "now now"
    "panel panel";
}

/* =========================================================
   History panel
   ========================================================= */

.erp-history-panel {
  grid-area: panel;
  grid-column: 1 / -1;

  position: static;
  z-index: 3;

  width: calc(100% + 48px);
  margin: 8px -24px 6px;

  max-height: none;
  overflow: hidden;

  color: #111827;

  background: linear-gradient(
    180deg,
    #eef1fb 0%,
    #e7ebf8 100%
  );

  border-top: 1px solid rgba(75, 0, 130, 0.12);
  border-bottom: 0;
  border-radius: 0 0 18px 18px;

  box-shadow:
    0 8px 18px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

/* Smalka oranža akcenta līnija augšā */
.erp-history-panel::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--orange, #ff7a00),
    rgba(255, 122, 0, 0.25)
  );
}

/* Nelietojam after, lai nesabojā apakšējo noapaļojumu */
.erp-history-panel::after {
  content: none;
  display: none;
}

.erp-history-list {
  width: 100%;
}

.erp-history-item {
  min-height: 34px;
  padding: 6px 14px;

  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;

  border-bottom: 1px solid rgba(75, 0, 130, 0.10);

  font-size: 16px;
  line-height: 1.25;

  background: rgba(255, 255, 255, 0.12);
}

.erp-history-item:hover {
  background: rgba(255, 255, 255, 0.32);
}

.erp-history-time {
  font-size: 13px;
  font-weight: 800;
  color: rgba(17, 24, 39, 0.55);
}

.erp-history-song {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.erp-history-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.erp-history-link {
  width: 21px;
  height: 21px;

  flex: 0 0 auto;

  display: inline-grid;
  place-items: center;

  text-decoration: none;
  color: #5b6170;
  background: transparent;
  opacity: 0.9;
}

.erp-history-link:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.erp-history-link svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* YouTube: grey shape + white play */
.erp-history-youtube svg path:first-child {
  fill: #5b6170;
}

.erp-history-youtube svg path:nth-child(2) {
  fill: #ffffff;
}

/* Spotify: grey circle + white lines */
.erp-history-spotify svg path:first-child {
  fill: #5b6170;
}

.erp-history-spotify svg path:nth-child(2) {
  fill: #ffffff;
}

/* Footer: "Kas skanēja..." */
.erp-history-foot {
  padding: 11px 14px 13px;

  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.18) 0%,
    rgba(255, 255, 255, 0.08) 100%
  );

  border-top: 1px solid rgba(75, 0, 130, 0.10);
  border-radius: 0 0 18px 18px;
  overflow: hidden;
}

.erp-history-more-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;

  color: #5b6170;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
}

.erp-history-more-link:hover {
  color: var(--orange-dark, #e46600);
  text-decoration: none;
}

/* Ja nav datu */
.erp-history-empty {
  padding: 13px 14px;
  font-size: 14px;
  color: rgba(17, 24, 39, 0.68);
}

/* =========================================================
   Now playing equalizer animation
   ========================================================= */

.erp-now-icon svg path {
  transform-box: fill-box;
  transform-origin: center;
}

.eradio-player.is-playing .erp-now-icon svg path {
  animation-name: erpEqualizerPulse;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}

.eradio-player.is-playing .erp-now-icon svg path:nth-child(1) { animation-duration: 1.9s; }
.eradio-player.is-playing .erp-now-icon svg path:nth-child(2) { animation-duration: 2.2s; }
.eradio-player.is-playing .erp-now-icon svg path:nth-child(3) { animation-duration: 2.0s; }
.eradio-player.is-playing .erp-now-icon svg path:nth-child(4) { animation-duration: 2.35s; }
.eradio-player.is-playing .erp-now-icon svg path:nth-child(5) { animation-duration: 2.15s; }

.eradio-player:not(.is-playing) .erp-now-icon svg path {
  animation: none;
  transform: scaleY(1);
}

@keyframes erpEqualizerPulse {
  0% {
    transform: scaleY(0.45);
    opacity: 0.75;
  }

  35% {
    transform: scaleY(1);
    opacity: 1;
  }

  70% {
    transform: scaleY(0.62);
    opacity: 0.85;
  }

  100% {
    transform: scaleY(0.45);
    opacity: 0.75;
  }
}

/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 700px) {
  .eradio-player {
    margin-bottom: 1px;
  }

  .erp-hero {
    border-radius: 16px;
    overflow: hidden;
  }

  .erp-top {
    min-height: 0;

    grid-template-columns: 1fr !important;
    justify-items: center !important;
    gap: 10px;

    padding: 14px 12px 12px;
  }

  .erp-station {
    width: 100%;
    max-width: 100%;
    text-align: center;
  }

  .erp-title {
    font-size: 21px;
    line-height: 1.12;
    text-align: center;
  }

  .erp-meta {
    margin-top: 5px;
    font-size: 14px;
    text-align: center;
  }

  .erp-controls {
    position: static !important;

    width: 100% !important;
    min-height: 0 !important;

    padding-right: 0 !important;
    margin: 0 auto !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 9px !important;
  }

  .erp-volume-row {
    display: none !important;
  }

  .erp-btn {
    width: 43px;
    height: 43px;
  }

  .erp-btn svg {
    width: 21px;
    height: 21px;
  }

  .erp-play {
    width: 50px;
    height: 50px;
    margin: 0 4px;

    box-shadow:
      0 0 0 6px rgba(255, 255, 255, 0.98),
      0 0 0 7px rgba(15, 23, 42, 0.04),
      0 8px 16px rgba(244, 122, 0, 0.16);
  }

  .erp-play-icon {
    width: 28px;
    height: 28px;
  }

  .erp-play-svg {
    width: 23px !important;
    height: 23px !important;
  }

  .erp-now-row {
    min-height: 34px;

    grid-template-columns: 1fr;
    grid-template-areas:
      "now"
      "history"
      "panel";

    gap: 6px;

    padding: 8px 12px;
    justify-items: stretch;
  }

  .eradio-player:not(.is-history-open) .erp-now-row {
    padding-bottom: 8px;
  }

  .eradio-player.no-history .erp-now-row {
    grid-template-areas:
      "now"
      "panel";
    gap: 0;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .erp-now {
    width: 100%;

    justify-content: flex-start !important;
    text-align: left !important;

    font-size: 15px;
    line-height: 1;
  }

  .erp-history-wrap {
    width: 100%;

    display: flex;
    justify-content: flex-start !important;
  }

  .erp-history {
    width: 100%;

    justify-content: flex-start !important;
    text-align: left !important;

    font-size: 15px;
    line-height: 1;
  }

  .erp-nowplaying,
  .erp-history-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .erp-nowplaying {
    max-width: 65vw;
  }

  .erp-history-text {
    max-width: 58vw;
  }

  .erp-row-icon {
    width: 23px;
    height: 23px;
  }

  .erp-now-icon svg,
  .erp-history-icon svg {
    width: 22px;
    height: 22px;
  }

  .erp-history-panel {
    width: calc(100% + 24px);
    margin: 8px -12px 5px;
    border-radius: 0 0 16px 16px;
  }

  .erp-history-foot {
    border-radius: 0 0 16px 16px;
  }

  .erp-history-item {
  min-height: 36px;
  padding: 7px 10px;

  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 5px;
  font-size: 14px;
}

  .erp-history-time {
    font-size: 12px;
  }

  .erp-history-link {
    width: 20px;
    height: 20px;
  }

  .erp-history-link svg {
    width: 19px;
    height: 19px;
  }
}

/* =========================================================
   Very small phones
   ========================================================= */

@media (max-width: 380px) {
  .erp-controls {
    gap: 7px !important;
  }

  .erp-btn {
    width: 39px;
    height: 39px;
  }

  .erp-play {
    width: 50px;
    height: 50px;
    margin: 0 2px;
  }

  .erp-title {
    font-size: 19px;
  }

  .erp-nowplaying {
    max-width: 52vw;
  }

  .erp-history-text {
    max-width: 50vw;
  }
}

/* =========================================================
   Player inside radio-shell
   Rounded integrated card
   ========================================================= */

.radio-shell .eradio-player {
  margin: 0 0 12px;
  border-radius: 18px;
  overflow: visible;
}

.radio-shell .erp-hero {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(75, 0, 130, 0.08);
  box-shadow: 0 8px 22px rgba(27, 22, 67, 0.08);
}

.radio-shell .erp-history-panel {
  margin-bottom: 0;
  border-radius: 0 0 18px 18px;
}

.radio-shell .eradio-player.is-history-open .erp-now-row {
  border-radius: 0;
}

.radio-shell .eradio-player.is-history-open .erp-history-panel {
  box-shadow: none;
}

@media (max-width: 700px) {
  .radio-shell .eradio-player {
    margin-bottom: 10px;
    border-radius: 16px;
  }

  .radio-shell .erp-hero {
    border-radius: 16px;
    overflow: hidden;
  }

  .radio-shell .erp-history-panel {
    border-radius: 0 0 16px 16px;
  }
}