/* ════════════════════════════════════════════════════════════════
   AUDIO PLAYER — .ap-* névtér (audio player)
   Drop-in, önálló, vanilla JS, illeszkedik az ef-v3 stílushoz
═══════════════════════════════════════════════════════════════════ */

/* ── INDÍTÓ GOMB stílusa (a tartalomban használható) ─────── */
.ap-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 10px;
  background: var(--bg-tint);
  border: 1px solid var(--line-2);
  border-radius: 99px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--text);
  text-transform: uppercase;
  transition: all 0.25s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.ap-trigger:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--bg);
}
.ap-trigger.is-playing {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--bg);
}
.ap-trigger-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  flex-shrink: 0;
  transition: background 0.25s var(--ease-out);
}
.ap-trigger.is-playing .ap-trigger-icon {
  background: var(--bg);
  color: var(--gold);
}
.ap-trigger-icon svg { width: 9px; height: 9px; }

/* ── LEBEGŐ NYITÓGOMB (jobb alsó sarok) ──────────────────── */
.ap-fab {
  position: fixed;
  right: 28px;
  /*left:50%;*/
  /*transform:translate(-50%,0);*/
  bottom: 20px;
  z-index: 9997;
  display: flex;
  align-items: center;
  gap: 0;
  height: 56px;
  padding: 0;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 99px;
  cursor: pointer;
  box-shadow:
    0 4px 12px rgba(20, 18, 14, 0.18),
    0 12px 32px -8px rgba(20, 18, 14, 0.28);
  transition: all 0.45s var(--ease-out);
  overflow: hidden;
  font-family: var(--font-mono);
  -webkit-tap-highlight-color: transparent;
}
@media (max-width: 720px) {

.ap-fab {
  position: fixed;
  right: 28px;
  left:auto;
  transform:translate(0,0);
  bottom: 20px;
}

}
.ap-fab:hover {
  background: var(--gold);
  color: var(--bg);
  /*transform: translateY(-2px);*/
  box-shadow:
    0 6px 16px rgba(201, 164, 100, 0.30),
    0 16px 40px -8px rgba(201, 164, 100, 0.35);
}
.ap-fab.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.9);
}

/* Kör-ikon rész (mindig látszik) */
.ap-fab-disc {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.ap-fab-disc svg { width: 20px; height: 20px; }

/* Apró ekvalizer a lemezen amikor játszik valami */
.ap-fab-eq {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
}
.ap-fab.is-playing .ap-fab-eq { display: flex; }
.ap-fab.is-playing .ap-fab-disc-icon { display: none; }
.ap-fab-eq i {
  width: 2.5px;
  background: currentColor;
  border-radius: 1px;
  animation: apEq 0.9s ease-in-out infinite;
}
.ap-fab-eq i:nth-child(1) { height: 40%; animation-delay: 0s; }
.ap-fab-eq i:nth-child(2) { height: 90%; animation-delay: 0.15s; }
.ap-fab-eq i:nth-child(3) { height: 60%; animation-delay: 0.3s; }
.ap-fab-eq i:nth-child(4) { height: 100%; animation-delay: 0.45s; }
@keyframes apEq {
  0%, 100% { transform: scaleY(0.4); }
  50%      { transform: scaleY(1); }
}

/* Kibomló szöveg-rész */
.ap-fab-label {
  max-width: 0;
  opacity: 0;
  white-space: nowrap;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: max-width 0.45s var(--ease-out), opacity 0.35s var(--ease-out), padding 0.45s var(--ease-out);
  overflow: hidden;
}
.ap-fab:hover .ap-fab-label,
.ap-fab.is-playing .ap-fab-label {
  max-width: 200px;
  opacity: 1;
  padding-right: 24px;
}
.ap-fab-label b {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  text-transform: none;
  font-size: 15px;
  letter-spacing: 0;
}

@media (max-width: 480px) {
  .ap-fab { right: 16px; bottom: 16px; }
}

/* ── BACKDROP (mobilon teljesen, desktopon csak alig) ────── */
.ap-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  z-index: 9998;
  pointer-events: none;
  transition: background 0.5s var(--ease-out), backdrop-filter 0.5s var(--ease-out);
}
.ap-backdrop.is-open {
  pointer-events: all;
  background: rgba(20, 18, 14, 0.08);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
@media (max-width: 720px) {
  .ap-backdrop.is-open {
    background: rgba(20, 18, 14, 0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }
}

/* ── A PANEL ──────────────────────────────────────────── */
.ap-panel {
  position: fixed;
  top: 0; right: 0;
  bottom: 0;
  width: 400px;
  max-width: 100vw;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background: var(--bg-rgba);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border-left: 1px solid var(--line);
  box-shadow:
    -8px 0 24px -8px rgba(20, 18, 14, 0.08),
    -24px 0 64px -24px rgba(20, 18, 14, 0.10);
  transform: translateX(105%);
  transition: transform 0.55s var(--ease-out);
  font-family: var(--font-ui);
  color: var(--text);
}
[data-theme="dark"] .ap-panel {
  box-shadow: -8px 0 32px -8px rgba(0, 0, 0, 0.5);
}

@media (max-width: 768px) {
.ap-panel {
}
}

.ap-panel.is-open {
  transform: translateX(0);
}

@media (max-width: 480px) {
  .ap-panel { width: 100vw; }
}

/* ── FELSŐ FEJLÉC ─────────────────────────────────────── */
.ap-header {
  flex-shrink: 0;
  padding: 22px 24px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.ap-header-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.ap-header-title::before {
  content: '';
  width: 7px; height: 7px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--gold-glow);
  animation: apPulse 2.2s ease-in-out infinite;
}
@keyframes apPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.1); }
}
.ap-header-title b {
  color: var(--text);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 18px;
  letter-spacing: 0;
  text-transform: none;
}

.ap-close {
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-3);
  border-radius: 50%;
  transition: all 0.25s var(--ease-out);
}
.ap-close:hover {
  background: var(--bg-tint);
  color: var(--text);
}
.ap-close svg { width: 16px; height: 16px; }

/* ── COUNT / META sor ─────────────────────────────────── */
.ap-meta {
  flex-shrink: 0;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--line);
}
.ap-meta b {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
  letter-spacing: 0;
  color: var(--text);
  text-transform: none;
  margin-right: 4px;
}

/* ── LISTA RÉSZ (scrollable) ─────────────────────────── */
.ap-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
.ap-list::-webkit-scrollbar { width: 4px; }
.ap-list::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 2px; }

.ap-track {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 24px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all 0.25s var(--ease-out);
  position: relative;
}
.ap-track:hover {
  background: var(--bg-tint);
}
.ap-track.is-active {
  background: var(--bg-tint);
  border-left-color: var(--gold);
}

/* Szám / play ikon — hover/active-re play-re vált */
.ap-track-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}
.ap-track-num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-3);
  transition: opacity 0.2s;
}
.ap-track-play-icon,
.ap-track-pause-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s var(--ease-out);
  color: var(--gold);
}
.ap-track-play-icon svg,
.ap-track-pause-icon svg { width: 14px; height: 14px; }

.ap-track:hover .ap-track-num     { opacity: 0; }
.ap-track:hover .ap-track-play-icon { opacity: 1; }

.ap-track.is-active .ap-track-num { opacity: 0; }
.ap-track.is-active .ap-track-play-icon { opacity: 1; }
.ap-track.is-active.is-playing .ap-track-play-icon  { opacity: 0; }
.ap-track.is-active.is-playing .ap-track-pause-icon { opacity: 1; }
.ap-track.is-active.is-playing:hover .ap-track-play-icon  { opacity: 0; }
.ap-track.is-active.is-playing:hover .ap-track-pause-icon { opacity: 1; }

/* "Equalizer" mini-animáció amikor a track éppen játszik */
.ap-track.is-active.is-playing .ap-track-num { display: none; }
.ap-track-eq {
  display: none;
  gap: 2px;
  align-items: flex-end;
  height: 14px;
}
.ap-track.is-active.is-playing .ap-track-eq {
  display: none; /* override kikapcsolva — a pause ikon dominál */
}

.ap-track-info {
  min-width: 0;
}
.ap-track-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ap-track.is-active .ap-track-title {
  font-style: italic;
  color: var(--gold);
}
.ap-track-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ap-track-duration {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
}

/*visual*/


/* ── REAKTÍV VIZUALIZÁCIÓ (SiriWave-szerű) ───────────── */
.ap-viz {
  position: relative;
  flex-shrink: 0;
  height: 0;
  overflow: hidden;
  background: var(--bg-tint);
  border-top: 1px solid var(--line);
  transition: height 0.5s var(--ease-out);
}
[data-theme="dark"] .ap-viz { background: var(--bg-deep); }
.ap-viz.is-active { height: 92px; }
.ap-viz canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
/* halvány fade a két szélén, hogy beleolvadjon */
.ap-viz::before,
.ap-viz::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 48px;
  z-index: 2;
  pointer-events: none;
}
.ap-viz::before { left: 0;  background: linear-gradient(to right, var(--bg-tint), transparent); }
.ap-viz::after  { right: 0; background: linear-gradient(to left,  var(--bg-tint), transparent); }
[data-theme="dark"] .ap-viz::before { background: linear-gradient(to right, var(--bg-deep), transparent); }
[data-theme="dark"] .ap-viz::after  { background: linear-gradient(to left,  var(--bg-deep), transparent); }

/* ── PLAYER (alsó fix rész) ─────────────────────────── */
.ap-player {
  flex-shrink: 0;
  padding: 22px 24px 26px;
  border-top: 1px solid var(--line);
  /*background: linear-gradient(to bottom, var(--bg) 0%, var(--bg-tint) 100%);*/
}
[data-theme="dark"] .ap-player {
  /*background: linear-gradient(to bottom, var(--bg) 0%, var(--bg-deep) 100%);*/
}

/* Currently playing track info */
.ap-now {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.ap-now-art {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 4px;
  background:
    linear-gradient(135deg,
      var(--gold-light) 0%,
      var(--bg-tint) 50%,
      var(--bg-deep) 100%);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.ap-now-art::before {
  content: '';
  position: absolute;
  inset: 12px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  opacity: 0.4;
}
.ap-now-art::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--gold);
  border-radius: 50%;
}
.ap-now-art.is-spinning::before {
  animation: apSpin 8s linear infinite;
}
@keyframes apSpin { to { transform: rotate(360deg); } }

.ap-now-info {
  flex: 1;
  min-width: 0;
}
.ap-now-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ap-now-sub {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── PROGRESS BAR (waveform-szerű) ──────────────────── */
.ap-progress {
  margin-bottom: 14px;
}

.ap-wave {
  position: relative;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 2px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Egy bar */
.ap-wave-bar {
  flex: 1;
  background: var(--line-2);
  border-radius: 1px;
  transition: background 0.15s var(--ease-out);
  min-height: 3px;
}
.ap-wave-bar.is-played {
  background: var(--text);
}
.ap-wave-bar.is-current {
  background: var(--gold);
}
.ap-wave:hover .ap-wave-bar:not(.is-played):not(.is-current) {
  background: var(--text-3);
}

.ap-time {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  letter-spacing: 0.5px;
}
.ap-time-current { color: var(--text); }

/* ── CONTROLS ─────────────────────────────────────── */
.ap-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.ap-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-2);
  border-radius: 50%;
  transition: all 0.2s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.ap-btn:hover {
  background: var(--bg-deep);
  color: var(--text);
}
.ap-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.ap-btn:disabled:hover { background: transparent; color: var(--text-2); }
.ap-btn svg { width: 18px; height: 18px; }

/* Play/Pause — főgomb */
.ap-btn-play {
  width: 56px;
  height: 56px;
  background: var(--text);
  color: var(--bg);
  margin: 0 8px;
  position: relative;
  overflow: hidden;
}
.ap-btn-play:hover {
  background: var(--gold);
  color: var(--bg);
  transform: scale(1.04);
}
.ap-btn-play svg { width: 18px; height: 18px; }
.ap-btn-play.is-loading::after {
  content: '';
  position: absolute;
  inset: 4px;
  border: 2px solid transparent;
  border-top-color: var(--bg);
  border-right-color: var(--bg);
  border-radius: 50%;
  animation: apLoading 0.7s linear infinite;
}
.ap-btn-play.is-loading svg { opacity: 0; }
@keyframes apLoading { to { transform: rotate(360deg); } }

/* Alsó vékony funkció-sor: speed, volume */
.ap-extras {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ap-speed {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ap-speed-btn {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.5px;
  padding: 5px 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-3);
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.2s var(--ease-out);
}
.ap-speed-btn:hover { color: var(--text); }
.ap-speed-btn.is-active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.ap-volume {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  justify-content: flex-end;
  max-width: 140px;
}
.ap-volume-icon {
  flex-shrink: 0;
  color: var(--text-3);
  display: flex;
}
.ap-volume-icon svg { width: 16px; height: 16px; }
.ap-volume-slider {
  flex: 1;
  height: 2px;
  background: var(--line-2);
  position: relative;
  cursor: pointer;
  border-radius: 1px;
}
.ap-volume-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--text);
  border-radius: 1px;
  transition: background 0.2s;
}
.ap-volume:hover .ap-volume-fill { background: var(--gold); }

/* Üres állapot — ha nincs track */
.ap-empty {
  flex: 1;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 40px 32px;
  color: var(--text-3);
  font-family: var(--font-display);
  font-style: italic;
}
.ap-empty.is-visible { display: flex; }
.ap-empty-icon {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--bg-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  color: var(--text-3);
}
.ap-empty-icon svg { width: 22px; height: 22px; }
