/* Reset & Global */
*, *::before, *::after {
  box-sizing: border-box;
}
html, body {
  margin: 0;
  padding: 0;
  height: 100vh;
  background-color: #000;
  color: #fff;
  font-family: sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Prevents scrollbars on body */
}

/* Native Audio Suppression (Keep as is) */
audio {
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  position: absolute !important;
  z-index: -999 !important;
}

/* Now Playing Display */
.now-playing {
  height: 10vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5em;
  background-color: #111;
  border-bottom: 1px solid #333;
}

/* Slideshow Container */
.slideshow-container {
  /* Adjusted height to account for fixed footer and now-playing */
  height: calc(80vh - 10px); /* 80vh - footer padding */
  flex-grow: 1; /* Allows it to fill available space */
  width: 100%;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: #000;
}

/* Slide Logic */
.slide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: none; /* Hidden by default */
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
}
.slide.visible {
  opacity: 1;
  display: block;
}

.slide.active { /* This might be redundant if .visible is used consistently */
  display: block;
  opacity: 1;
}

/* Spacer (No longer needed if footer is fixed and slideshow takes remaining space) */
/* .audio-spacer {
  height: 5vh;
  background: #000;
} */

/* --- */
/* Footer Controls */
footer {
  width: 100%;
  height: auto; /* Changed to auto to accommodate waveform, not fixed 10vh */
  background-color: #222; /* Darker background */
  padding: 10px;
  box-sizing: border-box;
  position: fixed; /* Keep footer at the bottom */
  bottom: 0;
  left: 0;
  z-index: 1000; /* Ensure it's above other content */
  color: #fff;
  /* The display, align-items, justify-content from original footer are moved to .audio-player-panel */
}

.audio-player-panel {
  display: flex;
  justify-content: space-between; /* Pushes controls to left, waveform to right */
  align-items: center;
  width: 100%; /* Ensure it spans the full footer width */
  gap: 20px; /* Space between control group and waveform */
  min-height: 60px; /* Ensure a minimum height for the panel */
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 10px; /* Space between individual controls */
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Common button styling for all audio controls */
.audio-controls button {
  background: none; /* No background */
  border: none;
  color: #fff; /* White text/icon color */
  cursor: pointer;
  padding: 5px; /* Adjust padding for button size */
  border-radius: 5px;
  transition: background 0.3s ease, transform 0.2s ease, color 0.2s ease; /* Add color for SVG hover */
}

.audio-controls button:hover {
  background-color: #444; /* Darker background on hover */
}

.audio-controls button svg {
  display: block;
  fill: currentColor; /* Use button's text color for SVG fill */
  width: 24px; /* Ensure consistent SVG size */
  height: 24px;
}

/* Hover effect specifically for SVG icons (overrides button:hover) */
.audio-controls button:hover svg {
  transform: scale(1.1); /* Slightly enlarge icon on hover */
  color: #ff6; /* Yellowish color on hover for icons */
}


.volume-control input[type="range"] {
  -webkit-appearance: none; /* Remove default styling for Chrome/Safari */
  appearance: none;
  width: 80px; /* Adjust as needed */
  height: 8px;
  background: #555; /* Track color */
  outline: none;
  border-radius: 4px;
  transition: opacity .2s;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: #fff; /* Thumb color */
  border-radius: 50%;
  cursor: pointer;
}

.volume-control input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
}


.waveform-display {
  flex-grow: 1; /* Allows waveform to take up remaining space */
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 200px; /* Ensure waveform has some minimum width */
}

#trackTitle {
  font-weight: bold;
  margin-bottom: 5px;
  text-align: right; /* Align title with waveform */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; /* Handle long titles */
  font-size: 1.1em; /* Make title slightly larger */
}

#waveform {
  width: 100%;
  height: 50px;
  background-color: #333; /* Darker background for waveform */
  border-radius: 5px;
  overflow: hidden; /* Hide anything outside waveform area */
}

/* --- */

/* Model Selector UI (No changes here based on current task, but keep for now) */
.model-selector {
  padding: 1rem;
  background: #111;
  color: #fff;
  border-top: 1px solid #333;
  text-align: center;
  /* Position it higher so it doesn't get covered by fixed footer if it's outside main content flow */
  position: relative; /* Or adjust main height if this is always at bottom */
  margin-bottom: 90px; /* Example: to move it up above the fixed footer */
}
.model-selector h3 {
    margin-top: 0;
    margin-bottom: 10px;
}
.model-selector ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.model-selector li {
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}
.model-selector li:hover {
  background: rgba(255,255,255,0.3);
}

/* Scan Trigger (Adjusted position due to fixed footer) */
.scan-trigger {
  position: fixed; /* Changed to fixed */
  right: 10px;
  bottom: 80px; /* Adjusted to be above the new footer */
  z-index: 1001; /* Ensure it's above footer */
}
.scan-trigger button {
  padding: 6px 12px;
  background: #444;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.scan-result {
  display: inline-block;
  margin-left: 10px;
  font-size: 0.9em;
  color: #aaa;
}

/* --- */
/* Mobile Responsiveness */
@media (max-width: 768px) { /* Adjusted breakpoint for more general mobile devices */
    .now-playing { font-size: 1em; }

    .audio-player-panel {
        flex-direction: column; /* Stack controls and waveform vertically */
        align-items: flex-start; /* Align items to the start when stacked */
        gap: 15px;
    }

    .audio-controls {
        width: 100%;
        justify-content: center; /* Center controls when stacked */
    }

    .volume-control {
        width: 100%; /* Ensure volume controls span full width for better touch */
        justify-content: center;
    }
    #volumeSlider {
        width: calc(100% - 60px); /* Make slider expand, accounting for button width */
    }


    .waveform-display {
        width: 100%;
        text-align: center;
        margin-left: 0; /* Remove left margin when stacked */
    }

    #trackTitle {
        text-align: center; /* Center title when stacked */
    }

    /* Adjust button sizing for smaller screens, if needed */
    .audio-controls button {
        padding: 8px; /* Slightly larger touch target */
    }
    .audio-controls button svg {
        width: 28px; /* Larger icons for touch */
        height: 28px;
    }

    .scan-trigger {
        bottom: 120px; /* Adjust position for mobile if needed */
    }

    /* Adjust slideshow height for mobile to prevent overflow if the footer is taller */
    .slideshow-container {
        height: calc(100vh - 10vh - 120px); /* Example: (100vh - now-playing height - estimated footer height) */
    }
}

.header-bar {
  height: 10vh;
  background-color: #111;
  border-bottom: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}

.mode-switcher {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mode-switcher label {
  font-size: 0.9em;
  color: #ccc;
}

.mode-switcher select {
  background-color: #222;
  color: #fff;
  border: none;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.track-label-wrap {
  flex-grow: 1;
  text-align: center;
}

#trackLabel {
  font-size: 1.5em;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #eee;
}
