/* ========================================
   DYNAMIC ISLAND - iOS Style Music Player (COMPACT VERSION)
   ======================================== */

.dynamic-island {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  transition: all 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  max-width: 428px;
}

/* Compact State (Default) - PIÙ PICCOLO */
.dynamic-island.compact {
  width: 100px;
  height: 32px;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
}

/* Minimal State (Music Playing - Small) - PIÙ PICCOLO */
.dynamic-island.minimal {
  width: 180px;
  height: 32px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px;
  overflow: hidden;
}

/* Expanded State (Click) - PIÙ PICCOLO */
.dynamic-island.expanded {
  width: 320px;
  height: 110px;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-radius: 18px;
  overflow: visible;
}

/* ========================================
   DYNAMIC ISLAND CONTENT
   ======================================== */

.di-content {
  width: 100%;
  height: 100%;
  position: relative;
  cursor: pointer;
}

/* Compact Content (Empty/No Music) */
.di-compact-content {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  opacity: 0;
  transition: opacity 0.3s;
}

.dynamic-island.compact .di-compact-content {
  opacity: 1;
}

/* Minimal Content (Music Playing) - PIÙ PICCOLO */
.di-minimal-content {
  display: flex;
  align-items: center;
  padding: 0 10px;
  height: 100%;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.3s;
}

.dynamic-island.minimal .di-minimal-content {
  opacity: 1;
}

.di-minimal-cover {
  width: 24px;
  height: 24px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  flex-shrink: 0;
}

.di-minimal-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.di-minimal-cover-emoji {
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.di-minimal-info {
  flex: 1;
  min-width: 0;
}

.di-minimal-title {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 1px;
  line-height: 1.2;
}

.di-minimal-artist {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.di-minimal-play {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 8px;
  color: #fff;
  transition: background 0.2s;
}

.di-minimal-play:active {
  background: rgba(255, 255, 255, 0.3);
}

/* Expanded Content - PIÙ PICCOLO */
.di-expanded-content {
  padding: 12px;
  height: 100%;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.3s;
}

.dynamic-island.expanded .di-expanded-content {
  opacity: 1;
}

.di-expanded-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.di-expanded-cover {
  width: 42px;
  height: 42px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  flex-shrink: 0;
}

.di-expanded-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.di-expanded-cover-emoji {
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.di-expanded-info {
  flex: 1;
  min-width: 0;
}

.di-expanded-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.di-expanded-artist {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

/* Controls - PIÙ PICCOLI */
.di-expanded-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: auto;
}

.di-control-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: none;
  border: none;
  color: #fff;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  opacity: 0.8;
}

.di-control-btn:active {
  background: rgba(255, 255, 255, 0.1);
  opacity: 1;
}

.di-control-btn.play-btn {
  background: #fff;
  color: #000;
  width: 36px;
  height: 36px;
  opacity: 1;
}

.di-control-btn.play-btn:active {
  background: rgba(255, 255, 255, 0.9);
}

.di-control-icon {
  width: 18px;
  height: 18px;
}

.di-control-icon-play {
  width: 14px;
  height: 14px;
  filter: brightness(0); /* Black on white background */
}

/* Hide states */
.dynamic-island.compact .di-minimal-content,
.dynamic-island.compact .di-expanded-content,
.dynamic-island.minimal .di-compact-content,
.dynamic-island.minimal .di-expanded-content,
.dynamic-island.expanded .di-compact-content,
.dynamic-island.expanded .di-minimal-content {
  display: none;
}

/* Hidden completely */
.dynamic-island.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Waveform Animation - PIÙ PICCOLO */
.di-waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 12px;
}

.di-wave-bar {
  width: 2px;
  background: #1DB954;
  border-radius: 2px;
  animation: wave 1s ease-in-out infinite;
}

.di-wave-bar:nth-child(1) { animation-delay: 0s; height: 30%; }
.di-wave-bar:nth-child(2) { animation-delay: 0.1s; height: 60%; }
.di-wave-bar:nth-child(3) { animation-delay: 0.2s; height: 80%; }
.di-wave-bar:nth-child(4) { animation-delay: 0.3s; height: 50%; }

@keyframes wave {
  0%, 100% { height: 30%; }
  50% { height: 100%; }
}

/* Responsive */
@media (max-width: 390px) {
  .dynamic-island.expanded {
    width: 300px;
    height: 105px;
  }
}

@media (max-width: 375px) {
  .dynamic-island.expanded {
    width: 290px;
    height: 100px;
  }
  
  .di-expanded-cover {
    width: 38px;
    height: 38px;
  }
  
  .di-expanded-title {
    font-size: 12px;
  }
  
  .di-expanded-artist {
    font-size: 10px;
  }
}
/* Fix per click sui pulsanti */
.di-control-btn,
.di-minimal-play {
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.di-control-icon,
.di-control-icon-play {
  pointer-events: none; /* Le immagini non devono bloccare i click */
}
