/* ═══════════════════════════════════════════════════════════
   JustStayMe — Global Player  (player.css)
   ═══════════════════════════════════════════════════════════ */

/* ── Переменные (наследуем из base.html, дублируем fallback) ── */
:root {
  --jsmp-h-mobile: 130px;   /* высота плеера на мобиле (для padding-bottom) */
  --jsmp-accent:   #f36;
  --jsmp-accent2:  #ff5c85;
  --jsmp-grad:     linear-gradient(135deg, #f36, #ff5c85);
}

/* ── Обёртка ── */
#jsm-player {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(10px + 62px + 8px); /* над mobile-nav */
  z-index: 9995;

  background: color-mix(in oklab, oklch(13% 0.025 262) 97%, transparent);
  backdrop-filter: blur(32px) saturate(200%);
  -webkit-backdrop-filter: blur(32px) saturate(200%);

  border: 1px solid rgba(255, 255, 255, .09);
  border-top: 1px solid rgba(255, 255, 255, .15);
  border-radius: 22px;
  box-shadow:
    0 -1px 0 rgba(255,255,255,.07) inset,
    0 24px 64px rgba(0, 0, 0, .75),
    0 0 0 1px rgba(243, 54, 102, .1);

  padding: 10px 14px 14px;
  display: none;             /* показываем через JS */
  flex-direction: column;
  gap: 8px;

  animation: jsmp-slide-in .38s cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes jsmp-slide-in {
  from { transform: translateY(28px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* На десктопе — компактная карточка справа снизу */
@media (min-width: 768px) {
  #jsm-player {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: 360px;
    border-radius: 24px;
    padding: 12px 16px 16px;
  }
}

/* ── Прогресс-бар ── */
.jsmp-prog {
  cursor: pointer;
  padding: 6px 0 2px;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

.jsmp-prog-track {
  position: relative;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  transition: height .18s ease;
}

.jsmp-prog:hover .jsmp-prog-track,
.jsmp-prog.is-dragging .jsmp-prog-track {
  height: 5px;
}

.jsmp-prog-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: var(--jsmp-grad);
  width: 0%;
  pointer-events: none;
}

.jsmp-prog-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.55);
  opacity: 0;
  transition: opacity .18s;
  pointer-events: none;
}

.jsmp-prog:hover .jsmp-prog-thumb,
.jsmp-prog.is-dragging .jsmp-prog-thumb {
  opacity: 1;
}

.jsmp-times {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 10px;
  color: rgba(255, 255, 255, .28);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}

/* ── Тело плеера ── */
.jsmp-body {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Обложка ── */
.jsmp-cover {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(243,54,102,.22), rgba(168,85,247,.18));
  border: 1px solid rgba(243, 54, 102, .2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.6);
  overflow: hidden;
  transition: transform .3s ease;
}

.jsmp-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#jsm-player.is-playing .jsmp-cover {
  animation: jsmp-cover-pulse 2.4s ease-in-out infinite;
}

@keyframes jsmp-cover-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(243,54,102,.35); }
  50%       { box-shadow: 0 0 0 6px rgba(243,54,102,.0); }
}

/* ── Мета ── */
.jsmp-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.jsmp-info {
  min-width: 0;
  overflow: hidden;
  flex: 1;
}

.jsmp-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.jsmp-author {
  font-size: 11px;
  color: rgba(255,255,255,.35);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Контролы ── */
.jsmp-controls {
  display: flex;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
}

.jsmp-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: rgba(255,255,255,.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .18s, color .18s, transform .18s;
  flex-shrink: 0;
  font-size: 0;
}

.jsmp-btn:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
  transform: scale(1.1);
}

.jsmp-btn:active { transform: scale(.9); }

.jsmp-btn svg {
  width: 16px;
  height: 16px;
  pointer-events: none;
}

/* Play/Pause — акцентная кнопка */
.jsmp-btn-play {
  width: 42px;
  height: 42px;
  background: var(--jsmp-grad);
  color: #fff;
  box-shadow: 0 4px 18px rgba(243, 54, 102, .45);
}

.jsmp-btn-play:hover {
  background: var(--jsmp-grad);
  box-shadow: 0 6px 24px rgba(243, 54, 102, .65);
  transform: scale(1.06);
}

.jsmp-btn-play svg { width: 18px; height: 18px; }

/* Кнопки second-tier (seek, close) */
.jsmp-btn-seek  { color: rgba(255,255,255,.45); }
.jsmp-btn-close { color: rgba(255,255,255,.28); }
.jsmp-btn-close:hover { color: #fff; }

/* Активные состояния Repeat / Shuffle */
.jsmp-btn-repeat.is-active,
.jsmp-btn-shuffle.is-active {
  color: var(--jsmp-accent);
}

.jsmp-btn-repeat.is-active-one::after {
  content: '1';
  position: absolute;
  font-size: 7px;
  font-weight: 800;
  bottom: 4px;
  right: 4px;
  color: var(--jsmp-accent);
  line-height: 1;
}

.jsmp-btn-repeat { position: relative; }

/* ── Громкость ── */
.jsmp-vol-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.jsmp-vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 64px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,.15);
  outline: none;
  cursor: pointer;
  accent-color: var(--jsmp-accent);
  transition: width .2s ease;
}

/* На мобиле прячем слайдер, оставляем только иконку-mute */
@media (max-width: 767px) {
  .jsmp-vol-slider { display: none; }
  .jsmp-vol-wrap   { gap: 0; }
}

/* ── Row с кнопками второго уровня ── */
.jsmp-row2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}

/* ── Padding body при открытом плеере ── */
body.jsmp-open {
  padding-bottom: calc(var(--jsmp-h-mobile) + env(safe-area-inset-bottom, 0px)) !important;
}

@media (min-width: 768px) {
  body.jsmp-open { padding-bottom: 0 !important; }
}

/* FAB поднимается выше плеера */
body.jsmp-open .fab-btn {
  bottom: calc(10px + 62px + 8px + var(--jsmp-h-mobile) + 8px);
}

@media (min-width: 768px) {
  body.jsmp-open .fab-btn { bottom: 28px; }
}

/* ── Ошибка загрузки ── */
.jsmp-error-msg {
  font-size: 11px;
  color: #f87171;
  text-align: center;
  padding: 2px 0;
  display: none;
}

.jsmp-error-msg.visible { display: block; }

/* ── PJAX: индикатор загрузки страницы ── */
#jsmp-nprogress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  background: var(--jsmp-grad);
  z-index: 99999;
  width: 0%;
  transition: width .3s ease, opacity .4s ease;
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px rgba(243,54,102,.6);
  pointer-events: none;
  opacity: 0;
}

#jsmp-nprogress.active {
  opacity: 1;
}