/* Apple Music風オーディオプレイヤー */
.music-audio-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}
.music-audio {
  position: relative;
  width: auto;
  min-width: 300px;
  max-width: 500px;
  margin: 20px 0;
}

/* デフォルトのaudioタグを非表示 */
.music-audio audio {
  display: none;
}

/* カスタムプレイヤーコンテナ */
.custom-audio-player {
  background: #fbfbfd;
  border: 1px solid #e5e5e7;
  border-radius: 12px;
  padding: 8px 12px;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  height: 50px;
  box-sizing: border-box;
}

/* コントロール部分 - 横一列配置 */
.audio-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 100%;
}

/* プログレスセクション */
.progress-section {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-grow: 1;
}

/* 再生ボタン */
.play-pause-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #1d1d1f;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background-color 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
  position: relative;
}

.play-pause-btn object {
  width: 100%;
  height: auto;
  pointer-events: none; /* アイコンの上でのクリックを防止 */
}

/* .play-pause-btn:hover {
  background: #424245;
  transform: scale(1.05);
} */

.play-pause-btn:active {
  transform: scale(0.95);
}

/* アイコンの中央配置 */
.play-pause-btn .play-icon,
.play-pause-btn .pause-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  line-height: 1;
  transition: none; /* アイコンの位置は変化させない */
}

.play-pause-btn .play-icon {
  transform: translate(-50%, -50%); /* 再生アイコンは視覚的に中央に見えるよう微調整 */
  margin-left: 1px; /* 微調整 */
}

.play-pause-btn .pause-icon {
  transform: translate(-50%, -50%); /* 停止アイコンの位置調整 */
}

/* ホバー時もアイコンの位置を固定 */
/* .play-pause-btn:hover .play-icon {
  transform: translate(-45%, -50%) !important;
}

.play-pause-btn:hover .pause-icon {
  transform: translate(-50%, -60%) !important;
} */

/* アクティブ時もアイコンの位置を固定 */
.play-pause-btn:active .play-icon {
  transform: translate(-50%, -50%) !important;
}

.play-pause-btn:active .pause-icon {
  transform: translate(-50%, -50%) !important;
}

/* 時間表示 */
.time-display {
  font-size: 11px;
  font-weight: 400;
  color: #86868b;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  width: auto;
}

/* プログレスバーコンテナ */
.progress-container {
  position: relative;
  width: 100%;
  min-width: 50px;
  height: 3px;
  background: #e5e5e7;
  border-radius: 1.5px;
  cursor: pointer;
  flex-grow: 1;
}

/* プログレスバー */
.progress-bar {
  height: 100%;
  background: #1d1d1f;
  border-radius: 1.5px;
  width: 0%;
  transition: width 0.1s ease;
  position: relative;
}

/* プログレスバーのハンドル */
.progress-bar::after {
  content: '';
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: #1d1d1f;
  border: 1px solid #ffffff;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.progress-container:hover .progress-bar::after {
  opacity: 1;
}

/* 音量コントロール */
.volume-container {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.volume-icon {
  font-size: 12px;
  color: #86868b;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  transition: color 0.2s ease;
}

.volume-icon:hover {
  color: #1d1d1f;
}



.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 50px;
  height: 2px;
  border-radius: 1px;
  background: #e5e5e7;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1d1d1f;
  border: 1px solid #ffffff;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  margin-left: -2px;
  margin-right: -2px;
}

.volume-slider::-moz-range-thumb {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1d1d1f;
  border: 1px solid #ffffff;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  margin-left: -2px;
  margin-right: -2px;
}

/* ローディング状態 */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading .play-pause-btn {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* スマホ対応（767px以下） */
@media (max-width: 767px) {
  .music-audio {
    width: 100%;
    min-width: unset;
  }
  
  .custom-audio-player {
    width: 100%;
    height: 75px;
    padding: 20px 24px;
    border-radius: 16px;
  }
  
  .audio-controls {
    gap: 20px;
  }
  
  .progress-section {
    gap: 8px;
  }
  
  .play-pause-btn {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }
  
  .play-pause-btn .play-icon,
  .play-pause-btn .pause-icon {
    width: 26px;
    height: 26px;
  }
  
  .play-pause-btn .play-icon {
    transform: translate(-50%, -50%);
  }
  
  .play-pause-btn .pause-icon {
    transform: translate(-50%, -50%);
  }
  
  /* スマホでもホバー時の位置を固定 */
  .play-pause-btn:hover .play-icon {
    transform: translate(-50%, -50%) !important;
  }

  .play-pause-btn:hover .pause-icon {
    transform: translate(-50%, -50%) !important;
  }
  
  /* スマホでもアクティブ時の位置を固定 */
  .play-pause-btn:active .play-icon {
    transform: translate(-50%, -50%) !important;
  }

  .play-pause-btn:active .pause-icon {
    transform: translate(-50%, -50%) !important;
  }
  
  .time-display {
    font-size: 15px;
  }
  
  .time-display {
    font-size: 15px;
  }
  
  .progress-container {
    height: 4px;
  }
  
  .progress-bar::after {
    width: 12px;
    height: 12px;
    right: -6px;
  }
  
  /* スマホでは音量調整を非表示（iOSで音量調整不可のため） */
  .volume-container {
    display: none;
  }
  
  .volume-slider::-webkit-slider-thumb {
    width: 12px;
    height: 12px;
  }
  
  .volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
  }
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
  .custom-audio-player {
    background: #1c1c1e;
    border-color: #39393d;
    color: #ffffff;
  }
  
  .play-pause-btn {
    background: #ffffff;
    color: #1d1d1f;
  }
  
  .play-pause-btn:hover {
    background: #e5e5e7;
  }
  
  .time-display {
    color: #98989d;
  }
  
  .progress-container {
    background: #39393d;
  }
  
  .progress-bar {
    background: #ffffff;
  }
  
  .progress-bar::after {
    background: #ffffff;
    border-color: #1c1c1e;
  }
  
  .volume-slider {
    background: #39393d;
  }
  
  .volume-slider::-webkit-slider-thumb {
    background: #ffffff;
    border-color: #1c1c1e;
  }
  
  .volume-slider::-moz-range-thumb {
    background: #ffffff;
    border-color: #1c1c1e;
  }
  
  .volume-icon {
    color: #98989d;
  }
  
  .volume-icon:hover {
    color: #ffffff;
  }
}