/* ============================================
   ALBUM PLAYER 2.0 — Тихонов FM (улучшенный)
============================================= */

/* Основной оверлей */
.ap-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s, visibility 0.35s;
}
.ap-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Модальное окно */
.ap-modal {
  position: relative;
  width: 92vw;
  max-width: 960px;
  height: 85vh;
  max-height: 720px;
  background: rgba(18, 18, 18, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(239, 138, 47, 0.12);
  border-radius: 30px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  transform: scale(0.96) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
  opacity: 0;
  overflow: hidden;
}
.ap-overlay.active .ap-modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Фоновое размытое изображение */
.ap-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  filter: blur(80px) brightness(0.5);
  opacity: 0.65;
  transition: opacity 0.8s ease;
  transform: scale(1.2);
}
.ap-backdrop.loaded {
  opacity: 0.75;
}

/* Виньетка поверх фона (усиленная) */
.ap-modal::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 20%, rgba(0,0,0,0.6) 100%);
}

/* Шапка */
.ap-header {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px 10px 28px;
  border-bottom: 1px solid rgba(239, 138, 47, 0.06);
  flex-shrink: 0;
  min-height: 52px;
}

.ap-mode-label {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.5;
  font-weight: 300;
}

.ap-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: background 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ap-close:hover {
  background: rgba(239, 138, 47, 0.12);
  color: var(--gold-light);
}
.ap-close svg {
  display: block;
  width: 22px;
  height: 22px;
}

/* Тело */
.ap-body {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 1;
  padding: 20px 28px 28px 28px;
  gap: 32px;
  overflow: hidden;
}

/* Левая колонка */
.ap-left {
  flex: 0 0 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 20px;
}

.ap-cover-wrapper {
  position: relative;
  width: 300px;
  height: 300px;
}

/* Размытая копия обложки */
.ap-cover-blur {
  position: absolute;
  inset: -20px;
  z-index: 0;
  background-size: cover;
  background-position: center;
  filter: blur(40px) brightness(0.4);
  opacity: 0.4;
  border-radius: 50%;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.ap-cover-wrapper.is-playing .ap-cover-blur {
  opacity: 0.6;
}

.ap-cover-container {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  z-index: 1;
}

.ap-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.8s ease;
}

.ap-cover-light {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255, 220, 150, 0.08), transparent 60%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
}
.ap-cover-wrapper.is-playing .ap-cover-light {
  opacity: 1;
  animation: lightMove 8s ease-in-out infinite;
}

@keyframes lightMove {
  0% { background: radial-gradient(circle at 30% 20%, rgba(255, 220, 150, 0.08), transparent 60%); }
  50% { background: radial-gradient(circle at 70% 60%, rgba(255, 220, 150, 0.12), transparent 60%); }
  100% { background: radial-gradient(circle at 30% 20%, rgba(255, 220, 150, 0.08), transparent 60%); }
}

.ap-cover-wrapper.is-playing .ap-cover {
  animation: apCoverBreathe 8s ease-in-out infinite;
}
@keyframes apCoverBreathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.008); }
}

.ap-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}
.ap-particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: rgba(239, 138, 47, 0.2);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(239, 138, 47, 0.05);
  opacity: 0;
  animation: apParticleFloat 14s linear infinite;
}
@keyframes apParticleFloat {
  0% { transform: translateY(0) scale(0.5); opacity: 0; }
  15% { opacity: 0.5; }
  85% { opacity: 0.5; }
  100% { transform: translateY(-120%) scale(1); opacity: 0; }
}

/* Правая колонка */
.ap-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ap-info {
  margin-bottom: 18px;
}
.ap-album-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 2rem;
  font-weight: 400;
  color: var(--gold-light);
  margin: 0;
  line-height: 1.2;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ap-album-artist {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 2px 0 0 0;
}
.ap-album-year {
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.5;
  margin: 2px 0 0 0;
}
/* Новая строка для общей длительности альбома */
.ap-album-duration {
  font-size: 0.8rem;
  color: var(--text-muted);
  opacity: 0.4;
  margin: 2px 0 0 0;
}

.ap-track-info {
  margin-bottom: 16px;
}
.ap-track-current {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.6;
}
.ap-track-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.5rem;
  color: var(--text);
  font-weight: 400;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ap-progress-wrapper {
  margin-bottom: 20px;
}
.ap-progress {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  transition: height 0.2s;
}
.ap-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 16px rgba(239, 138, 47, 0.15);
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.1);
}
.ap-progress::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  border: none;
  cursor: pointer;
}
.ap-progress::-webkit-slider-runnable-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
}
.ap-progress::-moz-range-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
}
.ap-time {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.6;
  margin-top: 6px;
}

.ap-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 18px;
}
.ap-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: color 0.25s, background 0.25s, transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ap-btn:hover {
  color: var(--gold-light);
  background: rgba(239, 138, 47, 0.06);
}
.ap-btn:active {
  transform: scale(0.92);
}

.ap-btn--play {
  width: 62px;
  height: 62px;
  background: linear-gradient(135deg, rgba(239, 138, 47, 0.15), rgba(255, 176, 76, 0.05));
  border: 1px solid rgba(239, 138, 47, 0.25);
  border-radius: 50%;
  transition: all 0.3s ease;
}
.ap-btn--play:hover {
  background: linear-gradient(135deg, rgba(239, 138, 47, 0.25), rgba(255, 176, 76, 0.1));
  border-color: var(--gold);
  box-shadow: 0 0 28px rgba(239, 138, 47, 0.15);
}
.ap-btn--play svg {
  width: 40px;
  height: 40px;
  transition: transform 0.2s;
}
.ap-btn--play:hover svg {
  transform: scale(1.05);
}
.ap-btn--play .ap-pause-icon,
.ap-btn--play .ap-play-icon {
  fill: var(--gold-light);
}

.ap-btn--shuffle.active,
.ap-btn--repeat.active {
  color: var(--gold);
}
.ap-btn--like.active {
  color: #ff6b81;
}
.ap-btn--like.active svg {
  fill: #ff6b81;
}

.ap-playlist {
  flex: 1;
  overflow-y: auto;
  margin-top: 6px;
  border-top: 1px solid rgba(239, 138, 47, 0.05);
  padding-top: 10px;
}
.ap-playlist::-webkit-scrollbar {
  width: 3px;
}
.ap-playlist::-webkit-scrollbar-track {
  background: transparent;
}
.ap-playlist::-webkit-scrollbar-thumb {
  background: rgba(239, 138, 47, 0.2);
  border-radius: 2px;
}

.ap-playlist-item {
  display: flex;
  align-items: center;
  padding: 6px 8px 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  gap: 10px;
  position: relative;
}
.ap-playlist-item:hover {
  background: rgba(239, 138, 47, 0.03);
}
.ap-playlist-item.active {
  background: transparent;
  color: var(--gold-light);
}
.ap-playlist-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: linear-gradient(180deg, var(--gold), var(--gold-light));
  border-radius: 1px;
  opacity: 0.6;
}
.ap-playlist-item .ap-pl-index {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.4;
  width: 22px;
  text-align: right;
  flex-shrink: 0;
}
.ap-playlist-item .ap-pl-title {
  flex: 1;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ap-playlist-item .ap-pl-duration {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.5;
  flex-shrink: 0;
}
.ap-playlist-item.active .ap-pl-index {
  color: var(--gold);
  opacity: 0.8;
}
.ap-playlist-item.active .ap-pl-duration {
  color: var(--gold-light);
  opacity: 0.7;
}

/* ============================================
   АДАПТИВ (телефон – затемнение усилено)
============================================= */
@media (max-width: 768px) {
  .ap-modal {
    width: 96vw;
    height: 92vh;
    max-height: none;
    border-radius: 20px;
  }
  .ap-body {
    flex-direction: column;
    padding: 16px 18px 18px;
    gap: 16px;
    overflow-y: auto;
  }
  .ap-left {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    padding-top: 0;
  }
  .ap-cover-wrapper {
    width: 180px;
    height: 180px;
  }
  .ap-cover-blur {
    inset: -14px;
    filter: blur(30px);
  }
  .ap-right {
    overflow-y: auto;
  }
  .ap-album-title {
    font-size: 1.5rem;
    white-space: normal;
  }
  .ap-track-title {
    font-size: 1.2rem;
    white-space: normal;
  }
  .ap-controls {
    gap: 10px;
  }
  .ap-btn--play {
    width: 52px;
    height: 52px;
  }
  .ap-btn--play svg {
    width: 32px;
    height: 32px;
  }
  .ap-playlist {
    max-height: 140px;
  }
  .ap-header {
    padding: 12px 16px 8px;
  }

  /* Усиление затемнения фона на телефоне */
  .ap-overlay {
    background: rgba(0,0,0,0.85);
  }
  .ap-backdrop {
    filter: blur(60px) brightness(0.25);
    opacity: 0.9;
  }
  .ap-modal::after {
    background: radial-gradient(ellipse at center, transparent 10%, rgba(0,0,0,0.7) 100%);
  }
  /* Тени для читаемости текста */
  .ap-album-title,
  .ap-track-title,
  .ap-album-artist,
  .ap-album-year,
  .ap-album-duration,
  .ap-track-current {
    text-shadow: 0 2px 12px rgba(0,0,0,0.6);
  }
}

@media (max-width: 480px) {
  .ap-cover-wrapper {
    width: 140px;
    height: 140px;
  }
  .ap-modal {
    border-radius: 16px;
  }
  .ap-body {
    padding: 12px 12px 14px;
    gap: 12px;
  }
  .ap-album-title {
    font-size: 1.2rem;
  }
  .ap-track-title {
    font-size: 1rem;
  }
  .ap-btn--play {
    width: 46px;
    height: 46px;
  }
  .ap-btn--play svg {
    width: 28px;
    height: 28px;
  }
  .ap-playlist {
    max-height: 100px;
  }
  .ap-playlist-item .ap-pl-title {
    font-size: 0.8rem;
  }
  /* Ещё сильнее затемнение для маленьких экранов */
  .ap-backdrop {
    filter: blur(40px) brightness(0.2);
    opacity: 1;
  }
  .ap-modal::after {
    background: radial-gradient(ellipse at center, transparent 5%, rgba(0,0,0,0.8) 100%);
  }
  .ap-album-title,
  .ap-track-title,
  .ap-album-artist,
  .ap-album-year,
  .ap-album-duration {
    text-shadow: 0 2px 16px rgba(0,0,0,0.8);
  }
}