/**
 * Vintage Vinyl Music Player Styles
 * RMS JazzOrchester Köln
 */

/* ============================================
   CSS Variables
   ============================================ */
:root {
  --player-height: 80px;
  --player-height-expanded: 120px;
  --player-bg: rgba(26, 26, 26, 0.95);
  --player-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  --vinyl-size: 100px;
  --vinyl-spin-duration: 2s;
  --tonarm-transition: 0.8s ease-in-out;
}

/* Light theme adjustments */
body[data-theme="light-classic"] {
  --player-bg: rgba(255, 255, 255, 0.98);
  --player-shadow: 0 -2px 15px rgba(0, 0, 0, 0.08);
}

/* ============================================
   Main Player Container
   ============================================ */
.vinyl-player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--player-height);
  background: var(--player-bg);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(212, 175, 55, 0.2);
  box-shadow: var(--player-shadow);
  z-index: 9998;
  transition: transform 0.3s ease, height 0.3s ease;
}

body[data-theme="light-classic"] .vinyl-player {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* Mobile minimized state */
.vinyl-player.minimized {
  transform: translateY(calc(100% - 50px));
}

/* Accessible mode - high contrast */
body[data-accessible="true"] .vinyl-player {
  background: var(--theme-bg);
  border-top: 3px solid var(--gold);
  backdrop-filter: none;
}

/* ============================================
   Player Container Layout
   ============================================ */
.vinyl-player-container {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 2rem;
  height: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

/* ============================================
   Vinyl Visualization
   ============================================ */
.vinyl-visual {
  position: relative;
  width: var(--vinyl-size);
  height: var(--vinyl-size);
  flex-shrink: 0;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.vinyl-record {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
  transition: transform 0.3s ease;
  cursor: help;
}

.vinyl-record img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Vinyl rotation animation */
.vinyl-record[data-state="playing"] {
  animation: vinyl-spin var(--vinyl-spin-duration) linear infinite;
}

.vinyl-record[data-state="paused"] {
  animation: none;
}

@keyframes vinyl-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Tonarm */
.vinyl-tonarm {
  position: absolute;
  top: -10px;
  left: -5px;
  width: 60px;
  height: auto;
  transform-origin: 15px 15px;
  transform: rotate(45deg);
  transition: transform var(--tonarm-transition);
  pointer-events: none;
  z-index: 10;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

.vinyl-tonarm img {
  width: 100%;
  height: auto;
  display: block;
}

.vinyl-tonarm[data-state="playing"] {
  transform: rotate(12deg);
}

.vinyl-tonarm[data-state="resting"] {
  transform: rotate(45deg);
}

/* Accessible mode - hide decorative vinyl */
body[data-accessible="true"] .vinyl-visual {
  display: none;
}

/* ============================================
   Player Controls
   ============================================ */
.player-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

/* Track Info */
.track-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.track-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--theme-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-artist {
  font-size: 0.875rem;
  color: var(--theme-text);
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Control Buttons */
.control-buttons {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.control-buttons button {
  background: transparent;
  border: none;
  color: var(--gold);
  font-size: 1.125rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.control-buttons button:hover {
  background: rgba(212, 175, 55, 0.1);
  transform: scale(1.1);
}

.control-buttons button:active {
  transform: scale(0.95);
}

.btn-play-pause {
  font-size: 1.5rem !important;
  width: 44px !important;
  height: 44px !important;
  background: var(--gold);
  color: var(--night);
}

.btn-play-pause:hover {
  background: var(--gold);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

body[data-accessible="true"] .control-buttons button {
  border: 2px solid var(--gold);
}

/* Progress Bar */
.progress-bar {
  position: relative;
  height: 4px;
  background: rgba(212, 175, 55, 0.2);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
}

.progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--gold);
  border-radius: 2px;
  transition: width 0.1s linear;
  pointer-events: none;
}

.progress-slider {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 100%;
  transform: translateY(-50%);
  opacity: 0;
  cursor: pointer;
  z-index: 10;
}

.progress-slider::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  background: var(--gold);
  border-radius: 50%;
  cursor: pointer;
  opacity: 1;
}

.progress-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: var(--gold);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.progress-bar:hover .progress-slider {
  opacity: 1;
}

body[data-accessible="true"] .progress-bar {
  height: 8px;
  background: rgba(212, 175, 55, 0.4);
}

/* Time Display */
.time-display {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--theme-text);
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}

/* ============================================
   Player Extras (Volume & Playlist)
   ============================================ */
.player-extras {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

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

.btn-volume {
  background: transparent;
  border: none;
  color: var(--gold);
  font-size: 1.125rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-volume:hover {
  background: rgba(212, 175, 55, 0.1);
}

.volume-slider {
  width: 80px;
  height: 4px;
  appearance: none;
  background: rgba(212, 175, 55, 0.2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  background: var(--gold);
  border-radius: 50%;
  cursor: pointer;
}

.volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: var(--gold);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* Playlist Button */
.btn-playlist {
  background: transparent;
  border: none;
  color: var(--gold);
  font-size: 1.125rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-playlist:hover {
  background: rgba(212, 175, 55, 0.1);
}

/* Minimize Button */
.btn-minimize {
  background: transparent;
  border: none;
  color: var(--theme-text);
  opacity: 0.5;
  font-size: 1rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: none;
}

.btn-minimize:hover {
  opacity: 1;
}

/* ============================================
   Playlist Dropdown
   ============================================ */
.playlist-dropdown {
  position: absolute;
  bottom: 100%;
  right: 2rem;
  width: 400px;
  max-height: 500px;
  background: var(--player-bg);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 1rem 1rem 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 10;
}

.playlist-dropdown.hidden {
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
}

body[data-theme="light-classic"] .playlist-dropdown {
  border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Playlist Header */
.playlist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.playlist-header h3 {
  margin: 0;
  font-size: 1.125rem;
  color: var(--theme-text);
}

.btn-close-playlist {
  background: transparent;
  border: none;
  color: var(--theme-text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.btn-close-playlist:hover {
  background: rgba(212, 175, 55, 0.1);
}

/* Playlist Tracks */
.playlist-tracks {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 400px;
  overflow-y: auto;
}

.playlist-track-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  transition: background 0.2s ease;
  border-bottom: 1px solid rgba(212, 175, 55, 0.1);
}

.playlist-track-item:hover {
  background: rgba(212, 175, 55, 0.1);
}

.playlist-track-item.active {
  background: rgba(212, 175, 55, 0.2);
}

.playlist-track-item.active .track-number {
  color: var(--gold);
  font-weight: 700;
}

.track-number {
  font-size: 0.875rem;
  color: var(--theme-text);
  opacity: 0.5;
  min-width: 24px;
  text-align: right;
}

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

.track-name {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--theme-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-meta {
  font-size: 0.8125rem;
  color: var(--theme-text);
  opacity: 0.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-duration {
  font-size: 0.875rem;
  color: var(--theme-text);
  opacity: 0.5;
  font-variant-numeric: tabular-nums;
}

.no-tracks {
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--theme-text);
  opacity: 0.5;
  font-style: italic;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Tablet */
@media (max-width: 1023px) {
  :root {
    --vinyl-size: 80px;
  }

  .vinyl-player-container {
    gap: 1rem;
    padding: 0 1.5rem;
  }

  .playlist-dropdown {
    width: 350px;
    right: 1.5rem;
  }

  .volume-slider {
    width: 60px;
  }
}

/* Mobile */
@media (max-width: 767px) {
  :root {
    --player-height: 70px;
    --vinyl-size: 60px;
  }

  .vinyl-player-container {
    gap: 0.5rem;
    padding: 0 0.5rem;
  }

  /* Show smaller vinyl visualization on mobile */
  .vinyl-visual {
    display: flex !important;
    width: var(--vinyl-size) !important;
    height: var(--vinyl-size) !important;
  }

  /* Smaller tonarm on mobile */
  .vinyl-tonarm {
    width: 40px;
    top: -5px;
    left: -3px;
    transform-origin: 10px 10px;
  }

  /* Compact player controls */
  .player-controls {
    gap: 0.25rem;
    flex: 1;
  }

  /* Hide track info to save space */
  .track-info {
    display: none;
  }

  /* Horizontal layout for controls */
  .control-buttons {
    gap: 0.5rem;
    justify-content: center;
  }

  /* Progress bar - show it! */
  .progress-bar {
    display: block !important;
    width: 100%;
    height: 4px;
    margin: 0;
  }

  /* Hide time display */
  .time-display {
    display: none;
  }

  /* Hide volume slider, show only icon */
  .volume-slider {
    display: none;
  }

  /* Compact extras */
  .player-extras {
    gap: 0.25rem;
    flex-shrink: 0;
  }

  /* Compact controls */
  .control-buttons {
    gap: 0.5rem;
  }

  .control-buttons button {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .btn-play-pause {
    width: 40px !important;
    height: 40px !important;
    font-size: 1.25rem !important;
  }

  /* Compact track info */
  .track-title {
    font-size: 0.875rem;
  }

  .track-artist {
    font-size: 0.75rem;
  }

  /* Show minimize button on mobile */
  .btn-minimize {
    display: flex;
  }

  /* Full width playlist on mobile */
  .playlist-dropdown {
    right: 0;
    left: 0;
    width: 100%;
    border-radius: 1rem 1rem 0 0;
    max-height: 60vh;
  }

  .playlist-tracks {
    max-height: calc(60vh - 60px);
  }

  .playlist-track-item {
    padding: 0.75rem 1rem;
  }
}

/* Small mobile */
@media (max-width: 479px) {
  .player-controls {
    gap: 0.375rem;
  }

  .time-display {
    font-size: 0.6875rem;
  }

  .player-extras {
    flex-direction: column;
    gap: 0.25rem;
  }
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .vinyl-record[data-state="playing"] {
    animation: none;
  }

  .vinyl-tonarm {
    transition: none;
  }

  .playlist-dropdown {
    transition: opacity 0.2s ease;
  }
}

/* ============================================
   Print
   ============================================ */
@media print {
  .vinyl-player {
    display: none;
  }
}
