body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  overflow: hidden; /* Remove scrollbar */
}

/* Breadcrumbs styling */
.breadcrumbs {
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #6b7280;
  background-color: white;
  border-bottom: 1px solid #e5e7eb;
  margin: -20px -20px 0px -20px;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.breadcrumb-item:not(:last-child)::after {
  content: "›";
  color: #9ca3af;
}

.breadcrumb-link {
  color: #4b5563;
  text-decoration: none;
  transition: color 0.15s ease-in-out;
}

.breadcrumb-link:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

.breadcrumb-current {
  color: #111827;
  font-weight: 500;
}

.category {
  margin: 20px;
  padding: 20px;
  border: 1px solid #ddd;
  border-radius: 4px;
}
.category-name {
  font-size: 24px;
  margin-bottom: 15px;
  color: #333;
}
.collection {
  margin: 10px 0;
  padding: 10px;
  background: #f5f5f5;
  border-radius: 4px;
  position: relative;  /* Add this for absolute positioning of cover art */
}
.album-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
}
.album-name {
  margin: 0;
  flex-grow: 1;
}
.album-cover {
  width: 100px;
  height: 100px;
  border-radius: 4px;
  object-fit: cover;
  margin-left: 15px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Offline download button styles */
.offline-download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.offline-download-btn:disabled {
  cursor: not-allowed;
}

.offline-download-btn.text-green-500 {
  opacity: 1 !important;
}

/* Offline download button visibility: hidden on desktop until hover, always visible on mobile */
.offline-download-visibility {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.group:hover .offline-download-visibility {
  opacity: 1;
}

/* On touch devices (no hover), always show the download button */
@media (hover: none) {
  .offline-download-visibility {
    opacity: 1;
  }
}

/* Also show when already downloaded (green checkmark) */
.offline-download-visibility.text-green-500,
.offline-download-visibility.text-yellow-500 {
  opacity: 1;
}

/* Item header layout (album/playlist headers) */
.item-header-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.item-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
}

/* Action buttons container in item headers */
.item-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* On mobile, ensure action icons are visible and well-spaced */
@media (max-width: 768px) {
  .item-actions {
    gap: 1rem;
  }
  
  .item-actions button,
  .item-actions .offline-download-btn {
    min-width: 32px;
    min-height: 32px;
    opacity: 1 !important;
  }
  
  /* Force all icons in item-actions to be visible on mobile */
  .item-actions .offline-download-visibility,
  .item-actions .search-album-btn {
    opacity: 1 !important;
  }
}

/* Playlist cover: align visual style to album covers when shown in headers */
.playlist-cover {
  width: 100px;
  height: 100px;
  border-radius: 4px;
  object-fit: cover;
  margin-left: 15px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.songs-list {
  margin-left: 20px;
}
.song-item {
  padding: 12px;
  display: grid;
  grid-template-columns: 40px auto 1fr auto;  /* Updated to include position column */
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid #eee;
  justify-content: space-between; /* Add this to align name and duration */
  -webkit-tap-highlight-color: rgba(0,0,0,0); /* Remove tap highlight on mobile */
  touch-action: manipulation; /* Optimize for touch */
}
.position-number {
  color: #666;
  font-size: 0.9em;
  text-align: center;
  min-width: 30px;
}
.song-cover {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
}
.song-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.song-name {
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.song-artist {
  font-size: 0.9em;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.song-album {
  font-size: 0.8em;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.song-item:hover {
  background: #e9e9e9;
}
.song-item.playing {
  background: #e3f2fd;
}
.song-duration {
  color: #666;
  margin-left: 20px;
  font-size: 0.9em;
}
.player-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  padding: 0px;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: height 0.3s ease; /* Add transition for smooth resizing */
}

.player-container.enlarged {
  height: auto; /* Allow the container to expand to full height */
  z-index: 1000;
}

.now-playing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  position: relative;
  overflow: hidden;
  max-height: 200px;  /* Limit maximum height */
  transition: max-height 0.3s ease; /* Add transition for smooth resizing */
}

.now-playing-container.enlarged {
  max-height: none; /* Allow the container to expand to full height */
  height: 100%;
}

.now-playing-cover {
  width: 100%;
  height: auto;
  border-radius: 0;
  object-fit: cover;
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  cursor: pointer; /* Add cursor pointer */
}

.now-playing-cover.visible {
  display: block; /* Show when class is added */
}

.now-playing-cover.enlarged {
  width: auto;
  height: 100%;
  top: 0;
  transform: none;
  z-index: 0;
}

.now-playing-info {
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 2;
  background: rgba(0, 0, 0, 0.2); /* Transparent background */
  padding: 8px;
  border-radius: 4px;
  cursor: pointer; /* Add cursor pointer */
  height: 100%;
  margin-bottom: 10px;
}

.now-playing-info .song-name,
.now-playing-info .song-artist,
.now-playing-info .song-album {
  color: white; /* White font color */
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8); /* Text shadow for readability */
}

#player {
  flex-grow: inherit;
  width: 100%;
  opacity: .7;
}

.now-playing {
  font-weight: bold;
  padding: 0 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
}

/* Mobile-specific styles */
@media (max-width: 768px) {
  body {
    padding: 0;
  }

  .category {
    margin: 10px 0;  /* Reduced from 20px */
    padding: 10px;   /* Reduced from 20px */
  }

  .collection {
    margin: 5px 0;   /* Reduced from 10px */
    padding: 5px;    /* Reduced from 10px */
  }

  .songs-list {
    margin-left: 10px;  /* Reduced from 20px */
  }

  h1 {
    font-size: 1.5em;  /* Smaller name */
    margin: 10px 0;    /* Reduced margins */
  }

  .category-name {
    font-size: 1.2em;  /* Smaller category names */
    margin-bottom: 10px;
  }

  .player-container {
    padding: 0px;
    height: auto;
  }

  #player {
    height: 50px; /* Larger touch target for controls */
    margin: 0;
    width: 100%;
    height: 44px;
    z-index: 0;
  }

  #player::-webkit-media-controls-panel {
    background-color: white;
  }

  #player::-webkit-media-controls-play-button {
    height: 40px;
    width: 40px;
  }

  #player::-webkit-media-controls-timeline {
    height: 30px;
  }

  .now-playing {
    font-size: 1.1em;
    min-width: 140px;
    max-width: none;  /* Remove max-width constraint */
    min-width: 0;    /* Allow shrinking */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
    padding: 0 5px;
  }

  .song-item {
    padding: 12px 8px; /* Larger touch targets */
    min-height: 44px; /* Minimum height for touch targets */
  }

  .song-cover {
    width: 32px;
    height: 32px;
  }

  /* Make the audio player sticky at bottom */
  body {
    padding-bottom: 120px; /* Account for larger player */
  }

  .now-playing-container {
    max-height: 150px;  /* Smaller height on mobile */
  }

  .album-cover {
    width: 60px;
    height: 60px;
  }
  .playlist-cover {
    width: 60px;
    height: 60px;
  }

  /* Reduce padding on album/playlist containers */
  .mb-4.p-6,
  .mb-4.p-4 {
    padding: 0.75rem !important;
  }

  /* Album/playlist header adjustments for mobile */
  .flex.justify-between.items-start.mb-4 {
    gap: 0.5rem;
    margin-bottom: 0.5rem !important;
  }

  /* Title container with buttons - allow wrapping */
  .flex.items-center.gap-3 {
    gap: 0.35rem;
    flex-wrap: wrap;
    max-width: calc(100% - 70px); /* Leave room for cover image */
  }

  /* Make title text smaller on mobile */
  .text-xl.font-semibold,
  .text-lg.font-semibold {
    font-size: 0.95rem !important;
    line-height: 1.3;
  }

  /* Smaller action buttons on mobile */
  .offline-download-btn,
  .context-menu-btn {
    padding: 0.25rem !important;
  }

  .offline-download-btn svg,
  .context-menu-btn svg {
    width: 1rem;
    height: 1rem;
  }

  /* Reduce song list spacing */
  .songs-list .song-item {
    padding: 8px 4px;
  }
}

/* Audio player customization for all devices */
#player {
  border-radius: 8px;
  background: #f5f5f5;
}

.player-container {
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
}

.now-playing {
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 10px;
}

/* Add new styles for the menu */
.menu-button {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1001;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #333;
  padding: 8px;
  display: none; /* Hidden by default for all screen sizes */
}

.menu {
  position: fixed;
  top: 0;
  left: -250px;
  width: 250px;
  height: 100%;
  background: white;
  box-shadow: 2px 0 5px rgba(0,0,0,0.1);
  transition: left 0.3s ease;
  z-index: 1000;
}

.menu.open {
  left: 0;
}

.menu-item {
  padding: 15px 20px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

.menu-item:hover {
  background: #f5f5f5;
}

.menu-item.active {
  background: #e3f2fd;
  color: #1976d2;
}

.view {
  display: none;
  padding-top: 60px;
  height: calc(100vh - 160px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.loading-spinner {
  text-align: center;
  padding: 20px;
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
}

.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading {
  position: relative;
  opacity: 0.7;
}

.menu-divider {
  height: 1px;
  background: #eee;
  margin: 8px 0;
}

.menu-playlist {
  padding: 12px 20px;
  font-size: 0.9em;
  color: #666;
  cursor: pointer;
}

.menu-playlist:hover {
  background: #f5f5f5;
}

.menu-playlist.active {
  background: #e3f2fd;
  color: #1976d2;
}

/* Add new styles for responsive layout */
.app-container {
  width: 100%;
  height: 100vh;
  display: flex;
  overflow: hidden; /* Prevent scrolling at the container level */
}

/* Main content area */
main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.menu-button {
  display: none; /* Ensure it's hidden by default for desktop */
}

.menu {
  position: relative; /* Default position for desktop */
  width: 250px;
  height: 100vh;
  background: white;
  box-shadow: 2px 0 5px rgba(0,0,0,0.1);
  left: 0;
  z-index: 10;
  overflow-y: auto;
  flex-shrink: 0;
}

/* Desktop flex container - parent of sidebar and content */
@media (min-width: 1024px) {
  .lg\:flex.lg\:h-screen {
    display: flex !important;
    width: 100vw !important;
    max-width: 100vw !important;
  }
}

/* Main content wrapper - the parent of main element */
.lg\:flex.lg\:flex-col.lg\:min-h-screen {
  flex: 1 !important;
  min-width: 0 !important; /* Allow flex item to shrink below content size */
  display: flex !important;
  flex-direction: column !important;
}

main {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  width: 100%; /* Full width */
  max-width: none !important; /* Override any container max-width */
  height: calc(100vh - 64px); /* Account for header height */
  display: flex;
  flex-direction: column;
}

@media (min-width: 1024px) {
  main {
    height: 100vh; /* Full viewport height on desktop */
    min-height: auto;
  }
}

/* Menu overlay - applies to all screen sizes but primarily used on mobile */
.menu-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: rgba(0,0,0,0.5) !important;
  z-index: 41 !important; /* Above mobile header (40) and below nav menu (42) */
  display: block !important; /* Visible by default */
  pointer-events: auto !important;
  cursor: pointer !important;
}

.menu-overlay.hidden {
  display: none !important;
  pointer-events: none !important;
}

.confirm-modal-overlay.hidden {
  display: none !important;
}

.confirm-modal-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
}
.confirm-modal {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  padding: 18px;
}
.confirm-modal-title {
  font-weight: 600;
}
.confirm-modal-buttons button {
  cursor: pointer;
}

/* Mobile header styles */
.mobile-header {
  padding-top: env(safe-area-inset-top);
}

.menu-button-mobile {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #333;
}

/* Mobile styles */
@media (max-width: 768px) {
  .app-container {
    display: block; /* Stack layout for mobile */
    padding-top: 96px; /* Account for mobile header height */
  }

  main {
    height: calc(100vh - 160px); /* Account for mobile header and player */
    overflow-y: auto;
  }

  .menu-button {
    display: block; /* Only show hamburger on mobile */
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #333;
    padding: 8px;
  }

  .menu {
    position: fixed; /* Fixed position for mobile */
    top: 0;
    left: -250px;
    transition: left 0.3s ease;
  }

  .menu.open {
    left: 0;
  }

  main {
    padding-top: 42px !important; /* Account for fixed mobile header (first row ~56px + second row ~64px) */
    min-height: calc(100vh - 130px);
    padding-bottom: 100px; /* Account for player at bottom */
    width: 100%;
    display: block !important;
    position: relative;
  }
  
  .view {
    padding: 20px;
    min-height: 100%;
    width: 100%;
  }
}

/* Update view styles */
.view {
  width: 100%;
  padding: 20px;
  transition: padding-bottom 0.3s ease-in-out;
  display: block;
}

.view.hidden {
  display: none;
}

/* Handle player panel visibility */
body.player-visible .view {
  padding-bottom: 120px; /* 100px for player + 20px extra space */
}

.view.hidden {
  display: none !important;
}

@media (max-width: 768px) {
  .view {
    padding: 10px;
  }
}

@media (min-width: 1024px) {
  .view {
    height: 100%; /* Full height on desktop */
    min-height: calc(100vh - 150px); /* Account for search bar and padding */
  }
}

/* Add styles for install prompt */
.install-prompt {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  z-index: 1000;
  text-align: center;
}

.install-prompt.show {
  display: block;
}

.install-buttons {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  justify-content: center;
}

.install-button {
  padding: 8px 16px;
  border-radius: 4px;
  border: none;
  background: #3498db;
  color: white;
  cursor: pointer;
}

.install-later {
  padding: 8px;
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
}

.custom-player {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  position: relative;
  z-index: 10;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 4px; /* Reduced from 8px */
  position: relative;
  z-index: 11;
  min-width: fit-content; /* Prevent controls from shrinking */
}

.progress-container {
  flex-grow: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 11;
  min-width: 0; /* Allow container to shrink */
  min-width: 100px; /* Ensure minimum width */
  padding: 0 4px; /* Add padding for touch targets */
}

.volume-container {
  display: flex;
  align-items: center;
  gap: 4px; /* Reduced from 8px */
  position: relative;
  z-index: 11;
  min-width: fit-content; /* Prevent volume controls from shrinking */
}

.volume-slider {
  width: 60px; /* Reduced from 80px */
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: #ddd;
}

@media (max-width: 768px) {
  .volume-container {
    display: flex; /* Override previous display: none */
  }
  
  .progress-container {
    max-width: calc(100% - 260px); /* Reserve space for controls and volume */
  }
  
  .time-display {
    font-size: 10px; /* Smaller font for timestamps on mobile */
    min-width: 35px; /* Reduced from 45px */
  }
}

.progress-bar {
  flex-grow: 1;
  height: 4px;
  background: #ddd;
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  margin: 0 8px; /* Add margin to make bar visible */
}

.progress-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%; /* Set initial width */
  background: #3498db;
  border-radius: 2px;
}

/* Fix: Ensure volume slider is visible and not clipped */
/* Explicitly target the volume slider to override prior global input styles */
#volumeSlider {
  background: #e5e7eb !important; /* visible track */
  height: 8px !important; /* slightly taller track for visibility */
  min-width: 48px !important; /* ensure we can still see it on small screens */
  -webkit-appearance: none !important;
  appearance: none !important;
  overflow: visible !important; /* allow the thumb to be visible outside the track */
}

#volumeSlider::-webkit-slider-runnable-track {
  background: #e5e7eb !important;
  height: 8px !important;
  border-radius: 4px !important;
}

#volumeSlider::-webkit-slider-thumb {
  -webkit-appearance: none !important;
  appearance: none !important;
  background: #3498db !important;
  height: 18px !important;
  width: 18px !important;
  border-radius: 50% !important;
  border: 2px solid rgba(255,255,255,0.85) !important;
  margin-top: -5px !important; /* keep it centered visually */
  z-index: 1001 !important; /* prefer a high z-index so it's visually above elements */
}

/* Firefox specific */
#volumeSlider::-moz-range-track {
  background: #e5e7eb !important;
  height: 8px !important;
  border-radius: 4px !important;
}

#volumeSlider::-moz-range-thumb {
  background: #3498db !important;
  height: 18px !important;
  width: 18px !important;
  border-radius: 50% !important;
  border: 2px solid rgba(255,255,255,0.85) !important;
}

/* Make sure the player controls container doesn't clip the thumb */
#playerPanel .flex-shrink-0, #playerPanel .flex-shrink-0 > div {
  overflow: visible !important;
}

/* Player toggle handle styles */
.player-toggle-handle {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 24px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
  box-shadow: 0 -2px 6px rgba(0,0,0,0.08);
}

.player-toggle-handle:hover {
  background: #f3f4f6;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.12);
}

.player-toggle-handle:active {
  transform: translateX(-50%) scale(0.95);
}

.player-toggle-handle .toggle-bar {
  width: 20px;
  height: 4px;
  background: #9ca3af;
  border-radius: 2px;
  transition: background 0.2s ease;
}

.player-toggle-handle:hover .toggle-bar {
  background: #6b7280;
}

/* Player panel minimized state */
#playerPanel.minimized {
  transition: transform 0.3s ease-out;
}

#playerPanel.minimized .player-progress,
#playerPanel.minimized .flex-1.min-w-0.mr-4,
#playerPanel.minimized .flex-shrink-0 > div:not(:first-of-type),
#playerPanel.minimized #volumeSlider,
#playerPanel.minimized #muteButton,
#playerPanel.minimized #visualizer {
  display: none !important;
}

#playerPanel.minimized > .flex {
  padding: 0.5rem 1rem !important;
}

#playerPanel.minimized #now-playing-cover {
  width: 40px !important;
  height: 40px !important;
  margin-right: 0.75rem !important;
}

#playerPanel.minimized .flex-shrink-0 {
  margin-left: auto;
}

#playerPanel.minimized .flex-shrink-0 > div:first-of-type {
  margin-bottom: 0 !important;
}

#playerPanel.minimized .flex-shrink-0 > div:first-of-type button {
  width: 32px !important;
  height: 32px !important;
}

#playerPanel.minimized .flex-shrink-0 > div:first-of-type button#playPauseButton {
  width: 40px !important;
  height: 40px !important;
}

/* Show minimized track info */
#playerPanel.minimized .minimized-info {
  display: flex !important;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  margin-right: 0.5rem;
}

#playerPanel .minimized-info {
  display: none;
}

/* Add styling for position column */
.position-cell {
  width: 40px;
  text-align: center;
  color: #666;
  font-size: 0.9em;
}

/* Missing songs: display grayed out and visually disabled but still clickable for tooltip */
.missing {
  opacity: 0.4 !important;
  position: relative;
  pointer-events: auto;
}

/* Add a semi-transparent overlay to further emphasize the disabled state */
.missing::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.5);
  pointer-events: none;
  z-index: 1;
}

.missing .context-menu-btn {
  opacity: 0 !important;
}
.missing .heart-btn {
  display: none !important;
}

/* Add position column styling */
.song-row {
  display: grid;
  grid-template-columns: 50px minmax(200px, 1fr) 150px 100px 40px;
  gap: 10px;
  align-items: center;
  padding: 8px;
}

/* Drag handle styling for reordering songs */
.drag-handle {
  cursor: grab;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}
.drag-handle:active {
  cursor: grabbing;
}

/* Visual indication for disabled drag items */
.drag-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.drag-disabled-row {
  /* Slightly dim the whole row to indicate it's not draggable */
  opacity: 0.98; /* small visual hint */
}

/* Placeholder visual used during drag-and-drop */
.placeholder-song {
  min-height: 48px;
  display: block;
}
.placeholder-song {
  pointer-events: none;
}

/* Visual indicator for forbidden drop zones when dragging between playlists */
.placeholder-song.forbidden {
  border-color: #dc2626 !important; /* red */
  background-color: rgba(220, 38, 38, 0.06) !important;
  position: relative;
}
.placeholder-song.forbidden::after {
  content: "✖";
  position: absolute;
  right: 8px;
  top: 8px;
  font-size: 20px;
  color: #dc2626;
  background: rgba(255,255,255,0.8);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Global cursor hint when dragging over a forbidden target */
.dragging-not-allowed * {
  cursor: not-allowed !important;
}

/* Floating ghost indicator for forbidden drop */
.forbidden-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(220, 38, 38, 0.9);
  color: white;
  font-weight: bold;
  font-size: 16px;
}

.position-cell {
  color: #666;
  font-size: 0.9em;
  text-align: center;
}

/* Add zebra striping */
.song-row:nth-child(even) {
  background-color: rgba(0, 0, 0, 0.02);
}

/* Highlight on hover */
.song-row:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Update header to match new grid */
.songs-header {
  display: grid;
  grid-template-columns: 40px minmax(200px, 1fr) 150px 100px 40px;
  gap: 10px;
  padding: 8px;
  font-weight: bold;
  border-bottom: 1px solid #eee;
}

.song-row {
  display: grid;
  grid-template-columns: 40px minmax(200px, 1fr) 150px 100px 40px;
  gap: 10px;
  align-items: center;
  padding: 8px;
}

.position-cell {
  color: #666;
  font-size: 0.9em;
  text-align: center;
}

.status-icon {
  position: fixed;
  top: 20px;
  right: 20px;
  cursor: pointer;
  font-size: 24px;
  z-index: 1002;
  transition: transform 0.3s ease;
}

.status-panel {
  position: fixed;
  top: 60px;
  right: 20px;
  width: 300px;
  max-height: 400px;
  overflow-y: auto;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  display: none;
  z-index: 1002;
}

.status-panel.show {
  display: block;
}

.status-item {
  padding: 10px;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.status-icon-indicator {
  width: 20px;
  text-align: center;
}

.status-info {
  flex-grow: 1;
}

.status-description {
  font-size: 14px;
  margin-bottom: 4px;
}

.status-time {
  font-size: 12px;
  color: #666;
}

.status-error {
  color: #e74c3c;
  font-size: 12px;
  margin-top: 4px;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

.status-spinner {
  display: inline-block;
  animation: spin 1s linear infinite;
}

/* Add new search bar styles */
.search-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1001;
  width: 300px;
}

.search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  transition: all 0.3s;
}

.search-input:focus {
  border-color: #3498db;
  box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

/* Search results containers - styles defined below apply to both mobile and desktop */

.search-results {
  position: fixed;
  top: 70px;
  left: 15%;
  width: 70%;
  max-height: 80vh;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  overflow-y: auto;
  display: none;
  z-index: 1100;
  padding: 20px;
}

.search-category {
  margin-bottom: 12px;
}

.search-category-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: #374151;
  padding: 6px 8px;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  border-bottom: 1px solid #e5e7eb;
  background-color: #f9fafb;
}

.search-result-item {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 8px 12px !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  transition: background-color 0.2s !important;
  border-bottom: 1px solid #f0f0f0 !important;
}

.search-result-item:last-child {
  border-bottom: none !important;
}

.search-result-item:hover {
  background: #f5f5f5 !important;
}

.search-result-image {
  width: 40px !important;
  height: 40px !important;
  flex-shrink: 0 !important;
  object-fit: cover !important;
  border-radius: 4px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
}

.search-result-info {
  flex-grow: 1 !important;
  min-width: 0 !important; /* Allow text truncation */
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
  overflow: hidden !important;
}

.search-result-name {
  font-weight: 600 !important;
  font-size: 14px !important;
  color: #1a1a1a !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  line-height: 1.3 !important;
}

.search-result-artist {
  font-size: 13px !important;
  color: #666 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  line-height: 1.2 !important;
}

.search-result-album {
  font-size: 12px !important;
  color: #999 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  line-height: 1.2 !important;
}

.search-result-details {
  font-size: 12px !important;
  color: #999 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  line-height: 1.2 !important;
}

@media (max-width: 768px) {
  .search-results {
    left: 5%;
    width: 90%;
  }
}

.search-results.show {
  display: block;
}

/* Add responsive styles for search bar */
@media (max-width: 768px) {
  .search-container {
    width: calc(100% - 120px);
    max-width: 300px;
  }
}

.song-item.missing {
  opacity: 0.7;  /* Slightly increased opacity */
  cursor: not-allowed;
  background: rgba(231, 76, 60, 0.05);  /* Light red background */
}

.song-item.missing:hover {
  background: rgba(231, 76, 60, 0.08);  /* Slightly darker on hover */
}

/* Modal overlay for images */
.image-modal-overlay { 
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Custom confirm dialog */
.confirm-modal-overlay {
  pointer-events: auto;
}
.confirm-modal {
  max-width: 560px;
}
.confirm-modal-title {
  font-size: 1.125rem; /* 18px */
}
.confirm-modal-message {
  font-size: 0.95rem;
  color: #374151; /* text-gray-700 */
}
.btn-neutral {
  border: 1px solid #e5e7eb;
}
.btn-danger {
  color: #fff;
  background-color: #dc2626; /* red-600 */
}
.image-modal { 
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
}

.missing-indicator {
  font-size: 1em;
  color: #e74c3c;
  margin-left: 4px;
  opacity: 0.8;
}

.missing-indicator::after {
  content: '❌';
  vertical-align: middle;
}

/* Add visualizer styles */
#visualizer {
  width: 200px;
  height: 50px;
  margin-left: auto;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.1);
}

/* Flash indicator when visualizer mode toggles briefly */
.visualizer-mode-flash {
  outline: 2px solid rgba(59,130,246,0.8);
  transition: outline 300ms ease-in-out;
}

#visualizerIndicator {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0,0,0,0.06);
  color: #374151; /* gray-700 */
}

@media (max-width: 768px) {
  #visualizer {
    width: 100px;
    height: 40px;
  }
}

/* Update search results grid to be a list */
.search-results-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 4px 0;
}

/* Highlight class for search results navigation */
.highlight {
  background-color: #dbeafe !important;
  border: 2px solid #3b82f6 !important;
  animation: highlightPulse 1s ease-in-out;
}

@keyframes highlightPulse {
  0% { 
    background-color: #3b82f6; 
    transform: scale(1.02);
  }
  50% { 
    background-color: #60a5fa; 
  }
  100% { 
    background-color: #dbeafe;
    transform: scale(1);
  }
}

/* Auth Forms */
.auth-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  z-index: 2000;
}

.auth-container.hidden {
  display: none;
}

.auth-forms {
  background: #fff;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-form.hidden {
  display: none !important;
}

/* Hide main UI elements when not authenticated */
body.not-authenticated .menu-button,
body.not-authenticated .menu,
body.not-authenticated .menu-overlay,
body.not-authenticated main,
body.not-authenticated .player-container,
body.not-authenticated .status-icon,
body.not-authenticated .status-panel,
body.not-authenticated .search-container,
body.not-authenticated .search-results {
  display: none !important;
}

body.not-authenticated .auth-container {
  display: flex;
}

/* Show main UI elements when authenticated */
body.authenticated .auth-container {
  display: none;
}

body.authenticated .menu-button {
  display: none; /* Hide the menu button by default on all screen sizes */
}

body.authenticated .menu,
body.authenticated main,
body.authenticated .player-container,
body.authenticated .status-icon,
body.authenticated .search-container {
  display: block;
}

@media (max-width: 768px) {
  body.authenticated .menu-button {
    display: block; /* Only show hamburger on mobile */
  }
  
  body.authenticated .menu {
    display: block;
  }
}

/* Update user menu and top controls */
.top-controls {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1002;
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-button {
  position: relative;
  cursor: pointer;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  font-size: 14px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-button:hover {
  background: rgba(255, 255, 255, 1);
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 5px;
  background: white;
  border-radius: 5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  display: none;
  min-width: 150px;
  z-index: 1003;
}

.user-button.open .user-dropdown {
  display: block;
}

.dropdown-item {
  padding: 10px 15px;
  cursor: pointer;
}

.dropdown-item:hover {
  background: #f5f5f5;
}

.dropdown-divider {
  height: 1px;
  background: #eee;
  margin: 5px 0;
}

/* Reposition status icon to work with new layout */
.status-icon {
  position: static;
  cursor: pointer;
  font-size: 20px;
}

/* Update the mobile styles */
@media (max-width: 768px) {
  .top-controls {
    top: 16px;
    right: 16px;
    gap: 10px;
  }

  .user-button {
    font-size: 13px;
    padding: 4px 8px;
  }
  
  .status-icon {
    font-size: 18px;
  }
  
  /* Make sure search is not obscured */
  .search-container {
    width: calc(100% - 140px);
  }
}

/* Landscape mobile mode - player moves to the right side */
@media (max-width: 1024px) and (orientation: landscape) and (max-height: 600px) {
  /* Move player to right side */
  #playerPanel {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    width: 280px !important;
    height: 100vh !important;
    border-top: none !important;
    border-left: 2px solid #e5e7eb !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
  }

  #playerPanel > div {
    flex-direction: column !important;
    padding: 1rem !important;
    height: 100% !important;
  }

  /* Album cover at top */
  #now-playing-cover {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    margin: 0 0 1rem 0 !important;
    max-width: 240px !important;
  }

  /* Track info below cover */
  #playerPanel .flex-1 {
    margin: 0 0 1.5rem 0 !important;
    min-width: 100% !important;
  }

  /* Controls section */
  #playerPanel .flex-shrink-0 {
    width: 100% !important;
  }

  #playerPanel .flex-shrink-0 > div {
    flex-direction: column !important;
  }

  /* Play controls centered */
  #playerPanel .flex-shrink-0 > div:first-of-type {
    justify-content: center !important;
    margin-bottom: 1rem !important;
  }

  /* Progress bar full width */
  #playerPanel .flex-shrink-0 > div:nth-of-type(2),
  #playerPanel .player-progress {
    width: 100% !important;
    margin-bottom: 1rem !important;
  }

  /* Volume controls */
  #playerPanel .flex-shrink-0 > div:last-of-type {
    width: 100% !important;
  }

  #volumeSlider {
    flex: 1 !important;
  }

  /* Adjust main content to not be hidden by right panel */
  .app-container main {
    padding-right: 280px !important;
  }

  /* Adjust mobile header to not overlap with player */
  .mobile-header {
    right: 280px !important;
  }

  /* Adjust sidebar for landscape */
  .sidebar {
    right: 280px !important;
  }
}
