/* ================================================= */
/* TUNEVIZ - RESPONSIVE AUDIO VISUALIZER STYLES     */
/* ================================================= */

/* ================================================= */
/* IMPORTS & FONTS                                   */
/* ================================================= */
@import url('https://fonts.googleapis.com/css2?family=Concert+One&family=Warnes&display=swap');

/* ================================================= */
/* GLOBAL RESET & BASE STYLES                       */
/* ================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: "Concert One", sans-serif;
  overflow-x: hidden; /* Prevent horizontal scroll on mobile */
}

/* ================================================= */
/* RADIO STREAMS                                     */
/* ================================================= */
/* Desktop iframe zoom */
iframe {
  zoom: 0.75; 
  transform-origin: top left; 
  height: 100% !important; 
}

/* Mobile iframe adjustments */
@media (max-width: 900px) {
  iframe {
    zoom: 0.5; /* Zoom out more for mobile */
    width: 100% !important;
    height: 100% !important;
    border: none;
  }
}

/* ================================================= */
/* RESPONSIVE BACKGROUND                             */
/* ================================================= */
body {
  background: linear-gradient(120deg, #1e293b 0%, #0ea5e9 100%);
  background-size: 200% 200%;
  animation: bgmove 8s ease-in-out infinite;
  background-attachment: fixed; /* Keep background fixed on mobile */
}

@keyframes bgmove {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* ================================================= */
/* MOBILE-FIRST RESPONSIVE LAYOUT                   */
/* ================================================= */

/* Main container adjustments for mobile */
.min-h-screen {
  min-height: 100vh;
  min-height: 100dvh; /* Dynamic viewport height for mobile browsers */
}

/* Flex layout improvements for mobile */
.flex.flex-row {
  flex-direction: column;
}

/* ================================================= */
/* RESPONSIVE CANVAS & VISUALIZER                    */
/* ================================================= */
#visualizer {
  box-shadow: 0 0 40px 8px #3b82f6, 0 0 0 4px #1e293b;
  transition: box-shadow 0.2s;
  cursor: pointer;
  max-width: 100%;
  height: auto;
  
  /* Mobile responsive sizing */
  width: 100%;
  max-width: 95vw;
}



/* ================================================= */
/* RESPONSIVE BUTTONS & CONTROLS                     */
/* ================================================= */

/* Base button styles */
button {
  touch-action: manipulation; /* Improve touch response */
  user-select: none;
}

/* Play button with responsive hover effects */
#playButton {
  box-shadow: 0 0 0 0 #3b82f6;
  transition: box-shadow 0.3s, transform 0.2s;
  min-height: 44px; /* Minimum touch target size for mobile */
}

#playButton:active {
  transform: scale(0.97);
}

/* Hover effects (disabled on touch devices to prevent sticky hover) */
@media (hover: hover) {
  #playButton:hover, 
  #recognizeSongExtension:hover {
    box-shadow: 0 0 16px 4px #3b82f6;
  }
  
  #radioStreamsButton:hover {
    box-shadow: 0 0 16px 4px #888888;
    font-variant-ligatures: normal;
  }
  
  #stopButton:hover {
    box-shadow: 0 0 16px 4px #f87171;
  }
  
  #refreshButton:hover {
    box-shadow: 0 0 16px 4px #34d399;
  }
}

/* ================================================= */
/* RESPONSIVE FORM CONTROLS                          */
/* ================================================= */
input[type="radio"], 
input[type="checkbox"] {
  cursor: pointer;
  min-width: 20px;
  min-height: 20px; /* Ensure touch targets are large enough */
}

/* Enhanced Radio URL Input Styling */
input[type="url"] {
  min-height: 44px; /* Minimum touch target size */
  font-size: 16px; /* Prevent zoom on iOS */
  background: linear-gradient(135deg, rgba(55, 65, 81, 0.9) 0%, rgba(31, 41, 55, 0.9) 100%);
  border: 1px solid rgba(59, 130, 246, 0.2);
  backdrop-filter: blur(10px);
  color: #e2e8f0;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 0 8px rgba(59, 130, 246, 0.1);
}

input[type="url"]:hover {
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 4px 20px rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

input[type="url"]:focus {
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 0 16px rgba(59, 130, 246, 0.4),
    0 0 0 2px rgba(59, 130, 246, 0.2);
  color: #bfdbfe;
  outline: none;
}

input[type="url"]::placeholder {
  color: rgba(148, 163, 184, 0.7);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  transition: color 0.3s ease;
}

input[type="url"]:hover::placeholder {
  color: rgba(148, 163, 184, 0.9);
}

input[type="url"]:focus::placeholder {
  color: rgba(148, 163, 184, 0.5);
}

#bgImageInput {
  width: 100%;
  max-width: 180px;
  cursor: pointer;
  font-size: 14px;
}

/* ================================================= */
/* ENHANCED VOLUME SLIDER STYLING                    */
/* ================================================= */
#volumeSlider {
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  background: linear-gradient(90deg, #1e293b 0%, #334155 100%);
  border-radius: 50px;
  outline: none;
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 0 8px rgba(59, 130, 246, 0.2);
}

#volumeSlider:hover {
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 0 16px rgba(59, 130, 246, 0.4);
}

/* Webkit browsers (Chrome, Safari, Edge) */
#volumeSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid #ffffff;
  box-shadow: 
    0 4px 12px rgba(59, 130, 246, 0.4),
    0 0 0 1px rgba(59, 130, 246, 0.2);
  transition: all 0.2s ease;
  position: relative;
}

#volumeSlider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 
    0 6px 16px rgba(59, 130, 246, 0.6),
    0 0 0 2px rgba(59, 130, 246, 0.3);
}

#volumeSlider::-webkit-slider-thumb:active {
  transform: scale(0.95);
  box-shadow: 
    0 2px 8px rgba(59, 130, 246, 0.8),
    0 0 0 3px rgba(59, 130, 246, 0.4);
}

/* Firefox */
#volumeSlider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid #ffffff;
  box-shadow: 
    0 4px 12px rgba(59, 130, 246, 0.4),
    0 0 0 1px rgba(59, 130, 246, 0.2);
  transition: all 0.2s ease;
}

#volumeSlider::-moz-range-thumb:hover {
  transform: scale(1.1);
  box-shadow: 
    0 6px 16px rgba(59, 130, 246, 0.6),
    0 0 0 2px rgba(59, 130, 246, 0.3);
}

#volumeSlider::-moz-range-track {
  height: 8px;
  background: linear-gradient(90deg, #1e293b 0%, #334155 100%);
  border-radius: 50px;
  border: none;
}

/* Volume container styling */
.volume-container {
  background: linear-gradient(135deg, rgba(55, 65, 81, 0.9) 0%, rgba(31, 41, 55, 0.9) 100%);
  border: 1px solid rgba(59, 130, 246, 0.2);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.volume-container:hover {
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.1);
}

/* Volume label styling */
.volume-label {
  color: #e2e8f0;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  transition: color 0.3s ease;
}

.volume-container:hover .volume-label {
  color: #93c5fd;
}

/* Add glow effect based on volume level */
#volumeSlider[data-volume="high"] {
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 0 16px rgba(34, 197, 94, 0.4);
}

#volumeSlider[data-volume="medium"] {
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 0 16px rgba(251, 191, 36, 0.4);
}

#volumeSlider[data-volume="low"] {
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 0 16px rgba(239, 68, 68, 0.4);
}

/* ================================================= */
/* RESPONSIVE SETTINGS MENU                          */
/* ================================================= */
#settingsMenu {
  width: 320px;
  max-width: calc(100vw - 2rem); /* Prevent overflow on small screens */
}


/* ================================================= */
/* RESPONSIVE SHORTCUTS PANEL                        */
/* ================================================= */
#shortcutsPanel {
  width: 300px;
  max-width: calc(100vw - 2rem);
}


/* ================================================= */
/* RESPONSIVE TYPOGRAPHY                             */
/* ================================================= */

/* Responsive title sizing */
#title {
  font-size: clamp(2rem, 8vw, 3rem); /* Responsive font size */
}

/* ================================================= */
/* ANIMATED CHARACTERS                               */
/* ================================================= */
.color-char {
  display: inline-block;
  transition: color 0.15s;
}

/* ================================================= */
/* RESPONSIVE RADIO STREAMS PANEL                    */
/* ================================================= */
div #streams {
  width: 50vw;
  height: 60%;
  padding: 0%;
  overflow: hidden; /* Prevent content overflow */
}

#radioStreamsPanel {
  height: 740px !important; /* Fixed height for desktop */
  margin: 0.5rem !important;
  padding: 1.5rem !important;
}

.slide-in-left {
  animation: slideInLeft 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  z-index: 10;
  height: 84vh;
  max-height: 84vh;
}

@media (max-width: 900px) {
  #radioStreamsPanel {
    width: 100% !important;
    height: 50vh !important; /* Further reduced height */
    margin-top: 50vh !important; /* Larger top margin to prevent cutoff */
    padding: 10 !important; /* Remove padding for mobile */
  }

  #streams {
    width: 100% !important; /* Adjust width for mobile */
    height: 100% !important;
    padding: 0 !important;
    overflow: hidden !important; /* Prevent iframe overflow */
  }

  #radioStreamsButton {
    width: 100% !important; /* Adjust width for mobile */
    font-size: 1.15rem !important;
    margin-bottom: 0.5rem;
  }
}

@media (max-width: 900px) {
  main button {
    width: 75%;
    font-size: 1.15rem !important;
    margin-bottom: 0.5rem;
  }

  #audioControls {
    flex-direction: column;
    align-items: center;
  }

  #audioControls button {
    width: 100%;
    margin-bottom: 0.5rem;
  }

  #visualizer {
    width: 100%;
    max-width: 95vw;
    height: auto;
  }

  #shortcutsPanel {
    width: 100% !important; /* Adjust width for mobile */
    max-width: calc(100vw - 2rem);
  }
}

@keyframes slideInLeft {
  0% {
    transform: translateX(-100%);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ================================================= */
/* RESPONSIVE LAYOUT CONTAINERS                      */
/* ================================================= */

/* Main content container adjustments */
main {
  width: 100%;
  max-width: 5xl;
  margin: 0.5rem;
  padding: 1.5rem;
}

@media (max-width: 768px) {
  
  /* Adjust gaps for mobile */
  .gap-8 {
    gap: 1rem;
  }
  
  .gap-6 {
    gap: 1rem;
  }
  
  .gap-3 {
    gap: 0.75rem;
  }
}


/* ================================================= */
/* TOUCH IMPROVEMENTS                                */
/* ================================================= */

/* Prevent text selection on interactive elements */
button,
.color-char,
canvas {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}

/* Improve scrolling on mobile */
body {
  -webkit-overflow-scrolling: touch;
}

/* ================================================= */
/* ACCESSIBILITY IMPROVEMENTS                        */
/* ================================================= */

/* Focus styles for keyboard navigation */
button:focus,
input:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  body {
    animation: none;
  }
}

/* ================================================= */
/* HIGH DPI DISPLAY ADJUSTMENTS                      */
/* ================================================= */

/* Adjustments for high-density displays */
@media (-webkit-min-device-pixel-ratio: 2), 
       (min-resolution: 192dpi) {
  #visualizer {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* ================================================= */
/* PRINT STYLES                                      */
/* ================================================= */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  
  #visualizer,
  #settingsMenu,
  #shortcutsPanel {
    display: none !important;
  }
}

/* ================================================= */
/* ANIMATIONS & TRANSITIONS                          */
/* ================================================= */

/* Beating heart */
.beatingHeart {
  animation: beat 1.5s ease-in-out infinite;
  display: inline-block;
  transform-origin: center;
}

@keyframes beat {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}
