/* Layout barra único inspirado no YouTube Music */
:root {
  --ym-bg: #1f1f20;
  --ym-border: #2e2f31;
  --ym-text: #f5f5f7;
  --ym-sub: #a8a9ad;
  --ym-accent: #1db954;
  --ym-accent-strong: #169a45;
  --ym-shadow: 0 10px 26px rgba(0, 0, 0, 0.32);
  --ym-radius: 10px;
  --ym-height: 64px;
  --ym-transition: 150ms ease;
  --ym-font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

.ar-player {
  width: 100%;
  min-height: var(--ym-height);
  background: var(--ym-bg);
  border: 1px solid var(--ym-border);
  border-radius: var(--ym-radius);
  color: var(--ym-text);
  font-family: var(--ym-font);
  box-shadow: var(--ym-shadow);
  overflow: hidden;
}

.ar-player.ar-fixed {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  max-width: 1320px;
  border-radius: 10px 10px 0 0;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 60;
}

.ym-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  justify-content: space-between;
}

.ym-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  justify-content: flex-start;
}

/* Controles */
.ym-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ar-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  color: var(--ym-text);
  display: grid;
  place-items: center;
  box-sizing: border-box;
  cursor: pointer;
  transition: background var(--ym-transition), border-color var(--ym-transition), transform var(--ym-transition);
}

.ar-button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.24);
}

.ar-button:active {
  transform: scale(0.97);
}

.ar-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ar-play {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #2dd05a 0%, #1db954 45%, #0f7a37 100%);
  box-shadow: 0 12px 26px rgba(29, 185, 84, 0.35);
}

.ym-icon {
  width: 20px;
  height: 20px;
  background: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  display: block;
}

.ar-play .ym-icon {
  width: 24px;
  height: 24px;
}

.ym-icon-play { mask-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 4.5V19.5L18.5 12L7 4.5Z' fill='white'/%3E%3C/svg%3E"); }
.ym-icon-pause { mask-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.75 5.5H10.5V18.5H7.75V5.5Z' fill='white'/%3E%3Cpath d='M13.5 5.5H16.25V18.5H13.5V5.5Z' fill='white'/%3E%3C/svg%3E"); display: none; }
.ym-icon-prev { mask-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10.5 12L19 6V18L10.5 12Z' fill='white'/%3E%3Cpath d='M5 6V18' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
.ym-icon-next { mask-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13.5 12L5 6V18L13.5 12Z' fill='white'/%3E%3Cpath d='M19 6V18' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
.ym-icon-volume { mask-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 9V15H8L13 20V4L8 9H4Z' fill='white'/%3E%3Cpath d='M16 8C17 9 17.5 10.5 17.5 12C17.5 13.5 17 15 16 16' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M19 5C21 7 22 9.5 22 12C22 14.5 21 17 19 19' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
.ym-icon-mute { mask-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 9V15H8L13 20V4L8 9H4Z' fill='white'/%3E%3Cpath d='M16 8L20 12M20 8L16 12' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); display: none; }
.ym-icon-dislike { mask-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10V4H4V14H7L11 20V10H7Z' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.ym-icon-like { mask-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17 10V4H20V14H17L13 20V10H17Z' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.ym-icon-more { mask-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='5' cy='12' r='2' fill='white'/%3E%3Ccircle cx='12' cy='12' r='2' fill='white'/%3E%3Ccircle cx='19' cy='12' r='2' fill='white'/%3E%3C/svg%3E"); }
.ym-icon-loop { mask-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17 17H6C4.34315 17 3 15.6569 3 14C3 12.3431 4.34315 11 6 11H19M17 17L14 14M17 17L14 20M7 7H18C19.6569 7 21 8.34315 21 10C21 11.6569 19.6569 13 18 13H5M7 7L10 10M7 7L10 4' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.ym-icon-shuffle { mask-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16 3L21 8L16 13' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M4 5H9C11.2091 5 13 6.79086 13 9C13 11.2091 11.2091 13 9 13H4' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M16 21L21 16L16 11' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M4 19H9C11.2091 19 13 17.2091 13 15C13 12.7909 11.2091 11 9 11H4' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
.ym-icon-queue { mask-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='3' y='6' width='18' height='12' rx='2' stroke='white' stroke-width='2'/%3E%3Cpath d='M7 10H17M7 14H13' stroke='white' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }

.ar-playing .ym-icon-play { display: none; }
.ar-playing .ym-icon-pause { display: block; }
.ar-muted .ym-icon-volume { display: none !important; }
.ar-muted .ym-icon-mute { display: block !important; }

/* Meta */
.ym-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ym-cover {
  width: 46px;
  height: 46px;
  border-radius: 6px;
  background: radial-gradient(circle at 35% 35%, var(--ym-accent), #0f7a37 65%);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.34);
}

.ym-cover-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
}

.ym-text {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.ym-title {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ym-sub {
  font-size: 13px;
  color: var(--ym-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Ações */
.ym-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ar-volume {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 170px;
}

.ar-volume-track {
  position: relative;
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  overflow: hidden;
  cursor: pointer;
}

.ar-volume-fill {
  position: absolute;
  inset: 0;
  width: 60%;
  background: linear-gradient(90deg, var(--ym-accent) 0%, var(--ym-accent-strong) 60%, #2dd2ff 100%);
  border-radius: inherit;
  pointer-events: none;
  transition: width 80ms linear;
}

.ar-volume-thumb {
  position: absolute;
  top: 50%;
  left: 60%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid rgba(0, 0, 0, 0.38);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.26);
  pointer-events: none;
  transition: left 80ms linear;
}

.ar-volume input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.ar-mute {
  width: 40px;
  height: 40px;
}

/* Status */
.ar-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  font-size: 13px;
  color: var(--ym-text);
  line-height: 1.2;
  min-width: 0;
}

.ar-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2dd05a;
  box-shadow: 0 0 0 6px rgba(45, 208, 90, 0.18);
}

.ar-status-pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff4fbf 0%, #ff2f8f 100%);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-size: 11px;
  white-space: nowrap;
}

.ar-status-pill:not(.is-live) {
  background: rgba(255, 255, 255, 0.12);
  color: #d8d8dc;
}

.ar-eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
  padding-left: 2px;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.ar-eq span {
  width: 3px;
  background: linear-gradient(180deg, var(--ym-accent) 0%, #1db3ff 100%);
  border-radius: 999px;
  animation: ar-eq-pulse 900ms ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 90ms);
}

.ar-eq span:nth-child(1) { --i: 0; height: 8px; }
.ar-eq span:nth-child(2) { --i: 1; height: 13px; }
.ar-eq span:nth-child(3) { --i: 2; height: 10px; }
.ar-eq span:nth-child(4) { --i: 3; height: 14px; }

.ar-playing .ar-eq {
  opacity: 1;
  transform: translateY(0);
}

@keyframes ar-eq-pulse {
  0%, 100% { transform: scaleY(0.55); }
  50% { transform: scaleY(1); }
}

.ar-state-paused .ar-status-dot,
.ar-state-blocked .ar-status-dot,
.ar-state-error .ar-status-dot {
  background: #a8a9ad;
  box-shadow: 0 0 0 5px rgba(168, 169, 173, 0.12);
}

.ar-state-connecting .ar-status-dot {
  background: #ffc53d;
  box-shadow: 0 0 0 5px rgba(255, 197, 61, 0.2);
}

/* Responsivo */
@media (max-width: 960px) {
  .ym-bar { gap: 10px; }
  .ym-main { gap: 8px; }
  .ym-actions { flex-wrap: nowrap; justify-content: flex-end; }
  .ar-volume { min-width: 0; width: auto; }
}

@media (max-width: 640px) {
  .ar-player { min-height: 62px; }
  .ym-bar { padding: 10px 10px; gap: 6px; }
  .ym-controls { justify-content: flex-start; }
  .ym-main { gap: 8px; }
  .ym-cover {
    width: 40px;
    height: 40px;
  }
  .ym-cover-dot {
    width: 14px;
    height: 14px;
  }
  .ar-status {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    font-size: 11px;
    line-height: 1;
  }
  .ar-status-text { display: none; }
  .ar-status-pill {
    padding: 3px 6px;
    font-size: 9px;
    letter-spacing: 0.2px;
    min-width: 52px;
  }
  .ar-status-dot {
    width: 10px;
    height: 10px;
    min-width: 10px;
    min-height: 10px;
    flex: 0 0 10px;
    box-shadow: 0 0 0 4px rgba(45, 208, 90, 0.18);
  }
  .ar-eq { height: 14px; }
  .ar-status .ar-eq {
    padding-left: 2px;
    height: 14px;
    gap: 2px;
  }
  .ym-actions {
    width: auto;
    justify-content: flex-end;
    gap: 6px;
  }
  .ar-volume {
    position: relative;
    min-width: 0;
  }
  .ar-volume .ym-icon-volume { display: none; }
  .ar-volume-track {
    display: none;
    position: absolute;
    bottom: -46px;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    padding: 8px 10px;
    background: #111216;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    box-shadow: 0 14px 30px rgba(0,0,0,0.45);
    z-index: 5;
  }
  .ar-volume.is-open .ar-volume-track {
    display: block;
  }
  .ar-volume-fill { border-radius: 999px; }
  .ar-volume-thumb { box-shadow: 0 4px 10px rgba(0,0,0,0.3); }
}

/* Hardening para temas que injetam estilos */
[data-rp-root] .ar-button {
  width: 40px !important;
  height: 40px !important;
  padding: 0 !important;
  line-height: 1 !important;
  border-radius: 50% !important;
  box-sizing: border-box !important;
  display: grid !important;
  place-items: center !important;
}
[data-rp-root] .ar-play {
  width: 46px !important;
  height: 46px !important;
  padding: 0 !important;
  border-radius: 50% !important;
}
[data-rp-root] .ar-volume-track { height: 6px !important; }
[data-rp-root] .ar-volume-thumb { width: 14px !important; height: 14px !important; }
