/* ============================================
   SPOTIFY MUSIC SEARCH COMPONENT
   Reusable music search UI styling
   ============================================ */

.music-search-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.music-search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.music-search-panel {
  position: relative;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  background: #1e1e1e;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.music-search-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.music-search-header h3 {
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

.music-search-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s;
}

.music-search-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.music-search-tabs {
  display: flex;
  gap: 8px;
  padding: 16px 24px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.music-search-tab {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.music-search-tab:hover {
  color: rgba(255, 255, 255, 0.9);
}

.music-search-tab.active {
  color: #0891b2;
  border-bottom-color: #0891b2;
}

.music-search-body {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.music-search-tab-content {
  display: none;
  flex-direction: column;
  height: 100%;
}

.music-search-tab-content.active {
  display: flex;
}

.music-search-input-wrapper {
  position: relative;
  padding: 16px 24px;
}

.music-search-icon {
  position: absolute;
  left: 40px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.4);
}

.music-search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  padding: 12px 16px 12px 44px;
  color: #fff;
  font-size: 15px;
  outline: none;
  transition: all 0.2s;
}

.music-search-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.music-search-input:focus {
  background: rgba(255, 255, 255, 0.15);
  border-color: #0891b2;
}

.music-search-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 16px;
}

.music-search-results::-webkit-scrollbar {
  width: 8px;
}

.music-search-results::-webkit-scrollbar-track {
  background: transparent;
}

.music-search-results::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.music-search-results::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.music-search-empty,
.music-search-error,
.music-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
}

.music-search-empty svg {
  margin-bottom: 16px;
}

.music-search-empty p,
.music-search-error {
  font-size: 15px;
  margin: 0;
}

.music-loading {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.6);
}

/* Track Item */
.music-track-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.music-track-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.music-track-album-art {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.music-track-album-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.music-track-play {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  cursor: pointer;
}

.music-track-album-art:hover .music-track-play {
  opacity: 1;
}

.music-track-play.playing {
  opacity: 1;
  background: rgba(8, 145, 178, 0.9);
}

.music-track-info {
  flex: 1;
  min-width: 0;
}

.music-track-name {
  font-size: 15px;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.music-track-artist {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.music-track-usage {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 2px;
}

.music-track-select {
  background: #0891b2;
  border: none;
  color: #000;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: 20px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.music-track-select:hover {
  background: #1fdf64;
  transform: scale(1.05);
}

/* Clip Selector */
.music-clip-selector {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.music-clip-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.music-clip-panel {
  position: relative;
  background: #2a2a2a;
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.music-clip-panel-trimmer {
  max-width: 480px;
  padding: 0;
}

.music-clip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.music-clip-header h4 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
}

.music-clip-back {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  transition: all 0.2s;
}

.music-clip-back:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.music-clip-panel h4 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  text-align: center;
}

.music-clip-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.03);
}

.music-clip-info img {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
}

.music-clip-name {
  font-size: 15px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 4px;
}

.music-clip-artist {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
}

/* Duration Picker */
.music-clip-duration-picker {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  justify-content: center;
}

.music-clip-dur-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 20px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.music-clip-dur-btn:hover {
  border-color: rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.9);
}

.music-clip-dur-btn.active {
  background: rgba(8, 145, 178, 0.15);
  border-color: #0891b2;
  color: #0891b2;
}

/* Waveform Trimmer */
.music-clip-trimmer-wrap {
  padding: 8px 20px 0;
}

.music-clip-waveform-container {
  position: relative;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.music-clip-waveform {
  display: block;
  width: 100%;
  height: 64px;
}

.music-clip-selection {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(8, 145, 178, 0.08);
  border: 2px solid #0891b2;
  border-radius: 6px;
  cursor: grab;
  transition: left 0.05s ease-out;
  z-index: 2;
}

.music-clip-selection:active {
  cursor: grabbing;
}

.music-clip-handle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 32px;
  background: #0891b2;
  border-radius: 4px;
  z-index: 3;
}

.music-clip-handle-left {
  left: -6px;
}

.music-clip-handle-right {
  right: -6px;
}

.music-clip-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 1px;
}

.music-clip-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fff;
  z-index: 4;
  display: none;
  pointer-events: none;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.5);
}

.music-clip-times {
  display: flex;
  justify-content: space-between;
  padding: 6px 4px 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  font-variant-numeric: tabular-nums;
}

/* Play/Pause Controls */
.music-clip-controls {
  display: flex;
  justify-content: center;
  padding: 12px 20px;
}

.music-clip-play-btn {
  background: #0891b2;
  border: none;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #000;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(8, 145, 178, 0.3);
}

.music-clip-play-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(8, 145, 178, 0.4);
}

/* Actions */
.music-clip-actions {
  display: flex;
  gap: 12px;
  padding: 0 20px 20px;
}

.music-clip-cancel-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  font-weight: 600;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.music-clip-cancel-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.music-clip-confirm-btn {
  flex: 1;
  background: #0891b2;
  border: none;
  color: #000;
  font-size: 14px;
  font-weight: 700;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.music-clip-confirm-btn:hover {
  background: #1fdf64;
  transform: translateY(-1px);
}

/* Legacy buttons kept for backward compat */
.music-clip-duration-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.music-clip-duration-btn {
  background: rgba(8, 145, 178, 0.1);
  border: 2px solid #0891b2;
  color: #0891b2;
  font-size: 15px;
  font-weight: 600;
  padding: 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.music-clip-duration-btn:hover {
  background: #0891b2;
  color: #000;
  transform: scale(1.02);
}

.music-clip-cancel {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  font-weight: 500;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.music-clip-cancel:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .music-search-panel {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .music-search-tabs {
    padding: 12px 16px 0;
  }

  .music-search-tab {
    font-size: 13px;
    padding: 10px 12px;
  }

  .music-track-item {
    padding: 12px 8px;
  }

  .music-track-album-art {
    width: 48px;
    height: 48px;
  }

  .music-track-name {
    font-size: 14px;
  }

  .music-track-artist {
    font-size: 12px;
  }

  .music-track-select {
    font-size: 13px;
    padding: 6px 16px;
  }
}
