/**
 * Reproductor basado en la vista de Mardel_Prog.html
 * @package  Joomla.Site
 * @license  GPL-3.0-or-later
 */

@property --neon-ang {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

.mrp {
  --neon: #00ff00;
  box-sizing: border-box;
  display: inline-block;
  max-width: 100%;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.2;
  color: #fff;
}

.mrp *,
.mrp *::before,
.mrp *::after { box-sizing: border-box; }

.mrp [hidden] { display: none !important; }

/* ============ WIDGET ============ */
.mrp-widget {
  width: 350px;
  max-width: 100%;
  min-height: 176px;
  background-color: #000;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
  display: flex;
  align-items: stretch;
  overflow: visible;
  position: relative;
}

/* Marco neón giratorio */
.mrp-widget::before {
  content: "";
  position: absolute;
  --nw: 4px;
  inset: calc(var(--nw) * -1);
  border-radius: calc(16px + var(--nw));
  padding: var(--nw);
  background-color: color-mix(in srgb, var(--neon) 18%, transparent);
  background-image: conic-gradient(
    from var(--neon-ang, 0deg),
    color-mix(in srgb, var(--neon) 0%, transparent) 0deg,
    color-mix(in srgb, var(--neon) 45%, transparent) 52deg,
    var(--neon) 90deg,
    rgba(0, 0, 0, 0) 90.6deg,
    rgba(0, 0, 0, 0) 360deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: mrpNeonRingSpin 4s linear infinite;
  pointer-events: none;
  z-index: 2;
}

@keyframes mrpNeonRingSpin { to { --neon-ang: 360deg; } }

/* ============ CARÁTULA ============ */
.mrp-thumb {
  width: 150px;
  flex: 0 0 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 15px 0 0 15px;
  overflow: hidden;
  background: #1a1a2e;
}

.mrp-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
  display: block;
}

/* ============ LATERAL ============ */
.mrp-side {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px;
}

.mrp-rname {
  width: 100%;
  font-size: 14px;
  font-weight: 700;
  color: #f1f1f1;
  line-height: 1.15;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mrp-rname.is-live {
  color: #22c55e;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.mrp-side .mrp-play {
  position: relative;
  background: #7c3aed;
  border: none;
  color: #fff;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s, box-shadow .15s;
}

.mrp-side .mrp-play:hover { transform: scale(1.08); box-shadow: 0 4px 14px rgba(124, 58, 237, .6); }
.mrp-side .mrp-play:focus-visible { outline: 2px solid var(--neon); outline-offset: 4px; }

.mrp-side .mrp-play::before {
  content: "";
  position: absolute;
  --nw: 4px;
  inset: calc(var(--nw) * -1);
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    color-mix(in srgb, var(--neon) 0%, transparent) 0deg,
    color-mix(in srgb, var(--neon) 45%, transparent) 52deg,
    var(--neon) 90deg,
    rgba(0, 0, 0, 0) 90.6deg,
    rgba(0, 0, 0, 0) 360deg
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--nw)), #000 calc(100% - var(--nw) + .2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - var(--nw)), #000 calc(100% - var(--nw) + .2px));
  opacity: 0;
  transition: opacity .25s ease;
  animation: mrpNeonSpin 2.2s linear infinite;
  animation-play-state: paused;
  pointer-events: none;
}

.mrp-side .mrp-play::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 7px color-mix(in srgb, var(--neon) 50%, transparent);
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}

.mrp.is-playing .mrp-side .mrp-play::before { opacity: 1; animation-play-state: running; }
.mrp.is-playing .mrp-side .mrp-play::after { opacity: 1; animation: mrpNeonPulse 1.8s ease-in-out infinite; }

@keyframes mrpNeonSpin { to { transform: rotate(360deg); } }
@keyframes mrpNeonPulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .mrp-widget::before,
  .mrp.is-playing .mrp-side .mrp-play::before { animation: none; }
  .mrp.is-playing .mrp-side .mrp-play::after { animation: none; opacity: 1; }
}

/* ============ VOLUMEN ============ */
.mrp-side .mrp-vol {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px 0 10px;
}

.mrp-side .mrp-volbtn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: #f1f1f1;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  transition: transform .15s, color .15s;
}

.mrp-side .mrp-volbtn:hover { transform: scale(1.15); }

.mrp-side .mrp-volrange {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-width: 0;
  height: 4px;
  margin: 0;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  background: linear-gradient(
    to right,
    var(--neon) var(--vol, 80%),
    rgba(255, 255, 255, .18) var(--vol, 80%)
  );
}

.mrp-side .mrp-volrange::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: var(--neon);
  box-shadow: 0 0 6px rgba(0, 0, 0, .55);
  cursor: pointer;
}

.mrp-side .mrp-volrange::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: var(--neon);
  box-shadow: 0 0 6px rgba(0, 0, 0, .55);
  cursor: pointer;
}

.mrp-side .mrp-volrange::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: transparent;
}

.mrp-side .mrp-volpct {
  flex: 0 0 auto;
  min-width: 30px;
  text-align: right;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  color: var(--neon);
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.mrp-side .mrp-rartist {
  width: 100%;
  font-size: 14px;
  font-weight: 600;
  color: var(--neon);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============ TOOLTIP ============ */
.mrp-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  width: 280px;
  background: rgba(20, 18, 45, .98);
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .6);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  z-index: 50;
}

.mrp-widget:hover .mrp-tooltip { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

.mrp-tooltip img {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border-radius: 10px;
  margin: 0 auto 10px;
  display: block;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .5);
}

.mrp-tt-title { font-size: 15px; font-weight: 700; line-height: 1.2; margin-bottom: 3px; }
.mrp-tt-artist { font-size: 13px; color: #b3b3cc; }
.mrp-tt-status { font-size: 12px; color: #7dd3fc; margin-top: 10px; }

/* ============ CONTROLES EXTRA / LISTA ============ */
.mrp-extra {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 12px;
}

.mrp-extra--hidden { display: none; }

.mrp-mini,
.mrp-retry {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 6px;
  background: #181818;
  color: #f1f1f1;
  font: inherit;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.mrp-mini:hover,
.mrp-retry:hover { border-color: var(--neon); color: var(--neon); }
.mrp-mini:focus-visible,
.mrp-retry:focus-visible { outline: 2px solid var(--neon); outline-offset: 2px; }

.mrp-playlist {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(127, 127, 127, .3);
  max-width: 350px;
}

.mrp-playlist-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #9e9e9e;
  margin-bottom: 4px;
}

.mrp-playlist-list {
  max-height: 170px;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mrp-track {
  display: block;
  width: 100%;
  padding: 5px 7px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #cfcfcf;
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.mrp-track:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.mrp-track.is-active { color: var(--neon); font-weight: 600; background: rgba(255, 255, 255, .1); }
.mrp-track:focus-visible { outline: 2px solid var(--neon); outline-offset: -2px; }

@media (max-width: 400px) {
  .mrp-widget { width: 100%; }
  .mrp-thumb { width: 110px; flex-basis: 110px; }
  .mrp-tooltip { width: 240px; }
}
