:root {
  --bg-start: #747474;
  --bg-end: #4b4b4b;
  --card-width: 540px; /* Not directly used by player anymore, but keep for reference */
  --card-height: 220px; /* Not directly used by player anymore */
  --sidebar-width: 300px; /* New variable for playlist sidebar */
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-end) 100%);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  color: #fff;
  transition: background 0.8s ease;
  overflow-x: hidden; /* Prevent horizontal scroll if content is too wide */
}

.app-container {
  display: flex;
  padding: 20px;
  width: 100%;
  /* min-height: calc(100vh - 40px); /* This sets a minimum, but flex items can still grow it */
  height: calc(100vh - 40px); /* Try setting a fixed height for the container */
  max-height: calc(100vh - 40px); /* And a max-height to prevent overflow */
  gap: 20px;
  box-sizing: border-box; /* Ensure padding is included in height calculation */
}

.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Crucial: Allow main content to scroll if its content is too tall,
     but try to keep it from expanding app-container beyond viewport height. */
  overflow-y: auto;
  min-height: 0; /* Fix for flex item overflow issues in some browsers */
}

.search-container {
  width: 100%;
  max-width: 560px;
  margin-bottom: 20px;
  z-index: 100;
  position: relative; /* Changed from absolute */
}
.search-input {
  width: 100%;
  padding: 12px 20px;
  border-radius: 12px;
  border: none;
  font-family: "Inter", sans-serif;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  outline: none;
  transition: all 0.2s ease;
  backdrop-filter: blur(5px);
}
.search-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}
.search-input:focus {
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
}
.search-results {
  width: 100%; /* Match search input width */
  max-width: 560px; /* Match search input width */
  max-height: 400px;
  background: rgba(30, 30, 30, 0.65);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 99;
  position: absolute;
  top: calc(100% + 5px); /* Position below search input */
  left: 0;
  transform: translateY(-7px);
}
.search-results.active {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

/* Title for "Recent Searches" section in the dropdown */
.recent-searches-title {
  padding: 10px 16px 5px 16px;
  font-size: 12px; /* Made it slightly smaller */
  font-weight: 600; /* Made it a bit bolder */
  color: rgba(255, 255, 255, 0.7); /* Slightly more visible */
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08); /* Softer border */
  margin-bottom: 5px;
}

/* Individual recent search item */
.recent-search-item {
  /* .result-item class is also applied for base flex styling */
  display: flex;
  justify-content: space-between; /* Query left, button right */
  align-items: center;
  padding: 10px 16px; /* Consistent padding */
  /* cursor: default; /* Optional: override .result-item's cursor if only text is clickable */
}

.recent-search-item:hover {
  background-color: rgba(255, 255, 255, 0.08); /* Consistent hover */
}

/* The clickable query text */
.recent-search-query {
  flex-grow: 1;
  cursor: pointer;
  font-size: 15px; /* Match song title size or adjust */
  color: #fff; /* Brighter for better readability */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 10px; /* Space before the X button */
}

/* The remove button for a recent search item */
.remove-recent-search-btn {
  /* .icon-action-btn class is applied for base styling (padding, border-radius) */
  /* We removed margin-left: auto from .icon-action-btn for this specific case if it was there,
     or ensure it doesn't apply if it's not needed due to justify-content: space-between */
  margin-left: 0; /* Explicitly override if .icon-action-btn has margin-left: auto */
  flex-shrink: 0;
}

.remove-recent-search-btn .icon.icon-close {
  /* .icon-action-btn .icon might set a default size (e.g., 16px) */
  width: 14px;  /* Adjust size as needed for the 'x' */
  height: 14px;
  background-color: rgba(255, 255, 255, 0.5); /* Dimmer for 'x' */
}

.remove-recent-search-btn:hover .icon.icon-close {
  background-color: #ff8080; /* Softer red on hover for 'x' */
}

.result-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s;
  overflow: hidden;
}
.result-item:hover {
  background: rgba(255, 255, 255, 0.1);
}
.result-img {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
  margin-right: 16px;
  flex-shrink: 0;
}
.result-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.result-info {
  flex: 1;
  overflow: hidden; /* Ensure text ellipsis works */
  flex-grow: 1;
  margin-right: 8px;
}
.result-title {
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-artist {
  font-size: 14px;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-area {
  display: flex;
  justify-content: center; /* Center the player itself */
  align-items: center; /* Vertically center if player-area has more height */
  width: 100%;
  margin-top: 20px; /* Space from search results or search bar */
  flex-grow: 1; /* Allow it to take space if main-content is taller */
}

.player {
  width: 570px; /* Fixed width for player */
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 24px; /* Padding inside the player card */
  /* background: rgba(0,0,0,0.1); Optional: subtle background for player card */
  /* border-radius: 12px; Optional: rounded corners for player card */
}
.album-art {
  flex: 0 0 220px;
  height: 220px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
.album-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-left: 0px;
  text-shadow: 0px 0px 12px rgba(0, 0, 0, 0.3);
  min-width: 0; /* Fix for flex item text overflow */
}

.track-title {
  font-size: 34px;
  font-weight: 700;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* max-width: 300px; /* Let flexbox handle width */
}
.artist {
  font-size: 20px;
  opacity: 0.75;
  margin-bottom: 45px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* max-width: 300px; Let flexbox handle width */
}

.seekbar {
  height: 6px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  position: relative;
  cursor: pointer;
  transition: height 0.2s ease;
}
.seekbar.active {
  height: 8px;
}
#progress {
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 3px;
}
.timecodes {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  opacity: 0.7;
  margin-top: 4px;
}
#ytPlayer {
  position: absolute;
  top: -9999px; /* Move way off screen */
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0; /* Keep hidden */
}
.loading {
  text-align: center;
  padding: 20px;
  color: rgba(255, 255, 255, 0.7);
}
/* Custom Scrollbar Styles (these should already be present and apply to .playlist-content) */
.search-results::-webkit-scrollbar,
.lyrics-content::-webkit-scrollbar,
.playlist-content::-webkit-scrollbar {
  width: 8px; /* Slightly wider for better grab-ability if desired */
}
.search-results::-webkit-scrollbar-track,
.lyrics-content::-webkit-scrollbar-track,
.playlist-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px; /* Match thumb radius */
}
.search-results::-webkit-scrollbar-thumb,
.lyrics-content::-webkit-scrollbar-thumb,
.playlist-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.35); /* Slightly more visible thumb */
  border-radius: 4px;
}

/*
.playlist-content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}
*/


/* Lyrics view */
.lyrics-info {
  flex: 1;
  display: none;
  flex-direction: column;
  justify-content: flex-start;
  text-shadow: 0px 0px 12px rgba(0, 0, 0, 0.3);
  min-width: 0;
  max-height: 220px; /* This should already be set to match album art */
  overflow: hidden; /* Ensures content that overflows max-height doesn't push parent */
}

.lyrics-content {
  flex-grow: 1;
  overflow-y: auto; /* This should already be there for lyrics scrolling */
  text-align: left;
  white-space: pre-line;
  padding-right: 10px;
  font-size: 16px;
  line-height: 1.6;
}

.lyrics-header {
  /* display: flex; */ /* Already flex from .lyrics-info if shown */
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  /* display: none; */ /* Control via .lyrics-info display */
}

.lyrics-title {
  font-size: 30px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* max-width: 300px; */
}

.lyrics-artist {
  font-size: 16px;
  opacity: 0.75;
  margin-bottom: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* max-width: 300px; */
}


.controls {
  display: flex;
  align-items: center;
  gap: 16px; /* Adjusted gap if needed */
  margin-bottom: 18px;
}
.controls i { /* Base icon style in controls */
  cursor: pointer;
  transition: 0.12s ease;
}
.controls i:active {
  transform: scale(0.94);
}

#playPause { font-size: 32px; }
#prevBtn, #nextBtn { font-size: 26px; display: none; }
#volumeBtn { font-size: 20px; }
#loopBtn { font-size: 22px; } /* Assuming you want loop button size */
#likeBtn { font-size: 22px; }
#addToPlaylistBtn { font-size: 22px; } /* New Add to Playlist button */

/* Bottom Controls Bar (wrapper for lyrics and settings toggles) */
.bottom-controls-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px; /* Space between toggles */
  z-index: 100; /* Ensure it's above other content but below modals */
}

.lyrics-toggle, .settings-toggle { /* Shared styles for these toggles */
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(5px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.lyrics-toggle:hover, .settings-toggle:hover {
  background: rgba(255, 255, 255, 0.25);
}

.lyrics-toggle i, .settings-toggle i {
  background-color: white;
  width: 22px; /* Adjust if needed */
  height: 22px; /* Adjust if needed */
}



.icon {
display: inline-block;
width: 32px; /* Default width, can be overridden by ID */
height: 32px; /* Default height, can be overridden by ID */
background-color: white;
mask-repeat: no-repeat;
mask-position: center;
mask-size: contain;
-webkit-mask-repeat: no-repeat;
-webkit-mask-position: center;
-webkit-mask-size: contain;
transition: transform 0.1s ease, background-color 0.1s ease;
}

.icon:active {
transform: scale(0.94);
}

/* Optional: common styling for icon-only buttons if you have more */
.icon-button { /* You added this class to the button in HTML */
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px; /* Example padding */
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}
.icon-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}
.icon-button .icon {
  width: 20px; /* Default icon size for icon-buttons */
  height: 20px;
  background-color: white;
}

/* New/Refined Styles for Action Buttons within list items */
.icon-action-btn { /* Common style for small icon buttons like remove/edit */
  background: none;
  border: none;
  padding: 5px; /* Adjust padding to control clickable area and spacing */
  cursor: pointer;
  display: inline-flex; /* Helps align icon inside */
  align-items: center;
  justify-content: center;
  border-radius: 50%; /* Make it circular */
  transition: background-color 0.2s ease;
  /* Position it to the right if desired within the playlist item flex layout */
  margin-left: auto; /* Pushes button to the far right of its flex container if .playlist-item is display:flex */
}

.icon-action-btn:hover {
  background-color: rgba(255, 255, 255, 0.1); /* Subtle hover effect */
}


.icon-action-btn .icon { /* Style for the icon INSIDE these action buttons */
  width: 16px;
  height: 16px;
  background-color: rgba(255, 255, 255, 0.7);
  transition: background-color 0.2s ease;
  pointer-events: none; /* <<<<<<<<<<<<<<<<<<< ADD THIS LINE */
}

.icon-action-btn:hover .icon {
  background-color: #ff6b6b; /* Change icon color on hover - e.g., red for delete */
}

.add-to-playlist-search-btn {
  flex-shrink: 0; /* Prevents the button from shrinking */
  /* .icon-action-btn already provides margin-left: auto and other base styles */
}

/* 4. Style the icon INSIDE the button for specific size */
.add-to-playlist-search-btn .icon.icon-plus-circle {
  width: 18px;  /* Or 16px to match other .icon-action-btn .icon, or 20px. Adjust to taste. */
  height: 18px; /* Match width */
}


.icon-local-file-remove {
  mask-image: url('../img/icons/download.svg');
  -webkit-mask-image: url('../img/icons/download.svg');
  /* background-color: #00ff88; /* REMOVE or COMMENT OUT this line from the general rule */
}

/* NEW RULE: Default state for the local file remove icon within an action button */
/* This ensures it's green by default, overriding the generic .icon-action-btn .icon color */
.icon-action-btn .icon.icon-local-file-remove {
  background-color: #00ff88; /* Default Green color */
}

.icon-github {
  mask-image: url('../img/icons/github.svg');
  -webkit-mask-image: url('../img/icons/github.svg');
  width: 16px; /* Adjust size as needed */
  height: 16px;
  background-color: rgba(255, 255, 255, 0.6); /* Adjust color for visibility in modal */
  flex-shrink: 0; /* Prevent shrinking */
}

.icon-settings {
  mask-image: url('../img/icons/settings.svg');
  -webkit-mask-image: url('../img/icons/settings.svg');
}

.icon-close {
  mask-image: url('../img/icons/close.svg');
  -webkit-mask-image: url('../img/icons/close.svg');
}

.icon-arrow-left {
  mask-image: url('../img/icons/arrow-left.svg');
  -webkit-mask-image: url('../img/icons/arrow-left.svg');
  /* background-color will be inherited or set by .sidebar-back-button .icon */
}
.icon-edit {
  mask-image: url('../img/icons/edit.svg');
  -webkit-mask-image: url('../img/icons/edit.svg');
}
.icon-trash {
  mask-image: url('../img/icons/trash.svg');
  -webkit-mask-image: url('../img/icons/trash.svg');
}

/* Add near other icon definitions */
.icon-shuffle {
  mask-image: url('../img/icons/shuffle.svg');
  -webkit-mask-image: url('../img/icons/shuffle.svg');
}

/* Add near .icon-loop.loop-active for active state styling */
.icon-shuffle.shuffle-active {
  background-color: #00ff88; /* Green color, same as active loop */
  transform: scale(1.1); /* Optional: visual feedback */
}

/* Adjust size for these small action buttons if needed */
.playlist-item-actions .icon {
    width: 1em; /* Or a fixed px value like 14px */
    height: 1em;
    background-color: currentColor; /* Inherit color from button */
}
.icon-play { mask-image: url('../img/icons/play.svg'); -webkit-mask-image: url('../img/icons/play.svg'); }
.icon-pause { mask-image: url('../img/icons/pause.svg'); -webkit-mask-image: url('../img/icons/pause.svg'); }
.icon-volume { mask-image: url('../img/icons/volume-loud.svg'); -webkit-mask-image: url('../img/icons/volume-loud.svg'); }
.icon-muted { mask-image: url('../img/icons/mute.svg'); -webkit-mask-image: url('../img/icons/mute.svg'); }
.icon-lyrics { mask-image: url('../img/icons/lyrics.svg'); -webkit-mask-image: url('../img/icons/lyrics.svg'); }
.icon-lyrics-on { mask-image: url('../img/icons/music.svg'); -webkit-mask-image: url('../img/icons/music.svg'); }
.icon-plus-circle {
  mask-image: url('../img/icons/plus-circle.svg');
  -webkit-mask-image: url('../img/icons/plus-circle.svg');

}
.icon-loop { /* Base style for the loop button - uses repeat.svg */
  mask-image: url('../img/icons/repeat.svg');
  -webkit-mask-image: url('../img/icons/repeat.svg');
  /* Default color is white (from .icon) */
}

/* New: Loop Playlist State (repeat.svg but green) */
.icon-loop.loop-playlist-active {
  /* Uses the default repeat.svg mask from .icon-loop */
  background-color: #00ff88; /* Green color */
  transform: scale(1.1); /* Optional: visual feedback, matches loop-song */
}

.icon-loop.loop-active { /* This class now specifically means "loop current song" */
  mask-image: url('../img/icons/repeat-1.svg'); /* with the "1" on it */
  -webkit-mask-image: url('../img/icons/repeat-1.svg');
  background-color: #00ff88; /* Green color */
  transform: scale(1.1); /* You already had this, good */
}

/* New Playlist Icons */
.icon-heart-empty {
mask-image: url('../img/icons/heart-empty.svg');
-webkit-mask-image: url('../img/icons/heart-empty.svg');

}
.icon-heart-filled {
mask-image: url('../img/icons/heart-filled.svg');
-webkit-mask-image: url('../img/icons/heart-filled.svg');
background-color: #ff6b6b; /* Liked color */

}

.icon-action-btn .icon-heart-filled {
  background-color: #ff6b6b; /* Use !important as a last resort, but often needed if other .icon styles are too general */
                                      /* Or try without !important first if the specificity is enough */
}

.icon-prev {
mask-image: url('../img/icons/prev.svg');
-webkit-mask-image: url('../img/icons/prev.svg');

}
.icon-next {
mask-image: url('../img/icons/next.svg');
-webkit-mask-image: url('../img/icons/next.svg');

}

/* Playlist Sidebar Styles - Focus here */
.playlist-sidebar {
  width: var(--sidebar-width);
  min-width: 280px;
  /* Important: Set a specific height or max-height for the sidebar.
     It should take available space in the flex container but not exceed it. */
  display: flex; /* Keep this to allow flex-grow on playlist-content */
  flex-direction: column; /* Keep this */
  background: rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  /* Core change: ensure sidebar doesn't grow beyond available vertical space */
  height: 100%; /* Take full height of its flex container slot if possible */
  max-height: 100%; /* Prevent it from exceeding the allocated height */
  overflow: hidden; /* This will hide any direct children overflow, forcing .playlist-content to scroll */
  min-height: 0; /* Another flexbox fix for potential overflow issues */
}

.playlist-sidebar-header {
  display: flex;
  /* justify-content: space-between; Keep this for overall structure */
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  position: relative; /* <<<< ADD THIS: For absolute positioning of title if needed, or for easier centering with flex */
}

.playlist-sidebar-header h3 { /* The #sidebarTitle element */
  font-size: 18px;
  font-weight: 600;
  margin: 0; /* Reset default margins */

  /* --- Centering Logic --- */
  position: absolute;       /* <<<< METHOD 1: Absolute Positioning */
  left: 50%;                /* <<<< METHOD 1 */
  transform: translateX(-50%); /* <<<< METHOD 1 */
  /* OR */
  /* flex-grow: 1;          /* <<<< METHOD 2: Flexbox Centering (Remove if using METHOD 1) */
  /* text-align: center;    /* <<<< METHOD 2 (Remove if using METHOD 1) */

  /* Ensure it doesn't overlap buttons if title is too long */
  max-width: calc(100% - 80px); /* Adjust 80px based on combined width of your back and create buttons + margins */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Styles for the sidebar back button - REFINED (Ensure this part is correct) */
.playlist-sidebar-header .sidebar-back-button {
  background: none;
  border: none;
  cursor: pointer;
  /* margin-right: auto; REMOVE THIS LINE. We want the title to push against the create button. */
  margin-right: 10px; /* <<<< ADD THIS: Add some space between back button and title */
  
  /* --- Key changes for perfect circle and centering --- */
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  transition: background-color 0.2s ease;
  flex-shrink: 0; /* <<<< ADD THIS: Prevent back button from shrinking */
}

.playlist-sidebar-header .sidebar-back-button:hover {
  /* opacity: 0.8; Remove this, use background-color change instead for icon buttons */
  background-color: rgba(255, 255, 255, 0.1);
}

.playlist-sidebar-header .sidebar-back-button .icon {
  /* Icon size should be smaller than the button's width/height
     to fit comfortably within the circle. */
  width: 18px;  /* Adjust icon size */
  height: 18px; /* Adjust icon size */
  background-color: white; /* Icon color */
  /* No need for margins on the icon if the button is using flex to center it */
}


.playlist-sidebar-header .create-playlist-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  font-size: 20px;
  font-weight: bold;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  line-height: 28px; /* Align plus vertically */
  text-align: center;
  margin-left: auto; /* <<<< ADD THIS: Add some space between title and create button */
  flex-shrink: 0;   /* <<<< ADD THIS: Prevent create button from shrinking */
}

/* General list display for playlists and songs in playlist */
.playlist-list-container { /* Wrapper for the ul if needed, or style #playlistDisplayArea directly */
  flex-grow: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 8px; /* Gap for scrollbar */
}
.playlist-list-container ul {
  list-style: none;
  padding: 0;
  margin: 0;
}


.create-playlist-btn:hover {
  background: rgba(255,255,255,0.2);
}

/* Individual Playlist Item (in the list of playlists) */
.playlist-overview-item {
  display: flex;
  align-items: center; /* Vertically align all children */
  padding: 12px 8px;
  margin-bottom: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  position: relative; /* For absolutely positioned elements if any, or just good practice */
}
.playlist-overview-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.playlist-overview-item-artwork {
  width: 50px;
  height: 50px;
  border-radius: 4px;
  margin-right: 15px;
  object-fit: cover;
  flex-shrink: 0; /* Prevent artwork from shrinking */
}

.playlist-overview-item-info {
  flex-grow: 1;     /* Allow info to take available space */
  overflow: hidden;   /* Crucial: This will contain the ellipsis */
  min-width: 0;       /* ADD THIS: Important for flex items that need to shrink and allow ellipsis */
  margin-right: 8px; /* ADD THIS: Add some space between info and action buttons */
}
.playlist-overview-item-name {
  font-size: 16px;
  font-weight: 500;
  white-space: nowrap;         /* Keep on one line */
  overflow: hidden;            /* Hide overflow */
  text-overflow: ellipsis;     /* Show ellipsis */
  margin-bottom: 3px;
  /* max-width: is not strictly needed here if parent (.playlist-overview-item-info) handles overflow */
}

.playlist-overview-item-name.playing-playlist-title,
#sidebarTitle.playing-playlist-title { /* Target the h3 directly by its ID */
  color: #00ff88; /* Same green as playing song titles in playlist items */
  /* Optionally, add a bit more visual weight if desired */
  /* font-weight: 600; */ /* Or whatever your playing song title weight is */
}

.playlist-overview-item-count {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap; /* Prevent count from wrapping if playlist name is very short */
}

.playlist-item-actions {
  display: flex;        /* Ensure buttons are in a row */
  align-items: center;  /* Vertically align buttons if they have different heights */
  flex-shrink: 0;       /* Prevent the actions container from shrinking */
  margin-left: auto;    /* This pushes it to the right if not already there due to structure */
                          /* If it's already visually to the right, this might not be needed,
                             but it's a common pattern. We can remove it if .playlist-overview-item-info
                             with flex-grow:1 and min-width:0 handles the spacing correctly. */
}

/* Individual buttons inside actions */
.playlist-item-actions button {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  padding: 3px; /* Keep padding small */
  font-size: 14px; /* Or adjust to match icon size */
  /* margin-left: 5px; Remove individual margin if using gap on parent */
}

.playlist-item-actions button:not(:last-child) {
  margin-right: 4px; /* Space between buttons, or use gap on .playlist-item-actions if supported */
}


.playlist-item-actions button:hover {
    color: white;
}

/* Styling for input field when creating/renaming */
.playlist-name-input {
  width: calc(100% - 60px); /* Adjust based on sibling elements if any */
  padding: 8px;
  margin-bottom: 5px;
  background-color: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  border-radius: 4px;
  font-size: 16px;
}
.playlist-overview-item-info .playlist-name-input { /* When renaming inline */
  font-size: 16px;
  font-weight: 500;
  width: 100%;
}

/* Playlist content scrollbar (ensure it's styled nicely) */
#playlistDisplayArea::-webkit-scrollbar { width: 8px; }
#playlistDisplayArea::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05); border-radius: 4px; }
#playlistDisplayArea::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.35); border-radius: 4px; }
#playlistDisplayArea {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.35) rgba(255, 255, 255, 0.05);
}

.playlist-content {
  flex-grow: 1; /* Allows this to take up remaining space in .playlist-sidebar - GOOD */
  overflow-y: auto; /* This enables the internal scrollbar - GOOD */
  min-height: 0; /* Flex item fix, ensures it can shrink and show scrollbar */
  padding-right: 8px; /* Adjust if scrollbar overlaps content slightly */
  scrollbar-width: thin; /* "auto" or "thin" */
  scrollbar-color: rgba(255, 255, 255, 0.35) rgba(255, 255, 255, 0.05); /* thumb track */
}


.playlist-item {
  display: flex;
  align-items: center;
  padding: 10px 5px; /* Base padding */
  margin-bottom: 8px;
  border-radius: 6px;
  cursor: pointer;
  background-color: transparent;
  user-select: none;
  /* Add transitions for smooth "sliding" and opacity change */
  transition: padding-top 0.15s ease-out, 
              padding-bottom 0.15s ease-out, 
              background-color 0.2s ease,
              opacity 0.15s ease-out; /* Added opacity transition */
}

.playlist-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.playlist-item.playing {
  background-color: rgba(255, 255, 255, 0.15);
}
.playlist-item.playing .playlist-item-title {
    color: #00ff88;
}

.playlist-item-artwork {
  width: 45px;
  height: 45px;
  border-radius: 4px;
  margin-right: 12px;
  object-fit: cover;
  flex-shrink: 0;
  pointer-events: none; /* Make sure drag events go to the li */
}

.playlist-item-info {
  flex-grow: 1;
  overflow: hidden;
  pointer-events: none; /* Make sure drag events go to the li */
}

/* Styles for the item being dragged */
.playlist-item.dragging {
  opacity: 0.5; /* Make it semi-transparent */
  background: rgba(255,255,255,0.1); /* Optional: slight background change */
  /* box-shadow: 0 4px 8px rgba(0,0,0,0.3); /* Optional: lift effect */
}

/* Styles to create visual space when dragging over an item */
.playlist-item.show-gap-above {
  padding-top: 55px; /* Adjust this value: item height (approx 45px) + margin (8px) + small buffer */
                      /* This pushes the content of *this* item down, making space above it. */
}

.playlist-item.show-gap-below {
  padding-bottom: 55px; /* Same logic, makes space below this item's content. */
}

/* Styles for the playlist overview item being dragged */
.playlist-overview-item.dragging {
  opacity: 0.5;
  background: rgba(255,255,255,0.2); /* Consistent with song dragging */
  /* box-shadow: 0 4px 8px rgba(0,0,0,0.3); /* Optional */
}

/* Styles to create visual space when dragging over a playlist overview item */
.playlist-overview-item.show-gap-above {
  /* Adjust padding based on typical height of .playlist-overview-item */
  /* .playlist-overview-item padding: 12px 8px; margin-bottom: 8px; artwork height: 50px */
  /* Roughly 50px (art) + 2*12px (padding) + 8px (margin) = 82px. Let's use a bit less. */
  padding-top: 75px;
}

.playlist-overview-item.show-gap-below {
  padding-bottom: 75px;
}

.playlist-item-title {
font-size: 15px;
font-weight: 500;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-bottom: 2px;
}

.playlist-item-artist {
font-size: 13px;
color: rgba(255, 255, 255, 0.7);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.empty-playlist-message {
text-align: center;
color: rgba(255, 255, 255, 0.6);
margin-top: 30px;
font-style: italic;
}

.playlist-item.dragging {
opacity: 0.5;
background: rgba(255,255,255,0.2);
}

/* Modal Styles - Updated for Glassmorphism */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  /* The overlay itself remains semi-transparent black to dim the background */
  background-color: rgba(0,0,0,0.4); /* Slightly less dark overlay maybe */
  /* backdrop-filter: blur(2px); /* Optional: blur the entire page behind the modal - can be performance heavy */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px; /* Add some padding so modal doesn't hit screen edges on small viewports */
}

.modal-content {
  /* Glassmorphism Background */
  background-color: rgba(255, 255, 255, 0.1); /* Very light, semi-transparent white */
  backdrop-filter: blur(15px) saturate(150%); /* Key for the frosted glass effect, adjust blur amount */
  -webkit-backdrop-filter: blur(15px) saturate(150%); /* For Safari */

  color: #f0f0f0; /* Adjust text color for readability on the new background */
  
  padding: 25px 30px;
  border-radius: 12px; /* Slightly larger radius can look nice */
  
  /* Subtle Border to define edges */
  border: 1px solid rgba(255, 255, 255, 0.18);

  width: 90%;
  max-width: 380px;
  
  /* Softer Shadow */
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.17); /* Softer, more diffused shadow */
  /* Or a simpler one: box-shadow: 0 4px 15px rgba(0,0,0,0.2); */

  position: relative;
  text-align: left;
  /* overflow: hidden; /* Can help if content inside tries to break border-radius with its own bg */
}

.close-modal-btn {
  color: rgba(255, 255, 255, 0.7); /* Adjust for new background */
  position: absolute;
  top: 12px; /* Adjust position slightly if needed */
  right: 15px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s ease;
}
.close-modal-btn:hover,
.close-modal-btn:focus {
  color: white;
}

.modal-content h4 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  color: #ffffff; /* Ensure title is clearly visible */
}

#modalPlaylistList {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 10px;
  padding-right: 5px; /* Space for scrollbar if items are wide */
}

#modalPlaylistList .modal-playlist-item {
  padding: 10px 12px;
  cursor: pointer;
  border-radius: 6px; /* Match overall aesthetic */
  margin-bottom: 6px;
  font-size: 15px;
  color: #e0e0e0; /* Slightly softer than pure white */
  transition: background-color 0.2s ease, color 0.2s ease;
  /* Optional: add a very subtle divider if needed, or rely on hover */
  /* border-bottom: 1px solid rgba(255,255,255,0.05); */
}
/* #modalPlaylistList .modal-playlist-item:last-child {
  border-bottom: none; 
} */

#modalPlaylistList .modal-playlist-item:hover {
  background-color: rgba(255,255,255,0.15); /* Slightly lighter hover */
  color: #ffffff;
}

/* Scrollbar for modal playlist list - keep it subtle */
#modalPlaylistList::-webkit-scrollbar { width: 6px; }
#modalPlaylistList::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05); border-radius: 3px; }
#modalPlaylistList::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.25); border-radius: 3px; } /* Slightly lighter thumb */
#modalPlaylistList::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.4); }
#modalPlaylistList {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) rgba(255, 255, 255, 0.05);
}

/* Styles for action buttons within the general modal */
#generalModalActions {
  margin-top: 20px;
  display: flex; /* For button layout */
  justify-content: center; /* Center buttons, or space-around/space-between */
  gap: 15px; /* Space between buttons */
}

.modal-button {
  padding: 10px 20px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  transition: background-color 0.2s ease, opacity 0.2s ease;
  min-width: 80px; /* Minimum width for buttons */
}

.modal-button.primary { /* For primary actions like "Delete", "Confirm" */
  background-color: #e53e3e; /* Example: Red for delete */
  color: white;
}
.modal-button.primary:hover {
  background-color: #c53030;
}

.modal-button.success { /* NEW: For positive actions like "Create", "Save" */
  background-color: #38A169; /* Green (Tailwind's green-600) */
  color: white;
}
.modal-button.success:hover {
  background-color: #2F855A; /* Darker Green (Tailwind's green-700) */
}

.modal-button.secondary { /* For secondary actions like "Cancel", "OK" for info */
  background-color: rgba(255, 255, 255, 0.15);
  color: #f0f0f0;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.modal-button.secondary:hover {
  background-color: rgba(255, 255, 255, 0.25);
}

/* Styles for input fields within modals */
.modal-input {
  width: 100%;
  padding: 10px 12px;
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f0f0f0;
  border-radius: 6px;
  font-size: 15px;
  box-sizing: border-box; /* Ensure padding and border don't add to width */
}
.modal-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.4);
  background-color: rgba(255, 255, 255, 0.1);
}

/* Specific styling for the create playlist modal actions if needed,
   otherwise the general #generalModalActions styling might be sufficient if adapted.
   The HTML above used text-align: right directly on #createPlaylistModalActions.
*/
#createPlaylistModalActions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end; /* Align buttons to the right */
  gap: 10px;
}

/* Adjust modal content for new layout if needed */
#createPlaylistModal .modal-content,
#editPlaylistModal .modal-content {
    max-width: 420px; /* Slightly wider if needed */
}

/* Styles for Modal Artwork Editor */
.modal-artwork-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

/* Settings Modal Styles */
#settingsModal .modal-content {
  max-width: 480px; /* Or adjust as needed */
}

.settings-section {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255,255,255,0.1); /* Apply border to ALL sections by default */
}

/* Now, specifically REMOVE the border from the section we marked */
.settings-section.last-content-section {
  border-bottom: none;
}

/* The footer's top border is still active and will create the line */
.settings-modal-footer {
  margin-top: 25px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.1); /* This is the key separator */
}


.settings-section h5 {
  font-size: 16px;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 8px;
  color: #f0f0f0;
}

.settings-description {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
  margin-bottom: 12px;
}
.settings-description strong {
    color: #ffc107; /* Warning yellow or similar */
}

/* Settings Modal Footer for GitHub Info */
.settings-modal-footer {
  margin-top: 25px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

.settings-modal-footer .icon-github {
  margin-right: 2px; /* Slight adjustment from gap for visual balance */
}

.settings-modal-footer .commit-link {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: color 0.2s ease;
}
.settings-modal-footer .commit-link:hover {
  color: #ffffff;
  text-decoration: underline;
}

.settings-modal-footer #latestCommitSha {
  font-family: 'Courier New', Courier, monospace; /* Monospaced for SHA */
  background-color: rgba(255,255,255,0.08);
  padding: 2px 5px;
  border-radius: 3px;
}

.settings-modal-footer .commit-separator {
  color: rgba(255, 255, 255, 0.4);
}

.settings-modal-footer #latestCommitTimeAgo {
  min-width: 50px; /* Prevent layout jump as time string changes */
  text-align: left;
}


.file-drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  padding: 25px;
  text-align: center;
  cursor: pointer;
  background-color: rgba(255, 255, 255, 0.05);
  transition: background-color 0.2s ease, border-color 0.2s ease;
  margin-bottom: 10px;
}

.file-drop-zone:hover, .file-drop-zone.drag-over {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: #00ff88; /* Accent color on hover/drag */
}

.drop-zone-prompt {
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
}

#importDataBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.selected-file-name-display {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    margin-top: 8px;
    text-align: center;
    min-height: 1.2em; /* Prevent layout shift when text appears/disappears */
    word-break: break-all;
}

.local-files-upload-area {
  border: 2px dashed #00ff88; /* Green dashed border */
  border-radius: 8px;
  padding: 25px;
  text-align: center;
  cursor: pointer;
  background-color: rgba(0, 255, 136, 0.05); /* Very light green background */
  transition: background-color 0.2s ease, border-color 0.2s ease;
  margin: 15px 0; /* Spacing below title / before song list */
  color: rgba(255, 255, 255, 0.7);
}
.local-files-upload-area:hover, .local-files-upload-area.drag-over {
  background-color: rgba(0, 255, 136, 0.1);
  border-color: #00dd77; /* Slightly darker green on hover/drag */
}
.local-files-upload-area .drop-zone-prompt-local {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  pointer-events: none; /* Allow clicks to pass to parent uploadArea */
}


.playlist-artwork-editor {
  width: 120px; /* Adjust size as needed */
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  background-color: rgba(0,0,0,0.2); /* Placeholder bg */
  margin-bottom: 10px;
  border: 1px dashed rgba(255,255,255,0.2); /* Visual cue for drop */
}

.modal-artwork-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.2s ease-in-out;
}

.playlist-artwork-editor .edit-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
  color: white;
  text-align: center;
  pointer-events: none; /* Let clicks pass through to editor div */
}

.playlist-artwork-editor:hover .edit-overlay {
  opacity: 1;
}
.playlist-artwork-editor:hover .modal-artwork-preview {
  filter: brightness(0.7);
}

.playlist-artwork-editor .edit-overlay .icon {
  width: 24px;
  height: 24px;
  margin-bottom: 5px;
}
.playlist-artwork-editor .edit-overlay span {
  font-size: 12px;
  padding: 0 5px;
}

.playlist-artwork-editor.drag-over {
  border-color: #00ff88; /* Highlight when dragging over */
  background-color: rgba(0,255,136,0.1);
}

.clear-artwork-btn {
  font-size: 13px;
  padding: 6px 12px !important; /* Ensure smaller padding */
  min-width: auto; /* Override general modal button min-width */
}

.modal-button.tertiary { /* For "Clear Artwork" button */
  background-color: rgba(255, 255, 255, 0.1);
  color: #ccc;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.modal-button.tertiary:hover {
  background-color: rgba(255, 255, 255, 0.18);
  color: white;
}

.form-group label { /* Style for labels above inputs */
    color: #ccc; /* Lighter than main text */
}

/* Toast Notifications (add towards the end of all.css) */
.toast-container {
  position: fixed;
  bottom: 20px; /* Adjust as needed, consider lyrics toggle */
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000; /* Above most other elements */
  display: flex;
  flex-direction: column-reverse; /* New toasts appear above older ones if multiple */
  align-items: center;
  gap: 10px;
  pointer-events: none; /* Allow clicks to pass through the container itself */
}

.toast-message {
  /* Glassmorphism */
  background-color: rgba(50, 50, 50, 0.6); /* Darker semi-transparent for contrast */
  backdrop-filter: blur(10px) saturate(150%);
  -webkit-backdrop-filter: blur(10px) saturate(150%);
  color: #f0f0f0;
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  max-width: 80vw; /* Prevent very wide toasts on large screens */

  opacity: 0;
  transform: translateY(30px) scale(0.95); /* Initial state for animation: off-screen and slightly smaller */
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
  pointer-events: auto; /* Toasts themselves are clickable/interactive if needed in future */
}

.toast-message.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Credits Footer */
.credits-footer {
  position: fixed;
  bottom: 20px;
  left: 20px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1); /* Subtle light glass */
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.65);
  font-size: 12px;
  font-weight: 400;
  z-index: 95; /* Below main controls (100) but above general background */
  transition: transform 0.25s ease-out, box-shadow 0.25s ease-out;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  display: flex; /* For vertical alignment if needed, though simple text should align */
  align-items: center;
}

.credits-footer:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  background: rgba(255, 255, 255, 0.15); /* Slightly brighter on hover */
}

.credits-footer .credit-heart {
  color: #e74c3c; /* Red heart */
  display: inline-block; /* Allows transform */
  margin: 0 3px; /* Spacing around heart */
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Bouncy transition */
}

.credits-footer:hover .credit-heart {
  transform: scale(1.3);
}

.credits-footer .credit-link {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
  margin-left: 3px; /* Spacing before link */
}

.credits-footer .credit-link:hover {
  color: #ffffff;
  text-decoration: underline;
} 

/* Responsive adjustments */
@media (max-width: 960px) { /* Adjust breakpoint as needed */
  .app-container {
    flex-direction: column;
    height: auto; /* Allow app container to grow if content is very tall */
    min-height: 100vh;
  }
.main-content {
  max-width: 100%; /* Allow main content to use full width */
  order: 1; /* Player first */
}
.playlist-sidebar {
  width: 100%;
  max-width: 570px; /* Or match player width */
  margin: 20px auto 0 auto; /* Center sidebar below player */
  order: 2; /* Playlist below player */
  height: auto; /* Auto height */
  max-height: 40vh; /* Limit height to prevent excessive scrolling */
}
.player {
  width: 100%; /* Make player responsive */
  max-width: 570px; /* Max width for player */
}
.search-container {
    max-width: 570px; /* Match player width */
}
.search-results {
    max-width: 570px; /* Match player width */
}




}

@media (max-width: 600px) {
  .player {
      flex-direction: column;
      align-items: center;
      gap: 20px;
      padding: 20px;
  }
  .album-art {
      flex-basis: auto; /* Allow it to shrink if needed */
      width: 180px;
      height: 180px;
  }
  .info {
      align-items: center; /* Center info content */
      text-align: center;
  }
  .track-title {
      font-size: 28px;
  }
  .artist {
      font-size: 18px;
      margin-bottom: 30px;
  }
  .lyrics-info {
      align-items: center;
      text-align: center;
  }
  .lyrics-title {
      font-size: 26px;
  }
  .lyrics-artist {
      font-size: 16px;
  }

  .credits-footer {
    font-size: 11px; /* Slightly smaller on very small screens */
    padding: 6px 10px;
    bottom: 15px;
    left: 15px;
  }
}