/**
 * SoundCloud Custom Player Styles for travisBREAKS
 *
 * These styles integrate seamlessly with the existing travisBREAKS aesthetic:
 * - Dark brutalism
 * - Terminal UI
 * - Neon accents (cyan #05D9E8, pink #FF2A6D, gold #CCA43B)
 * - Film grain overlay
 * - Monospace typography (JetBrains Mono)
 */

/* ===================================
   CURSOR STYLES
   =================================== */
/* Note: Global crosshair is set in index.html */

/* ===================================
   ENHANCED NOW PLAYING SECTION
   =================================== */

#now-playing {
  /* Keep existing styles, add these enhancements */
  position: relative;
  overflow: visible;
}

/* Progress bar container */
.sc-progress-container {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
  margin-top: 15px;
  position: relative;
  overflow: hidden;
  border-radius: 0; /* Sharp edges for brutalist aesthetic */
  cursor: pointer;
}

/* Animated progress fill */
.sc-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #05d9e8 0%, #ff2a6d 50%, #cca43b 100%);
  width: 0%;
  transition: width 0.1s linear;
  position: relative;
  box-shadow: 0 0 10px rgba(5, 217, 232, 0.5);
}

/* Progress fill glow effect */
.sc-progress-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  width: 20px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8));
  filter: blur(3px);
}

/* Time display */
.sc-time-display {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: rgba(224, 224, 224, 0.5);
  letter-spacing: 1px;
}

/* ===================================
   WAVEFORM VISUALIZATION (OPTIONAL)
   =================================== */

.sc-waveform {
  width: 100%;
  height: 60px;
  margin: 15px 0;
  position: relative;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

/* Waveform bars (generated dynamically) */
.sc-waveform-bar {
  position: absolute;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, #05d9e8, transparent);
  opacity: 0.6;
  transition:
    height 0.1s ease,
    opacity 0.2s ease;
}

.sc-waveform-bar:hover {
  opacity: 1;
}

/* Active waveform section (already played) */
.sc-waveform-bar.active {
  background: linear-gradient(180deg, #ff2a6d, transparent);
  opacity: 1;
}

/* ===================================
   ENHANCED CONTROLS
   =================================== */

/* Control buttons (enhance existing styles) */
.controls button {
  /* Keep existing button styles, add hover effects */
  transition: all 0.2s ease;
}

.controls button:hover {
  border-color: #05d9e8;
  color: #05d9e8;
  text-shadow: 0 0 10px rgba(5, 217, 232, 0.8);
  transform: scale(1.1);
}

.controls button:active {
  transform: scale(0.95);
}

/* Play/pause button glow when active */
#play-pause.playing {
  border-color: #ff2a6d;
  color: #ff2a6d;
  box-shadow: 0 0 15px rgba(255, 42, 109, 0.5);
}

/* ===================================
   VOLUME CONTROL
   =================================== */

.sc-volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 8px 0;
}

.sc-volume-icon {
  font-size: 14px;
  color: rgba(224, 224, 224, 0.6);
  cursor: pointer;
  transition: color 0.2s;
}

.sc-volume-icon:hover {
  color: #05d9e8;
}

/* Custom range slider */
.sc-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
}

/* Slider thumb (WebKit) */
.sc-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  background: #05d9e8;
  cursor: pointer;
  border-radius: 50%;
  box-shadow: 0 0 5px rgba(5, 217, 232, 0.8);
  transition: all 0.2s;
}

.sc-volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.3);
  box-shadow: 0 0 10px rgba(5, 217, 232, 1);
}

/* Slider thumb (Firefox) */
.sc-volume-slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  background: #05d9e8;
  cursor: pointer;
  border: none;
  border-radius: 50%;
  box-shadow: 0 0 5px rgba(5, 217, 232, 0.8);
}

/* ===================================
   SOURCE INDICATOR
   =================================== */

.sc-source-badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(224, 224, 224, 0.6);
  letter-spacing: 1px;
  margin-left: 10px;
  vertical-align: middle;
}

.sc-source-badge.soundcloud {
  border-color: #ff5500;
  color: #ff5500;
}

.sc-source-badge.local {
  border-color: #05d9e8;
  color: #05d9e8;
}

/* ===================================
   LOADING STATE
   =================================== */

.sc-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(224, 224, 224, 0.5);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 2px;
  animation: sc-pulse 1.5s ease-in-out infinite;
}

@keyframes sc-pulse {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 1;
  }
}

/* Loading spinner */
.sc-spinner {
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: #05d9e8;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: sc-spin 0.8s linear infinite;
  display: inline-block;
  margin-right: 10px;
  vertical-align: middle;
}

@keyframes sc-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===================================
   ERROR STATE
   =================================== */

.sc-error {
  color: #ff2a6d;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 42, 109, 0.3);
  background: rgba(255, 42, 109, 0.05);
  margin-top: 10px;
  letter-spacing: 1px;
}

/* ===================================
   PLAYLIST QUEUE (OPTIONAL)
   =================================== */

.sc-queue {
  margin-top: 20px;
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #05d9e8 rgba(0, 0, 0, 0.3);
}

/* Custom scrollbar (WebKit) */
.sc-queue::-webkit-scrollbar {
  width: 4px;
}

.sc-queue::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
}

.sc-queue::-webkit-scrollbar-thumb {
  background: #05d9e8;
  border-radius: 2px;
}

.sc-queue-item {
  padding: 8px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: rgba(224, 224, 224, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.2s;
}

.sc-queue-item:hover {
  background: rgba(5, 217, 232, 0.05);
  color: #05d9e8;
  border-left: 2px solid #05d9e8;
  padding-left: 10px;
}

.sc-queue-item.active {
  background: rgba(255, 42, 109, 0.1);
  color: #ff2a6d;
  border-left: 2px solid #ff2a6d;
}

/* ===================================
   RESPONSIVE ADJUSTMENTS
   =================================== */

@media (max-width: 768px) {
  .sc-progress-container {
    height: 4px; /* Slightly thicker for touch */
  }

  .sc-time-display {
    font-size: 9px;
  }

  .sc-volume-control {
    flex-direction: column;
    gap: 5px;
  }

  .sc-volume-slider {
    width: 100%;
  }
}

/* ===================================
   INTEGRATION WITH EXISTING STYLES
   =================================== */

/* Ensure NOW PLAYING container has enough space */
#now-playing.enhanced {
  min-height: 120px;
  padding-bottom: 20px;
}

/* Hide existing HTML5 audio element if using SoundCloud */
#audio-player.hidden {
  display: none;
}

/* Smooth transitions between sources */
.sc-transition {
  transition: opacity 0.3s ease;
}

.sc-transition.fade-out {
  opacity: 0;
}

/* ===================================
   TRACK INFO MODAL
   =================================== */

.sc-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sc-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.sc-modal-content {
  position: relative;
  background: #111111;
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-width: 800px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  z-index: 10001;
  animation: sc-modal-slide-up 0.3s ease-out;

  /* Film grain effect */
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.06'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #111111, #0a0a0a);
}

/* Modal animations */
@keyframes sc-modal-slide-up {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes sc-modal-slide-down {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
}

.sc-modal-entering .sc-modal-content {
  animation: sc-modal-slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.sc-modal-exiting .sc-modal-content {
  animation: sc-modal-slide-down 0.3s cubic-bezier(0.7, 0, 0.84, 0);
}

.sc-modal-exiting .sc-modal-overlay {
  animation: sc-fade-out 0.3s ease;
}

@keyframes sc-fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.sc-modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e0e0e0;
  font-size: 24px;
  width: 35px;
  height: 35px;
  cursor: pointer;
  z-index: 10002;
  transition: all 0.2s;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
}

.sc-modal-close:hover {
  border-color: #ff2a6d;
  color: #ff2a6d;
  transform: rotate(90deg);
}

.sc-track-info-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 30px;
  padding: 30px;
}

/* Album artwork container */
.sc-track-artwork-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
  background: #000;
}

.sc-track-artwork-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.sc-track-artwork-container:hover .sc-track-artwork-img {
  transform: scale(1.05);
}

/* Artwork glow effect */
.sc-track-artwork-container::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(5, 217, 232, 0.3) 0%,
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

.sc-track-artwork-container:hover::after {
  opacity: 1;
}

.sc-no-artwork {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(
    135deg,
    rgba(5, 217, 232, 0.1),
    rgba(255, 42, 109, 0.1)
  );
  border: 2px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
  color: rgba(224, 224, 224, 0.3);
}

.sc-track-details {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.sc-track-title {
  font-family: 'Unbounded', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: #e0e0e0;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 1px;
  line-height: 1.2;
}

.sc-track-artist {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: #05d9e8;
  margin: 0;
  letter-spacing: 2px;
}

.sc-track-meta {
  display: flex;
  gap: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: rgba(224, 224, 224, 0.5);
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sc-track-description {
  margin-top: 10px;
}

.sc-track-description h3 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #cca43b;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 0 0 10px 0;
}

.sc-track-description pre {
  font-family: 'EB Garamond', serif;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(224, 224, 224, 0.8);
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 10px;
}

.sc-track-description pre::-webkit-scrollbar {
  width: 4px;
}

.sc-track-description pre::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
}

.sc-track-description pre::-webkit-scrollbar-thumb {
  background: #05d9e8;
  border-radius: 2px;
}

/* Lyrics container with scrollable box */
.sc-lyrics-container {
  margin-top: 10px;
}

.sc-lyrics-container h3 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: #cca43b;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 0 0 10px 0;
}

.sc-lyrics-scrollbox {
  width: 100%;
  height: 400px;
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.3);
  padding: 20px;
  box-sizing: border-box;
}

.sc-lyrics-scrollbox::-webkit-scrollbar {
  width: 6px;
}

.sc-lyrics-scrollbox::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.5);
}

.sc-lyrics-scrollbox::-webkit-scrollbar-thumb {
  background: #05d9e8;
  border-radius: 3px;
}

.sc-lyrics-scrollbox::-webkit-scrollbar-thumb:hover {
  background: #cca43b;
}

/* Special styling for lyrics */
.sc-lyrics {
  font-family: 'EB Garamond', serif;
  font-size: 15px;
  line-height: 1.8;
  color: rgba(224, 224, 224, 0.9);
  text-align: left;
  letter-spacing: 0.3px;
  margin: 0;
}

/* Lyrics credits section */
.sc-track-credits {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sc-track-credits h3 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: rgba(204, 164, 59, 0.7);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 0 0 10px 0;
}

.sc-track-credits pre {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.6;
  color: rgba(224, 224, 224, 0.5);
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
}

.sc-view-on-soundcloud {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #cca43b;
  text-decoration: none;
  border: 1px solid #cca43b;
  padding: 8px 16px;
  margin: 20px auto 0;
  width: fit-content;
  transition: all 0.2s;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.sc-view-on-soundcloud:hover {
  background: #cca43b;
  color: #080808;
  box-shadow: 0 0 15px rgba(204, 164, 59, 0.5);
}

/* Clickable track name indicator */
#now-playing-track {
  position: relative;
  transition: color 0.2s;
}

#now-playing-track:hover {
  color: #05d9e8;
}

#now-playing-track:hover::after {
  content: ' [CLICK FOR INFO]';
  font-size: 9px;
  color: rgba(5, 217, 232, 0.6);
  letter-spacing: 1px;
  margin-left: 8px;
}

/* ===================================
   MODAL RESPONSIVE
   =================================== */

@media (max-width: 768px) {
  .sc-track-info-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
  }

  .sc-track-artwork {
    max-width: 250px;
    margin: 0 auto;
  }

  .sc-track-title {
    font-size: 22px;
  }

  .sc-track-meta {
    flex-direction: column;
    gap: 8px;
  }

  .sc-modal-content {
    width: 95%;
    max-height: 90vh;
  }
}

/* ===================================
   ACCESSIBILITY
   =================================== */

/* Focus states for keyboard navigation */
.controls button:focus,
.sc-volume-slider:focus,
.sc-queue-item:focus {
  outline: 2px solid #05d9e8;
  outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
