/**
 * Time Machine Audio Player Styles
 * Extends the base Time Machine dial with inline audio playback
 */

/* Action Buttons Container */
.tm-action-buttons {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 280px;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.tm-listen-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1.25rem;
  background: var(--tm-accent, #0066cc);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tm-listen-btn:hover:not(:disabled) {
  background: var(--tm-accent-hover, #0052a3);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 102, 204, 0.25);
}

.tm-listen-btn:active:not(:disabled) {
  transform: translateY(0);
}

.tm-listen-btn:disabled {
  background: #b8d4f0;
  cursor: not-allowed;
}

/* Stop button (external - in action buttons area) */
.tm-stop-btn-external {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1.25rem;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.tm-stop-btn-external:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(240, 147, 251, 0.35);
}

.tm-stop-btn-external:active {
  transform: translateY(0);
}

/* Error Message */
.tm-error-message {
  width: 100%;
  text-align: center;
  padding: 0.75rem 1rem;
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.3);
  border-radius: 8px;
  color: #dc3545;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* Now Playing Display */
.tm-now-playing {
  width: 100%;
  max-width: 320px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: none; /* Hidden by default, shown via .tm-now-playing-visible */
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* When player is visible */
.tm-now-playing.tm-now-playing-visible {
  display: flex;
}

.tm-np-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.tm-np-status {
  color: #64ffda;
  font-size: 0.85rem;
  font-weight: 500;
  min-width: 110px; /* Prevent width jump between Playing/Paused */
}

.tm-header-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Volume Control */
.tm-volume-control {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.tm-volume-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.2rem;
  opacity: 0.8;
  transition: opacity 0.15s ease;
}

.tm-volume-btn:hover {
  opacity: 1;
}

.tm-volume-btn.muted .tm-volume-icon {
  opacity: 0.4;
}

.tm-volume-slider {
  width: 60px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.2);
  appearance: none;
  cursor: pointer;
}

.tm-volume-slider::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #64ffda;
  cursor: pointer;
}

.tm-volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: #64ffda;
  cursor: pointer;
}

/* Sleep Timer Control */
.tm-sleep-control {
  position: relative;
}

.tm-sleep-icon-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tm-sleep-icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

.tm-sleep-icon {
  font-size: 0.9rem;
}

.tm-sleep-time {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64ffda;
}

.tm-sleep-time.active {
  color: #ffd93d;
}

.tm-sleep-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 0.25rem;
  z-index: 100;
  min-width: 120px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tm-sleep-option {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: none;
  color: white;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.1s ease;
}

.tm-sleep-option:hover {
  background: rgba(100, 255, 218, 0.15);
}

.tm-sleep-option.selected {
  background: rgba(100, 255, 218, 0.2);
  color: #64ffda;
}

/* Track Info */
.tm-np-track {
  color: white;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
}

/* Progress/Scrubber */
.tm-np-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.tm-np-time-current,
.tm-np-time-duration {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  min-width: 36px;
}

.tm-np-time-current {
  text-align: right;
}

.tm-np-time-duration {
  text-align: left;
}

.tm-scrubber {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.2);
  appearance: none;
  cursor: pointer;
  transition: height 0.15s ease;
}

.tm-scrubber:hover {
  height: 8px;
}

.tm-scrubber::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #64ffda;
  cursor: grab;
  box-shadow: 0 0 6px rgba(100, 255, 218, 0.5);
  transition: transform 0.1s ease;
}

.tm-scrubber::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.2);
}

.tm-scrubber::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 50%;
  background: #64ffda;
  cursor: grab;
}

/* Playback Controls */
.tm-np-playback {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

.tm-play-pause-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #64ffda;
  border: none;
  color: #1a1a2e;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(100, 255, 218, 0.3);
}

.tm-play-pause-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(100, 255, 218, 0.4);
}

.tm-skip-btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tm-skip-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(100, 255, 218, 0.5);
  color: #64ffda;
}

.tm-skip-btn:active {
  transform: scale(0.95);
}

.tm-skip-icon {
  font-size: 0.9rem;
}

.tm-skip-label {
  font-weight: 600;
}

/* Actions Row (Like + Transcript) */
.tm-np-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
}

/* Like Button */
.tm-like-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tm-like-btn:hover {
  background: rgba(255, 100, 100, 0.15);
  border-color: rgba(255, 100, 100, 0.4);
  transform: scale(1.05);
}

.tm-like-btn.liked {
  background: rgba(255, 100, 100, 0.2);
  border-color: rgba(255, 100, 100, 0.5);
}

.tm-like-btn.liked-animation {
  animation: like-pop 0.3s ease-out;
}

@keyframes like-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.tm-like-icon {
  font-size: 1rem;
}

.tm-like-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  min-width: 16px;
}

/* Transcript Link */
.tm-transcript-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.4rem 0.75rem;
  background: rgba(100, 255, 218, 0.15);
  border: 1px solid rgba(100, 255, 218, 0.3);
  border-radius: 20px;
  color: #64ffda;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tm-transcript-link:hover {
  background: rgba(100, 255, 218, 0.25);
  border-color: rgba(100, 255, 218, 0.5);
  transform: scale(1.02);
}

/* Animations */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* Responsive */
@media (max-width: 480px) {
  .tm-now-playing {
    padding: 0.75rem 1rem;
  }
  
  .tm-np-playback {
    gap: 0.5rem;
  }
  
  .tm-play-pause-btn {
    width: 42px;
    height: 42px;
  }
  
  .tm-skip-btn {
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
  }
}
