html, body {
    margin-top: 20px;
    height: auto;
    overflow-y: auto;
    font-family: Arial, sans-serif;
}

/* Smooth Fade-In Effect */
body {
    opacity: 0;
    animation: fadeIn 1s ease-in-out forwards;
    /* Default Light Mode */
    background-color: white;
    color: black;
    transition: background-color 0.8s ease-in-out, color 0.8s ease-in-out;
}

/* If dark mode is enabled, override before fade-in */
body.dark-mode {
    background-color: black;
    color: white;
}

/* Dark Mode Styles for Song List */
body.dark-mode #songList {
    background-color: #222; /* Dark background */
}

body.dark-mode #songList .list-group-item {
    background-color: #333; /* Darker shade for items */
    color: white; /* White text */
    border-bottom: 1px solid white !important;
    transition: background-color 0.8s ease-in-out, color 0.8s ease-in-out, border-color 0.8s ease-in-out;
}

body.dark-mode #songList .list-group-item:hover {
    background-color: #444; /* Lighter shade on hover */
}

body.dark-mode #songList .list-group-item.selected {
    background-color: #007bff; /* Keep blue for selected */
    color: white;
}

/* Ensure text inside song list elements also adapts */
body.dark-mode #songList .song,
body.dark-mode #songList .author {
    color: white !important;
    transition: color 0.8s ease-in-out;
}

/* Keyframe Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Dark Mode */
body.dark-mode {
    background-color: black;
    color: white;
}

/* Dark Mode for Cards */
.card {
    transition: background-color 0.8s ease-in-out, color 0.8s ease-in-out;
}

.card.dark-mode {
    background-color: #222;
    color: white;
}

/* Dark Mode Toggle Button */
#darkModeToggle {
    background-color: black;
    color: white;
    padding: 10px 15px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    transition: background-color 0.8s ease-in-out, color 0.8s ease-in-out, transform 0.1s ease-in-out;
}

/* Dark Mode - Toggle to White */
body.dark-mode #darkModeToggle {
    background-color: white;
    color: black;
}

/* Click Animation (Shrink Effect) */
#darkModeToggle:active {
    transform: scale(0.9); /* Shrinks when clicked */
}

/* Default Light Mode */
box-icon {
    fill: #333; /* Default dark gray color */
    transition: fill 0.8s ease-in-out;
}

/* Dark Mode */
body.dark-mode box-icon {
    fill: #ddd !important; /* Lighter color for dark mode */
}

.btn-dark-mode-toggle {
    background-color: black !important;
    color: white !important;
    border: 2px solid black !important;
    transition: background-color 0.8s ease-in-out, color 0.8s ease-in-out, border 0.8s ease-in-out, opacity 0.8s ease-in-out !important;
    opacity: 1;
}

/* Dark Mode - Fade to White */
body.dark-mode .btn-dark-mode-toggle {
    background-color: white !important;
    color: black !important;
    border: 2px solid white !important;
    transition: background-color 0.8s ease-in-out, color 0.8s ease-in-out, border 0.8s ease-in-out, opacity 0.8s ease-in-out;
}

/* Fade Effect */
.btn-dark-mode-toggle:hover {
    opacity: 0.7;
    transition: opacity 0.8s ease-in-out;
}

body.dark-mode .btn-dark-mode-toggle:hover {
    opacity: 0.7;
    transition: opacity 0.8s ease-in-out;
}

.container {
    width: 100%;
    max-width: 1200px;
    padding-bottom: 20px;
}

/* 🎵 Music Player Card */
.music-player {
    width: 350px;
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

/* 🎵 Center Album Art */
.album-art-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 250px; /* Maximum size */
    margin: 0 auto; /* Center the container */
}

#albumArt {
    width: 100%;
    height: auto;
    aspect-ratio: 1/1; /* Maintain square aspect ratio */
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
    max-width: 250px; /* Maximum size */
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .album-art-container {
        max-width: 200px; /* Smaller on mobile */
    }
    
    #albumArt {
        max-width: 200px; /* Smaller on mobile */
    }
}

@media (max-width: 576px) {
    .album-art-container {
        max-width: 250px; /* Even smaller on very small screens */
    }
    
    #albumArt {
        max-width: 250px; /* Even smaller on very small screens */
    }
}

/* 🎵 Controls */
.controls {
    padding-top: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}        

/* Play/Pause Button */
#playPauseBtn, #prevBtn, #nextBtn {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: #007bff;
    color: white;
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, transform 0.1s;
    padding: 10px;
    line-height: 1; /* Ensures vertical centering */
    flex-shrink: 0; /* Prevent shrinking */
}

/* Auto-play and Repeat controls container */
.d-flex.justify-content-between.align-items-center.mt-3 {
    flex-wrap: wrap; /* Allow wrapping on small screens */
    gap: 15px;
    justify-content: space-between !important;
}

/* Auto-play toggle - always on left side */
.auto-play-toggle {
    order: 1; /* Force to left side */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* Repeat button section - always on right side */
.d-flex.align-items-center.gap-2 {
    order: 2; /* Force to right side */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* Default layout - items in row */
.auto-play-toggle,
.d-flex.align-items-center.gap-2 {
    flex-direction: row;
    flex-wrap: nowrap;
}

/* Text labels */
.auto-play-toggle span,
.d-flex.align-items-center.gap-2 span {
    font-size: 12px;
    white-space: nowrap;
    text-align: center;
    line-height: 1.2;
}

/* Switch and button styling */
.switch {
    margin-bottom: 2px;
}

#repeatBtn {
    margin-bottom: 2px;
}

/* For larger screens - switch to horizontal layout */
@media (min-width: 1025px) {
    .auto-play-toggle,
    .d-flex.align-items-center.gap-2 {
        flex-direction: row;
        gap: 10px;
    }
    
    .auto-play-toggle span,
    .d-flex.align-items-center.gap-2 span {
        font-size: 14px;
    }
}

/* For medium screens - keep text below but adjust spacing */
@media (max-width: 1024px) and (min-width: 769px) {
    .auto-play-toggle,
    .d-flex.align-items-center.gap-2 {
        gap: 3px;
    }
    
    .auto-play-toggle span,
    .d-flex.align-items-center.gap-2 span {
        font-size: 11px;
    }
}

/* For very small screens - make text even smaller */
@media (max-width: 400px) {
    .auto-play-toggle span,
    .d-flex.align-items-center.gap-2 span {
        font-size: 10px;
    }
}

/* Responsive adjustments for medium screens */
@media (max-width: 992px) {
    .auto-play-toggle span,
    .d-flex.align-items-center.gap-2 span {
        font-size: 13px;
    }
}


/* Ensure text doesn't overflow */
.song-title, .author-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

#playPauseBtn:active, #prevBtn:active, #nextBtn:active {
    transform: scale(0.9);
}        

#playPauseBtn:hover, #prevBtn:hover, #nextBtn:hover {
    background: #0056b3;
}

.progress-container {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    touch-action: none; /* Prevent browser scrolling on touch */

}

.progress {
    width: 95%;
    height: 6px;
    background: #ddd;
    border-radius: 5px;
    position: relative;
    cursor: pointer;
    margin: 5px auto;
    display: block;
    -webkit-user-select: none; /* Disable selection on iOS */
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.time-display {
    display: flex;
    justify-content: space-between;
    width: 95%;
    font-size: 12px;
    margin-top: 2px; /* Reduce space between progress bar and time */
}


/* 🎵 Song Selector */
select {
    width: 100%;
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #ccc;
    margin-top: 10px;
    cursor: pointer;
}

/* 🎵 Hide YouTube Player */
.player-container {
    display: flex;
    gap: 20px;
}

.song-selector {
    width: 800px;
    background: white;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

/* 🎵 Error Message */
#errorMessage {
    color: red;
    font-size: 14px;
    margin-top: 10px;
    display: none;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.rotate {
    animation: rotate 5s linear infinite;
}

.rotate-paused {
    animation-play-state: paused;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 10px; /* Adjust spacing */
}

.volume-control input[type="range"] {
    flex-grow: 1; /* Makes slider take available space */
}

/* Remove border from the song list container */
#songList {
    border: none !important;
    border-radius: 0 !important;
}

/* Playlist Headers and Items Alignment */
.playlist-headers {
    display: flex;
    justify-content: space-between;
    padding: 0 15px 10px 15px;
    font-weight: bold;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 10px;
    transition: all 0.8s ease-in-out;
}

.playlist-headers span {
    font-size: 14px;
    color: #495057; /* Normal color for headers */
    transition: color 0.8s ease-in-out;
}

/* Song list items - 4-column layout */
#songList .list-group-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border: none !important;
    border-bottom: 1px solid #e9ecef !important;
    transition: all 0.8s ease-in-out;
    gap: 10px;
}

#songList .list-group-item:last-child {
    border-bottom: none !important;
}

#songList .list-group-item:hover {
    background-color: #f8f9fa;
    transition: background-color 0.3s ease;
}

#songList .list-group-item.selected {
    background-color: #007bff !important;
    color: white;
}

/* Column 1: Number - Simple 1. 2. 3. format */
#songList .song-number {
    width: 50px;
    text-align: center;
    font-size: 14px;
    color: #212529; /* Normal black color (not muted) */
    flex-shrink: 0;
    transition: color 0.8s ease-in-out;
}

/* Column 2: Song Name - Clean, no author name */
#songList .song-name {
    flex: 2;
    text-align: left;
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    color: #212529; /* Normal text color */
    transition: color 0.8s ease-in-out;
}

/* Column 3: Author Name - Separate column */
#songList .author-column {
    flex: 1.5;
    text-align: left;
    font-size: 13px;
    color: #212529; /* Normal black color (not muted) */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    transition: color 0.8s ease-in-out;
}

/* Column 4: Action */
#songList .song-action {
    width: 70px;
    text-align: center;
    flex-shrink: 0;
}

/* Remove button styling */
.remove-song-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.8s ease-in-out;
}

/* Selected song - White text in both light and dark modes */
#songList .list-group-item.selected .song-number,
#songList .list-group-item.selected .song-name,
#songList .list-group-item.selected .author-column {
    color: white !important;
}

/* Dark mode support */
body.dark-mode .playlist-headers {
    border-bottom-color: #444;
}

body.dark-mode .playlist-headers span {
    color: #ffffff; /* White color for headers in dark mode */
}

body.dark-mode #songList .list-group-item {
    border-bottom-color: #444 !important;
    background-color: #333;
    color: #ffffff;
}

body.dark-mode #songList .song-number {
    color: #ffffff; /* White color for numbers in dark mode */
}

body.dark-mode #songList .song-name {
    color: #ffffff; /* White color for song names in dark mode */
}

body.dark-mode #songList .author-column {
    color: #ffffff; /* White color for author names in dark mode */
}

body.dark-mode #songList .list-group-item:hover {
    background-color: #3a3a3a;
}

body.dark-mode #songList .list-group-item.selected {
    background-color: #007bff !important;
}

body.dark-mode #songList .list-group-item.selected .song-number,
body.dark-mode #songList .list-group-item.selected .song-name,
body.dark-mode #songList .list-group-item.selected .author-column {
    color: white;
}

/* Light mode: Ensure normal colors */
body:not(.dark-mode) #songList .song-number,
body:not(.dark-mode) #songList .author-column {
    color: #212529 !important; /* Force normal black color in light mode */
}

body:not(.dark-mode) #songList .list-group-item.selected .song-number,
body:not(.dark-mode) #songList .list-group-item.selected .song-name,
body:not(.dark-mode) #songList .list-group-item.selected .author-column {
    color: white !important;
}

/* Ensure the card itself transitions smoothly */
.card {
    transition: background-color 0.8s ease-in-out, color 0.8s ease-in-out, border-color 0.8s ease-in-out;
}

.card.dark-mode {
    background-color: #222;
    color: white;
}

/* Remove border from the last item to avoid extra line */
#songList .list-group-item:last-child {
    border-bottom: none !important;
}

#songList li {
    display: flex;
    justify-content: space-between; /* Creates left-right separation */
    align-items: center;
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #ddd;
    transition: background 0.3s;
}

#songList li:last-child {
    border-bottom: none;
}

#songList li:hover {
    background: #f0f0f0;
}

#songList li.selected {
    background: #007bff;
    color: white;
    font-weight: bold;
}

.song {
    flex: 1;
    text-align: left;  /* Align song name to the left */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 50%;
}

.author {
    flex: 1;
    text-align: right; /* Align author name to the right */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 50%;
}

#background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: blur(20px); /* Adjust blur intensity */
    z-index: -1; /* Send background behind everything */
    transition: background-image 0.5s ease-in-out;
}

/* 🎵 Auto-Play Toggle Styling */
.auto-play-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: bold;
}

/* 🎵 Switch Container */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 25px;
}

/* 🎵 Hide Default Checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* 🎵 Slider */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 25px;
}

/* 🎵 Slider Circle */
.slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

/* 🎵 Toggle ON */
.switch input:checked + .slider {
    background-color: #007bff;
}

/* 🎵 Move Circle when ON */
.switch input:checked + .slider::before {
    transform: translateX(24px);
}

/* 🎵 Repeat Button Styling */
/* 🎵 Controls Container */
.controls-container {
    display: flex;
    align-items: center;
    justify-content: center; /* Center horizontally */
    gap: 15px; /* Adjust spacing */
    margin-top: 10px;
}

/* 🎵 Auto-Play Toggle */
.auto-play-toggle, .repeat-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: bold;
}

/* 🎵 Repeat Button */
/* Add scale animation effect */
#repeatBtn {
    width: 45px;
    height: 45px;
    border: none;
    border-radius: 50%;
    background: #ccc;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s; /* Smooth animation */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Active state (when clicked) */
#repeatBtn:active {
    transform: scale(0.9); /* Slight shrink effect */
}

/* Active styling when repeat mode is on */
#repeatBtn.active {
    background: #007bff; /* Blue when active */
    transform: scale(1.1); /* Slight increase in size */
    transition: background 0.3s, transform 0.1s;
}

#nowPlaying {
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
    line-height: 0.8; /* Reduce line height to bring text closer */
}

#nowPlaying .status {
    font-size: 20px;
    font-weight: bold;
    display: block;
    margin-bottom: 2px; /* Reduce space below "Now Playing" */
}

#nowPlaying .song-title {
    transition: color 0.8s ease-in-out; /* Smooth transition */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    /* Fix descender cutoff issue */
    line-height: 1.0; /* Ensure enough space for descenders */
    padding-bottom: 2px; /* Prevent letters like "g, j, y" from being cut off */
    display: inline-block; /* Ensure proper text alignment */
    
    font-size: 18px;
    font-weight: bold;
    display: block;
    margin-bottom: 2px; /* Reduce space below Song Name */
}

/* Smooth transition for song title and author name */
#nowPlaying .author-name,
#songList .author { /* Apply to second card */
    transition: color 0.8s ease-in-out, opacity 0.5s ease-in-out !important;
}

/* Dark Mode Colors */
body.dark-mode #nowPlaying .song-title,
body.dark-mode #nowPlaying .author-name {
    color: white !important; /* Ensure both elements turn white in dark mode */
}

/* Light Mode Colors (Fix transition when turning OFF dark mode) */
body:not(.dark-mode) #nowPlaying .song-title {
    color: black; /* Match original light mode text color */
}

body:not(.dark-mode) #nowPlaying .author-name {
    color: #666 !important;
}

#nowPlaying .author-name {
    font-size: 14px;
    font-weight: normal;
    color: #666;
    display: block;
}        

/* Default Light Mode */
.author-name {
    color: #666; /* Light mode text */
    transition: color 0.8s ease-in-out; /* Smooth transition */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    /* Fix descender cutoff issue */
    line-height: 1.0; /* Ensure enough space for descenders */
    padding-bottom: 2px; /* Prevent letters like "g, j, y" from being cut off */
    display: inline-block; /* Ensure proper text alignment */
}

/* Dark Mode */
body.dark-mode .author-name {
    color: #bbb !important; /* Lighter text for dark mode */
}

/* Dark mode support for empty playlist and footer */
body.dark-mode .text-muted {
    color: #aaa !important; /* brighter gray for readability */
}

body.dark-mode .list-group-item.text-muted {
    background-color: transparent !important;
    border: none !important;
    color: #aaa !important;
}

body.dark-mode .text-muted a {
    color: #bbb !important;  /* links lighter gray */
}

body.dark-mode .text-muted a:hover {
    color: #fff !important;  /* hover = white */
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding-top: 20px;
    max-width: 300px;
    position: relative;
    touch-action: none; /* Prevent browser scrolling when adjusting volume */
}

.volume-bar-container {
    position: relative;
    width: 100%;
    height: 8px;
    background: #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.volume-thumb {
    position: absolute;
    top: 50%;
    width: 22px;
    height: 22px;
    background: #fff;
    border: 3px solid #007bff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: left 0.1s ease-in-out;
    box-shadow: 0px 0px 6px rgba(0, 123, 255, 0.5);
}

/* Make thumb slightly overflow progress bar */
.volume-bar-container {
    position: relative;
    width: 100%;
    height: 10px; /* Make bar slightly thicker */
    background: #ddd;
    border-radius: 5px;
    overflow: visible; /* Allow thumb to overflow */
}

.volume-bar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #007bff; /* Filled color */
    border-radius: 5px;
    transition: width 0.1s ease-in-out;
    box-shadow: none; /* Remove any shadow */
}

#volumeControl {
    -webkit-appearance: none;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    height: 8px;
    background: transparent; /* Hide default bar */
    z-index: 2; /* Keep it on top */
    cursor: pointer;
    opacity: 0; /* Hide the default slider */
}


/* Prevent color change on click */
#volumeControl:focus, 
#volumeControl:active {
    background: #aaa !important; /* Force grey */
}

/* Chrome, Safari, Edge */
#volumeControl::-webkit-slider-runnable-track {
    background: #aaa; /* Default grey */
    height: 6px;
    border-radius: 5px;
}

#volumeControl::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #666; /* Darker grey thumb */
    border-radius: 50%;
    cursor: pointer;
    margin-top: -4px;
}

/* Firefox */
#volumeControl::-moz-range-track {
    background: #aaa; /* Default grey */
    height: 6px;
    border-radius: 5px;
}

#volumeControl::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #666; /* Darker grey thumb */
    border-radius: 50%;
    cursor: pointer;
}

/* Prevent background color change on click in all browsers */
#volumeControl:focus::-webkit-slider-runnable-track,
#volumeControl:active::-webkit-slider-runnable-track {
    background: #aaa !important; /* Stays grey */
}

#volumeControl:focus::-moz-range-track,
#volumeControl:active::-moz-range-track {
    background: #aaa !important; /* Stays grey */
}

#playerContainer {
    width: 100%; 
    min-height: 200px; 
    display: flex;
    justify-content: center;
    align-items: center;
}

#player {
    width: 100%;
    max-width: 260px;
    height: 150px;
}

#playerContainer iframe {
    width: 260px;
    height: 170px;
    border-radius: 10px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
}

#togglePlayerBtn {
    background-color: #007bff;
    border-color: #007bff;
    transition: transform 0.1s ease-in-out;
}

#togglePlayerBtn:hover {
    background-color: #0056b3; /* Darker shade for hover effect */
    border-color: #0056b3;
}

#togglePlayerBtn:active {
    transform: scale(0.9); /* Shrink effect on click */
}

.card {
    border: none !important;
    box-shadow: none !important; /* Removes shadow if needed */
}

/* 🎵 General Button Styling */
.card .btn {
    transition: transform 0.1s ease-in-out, background-color 0.3s;
}

/* 🎵 Click Animation (Shrink Effect) */
.card .btn:active {
    transform: scale(0.9);
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.rotate {
    animation: rotate 5s linear infinite;
}

.rotate-paused {
    animation-play-state: paused;
}

/* Floating Settings Button */
.floating-settings {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.settings-btn {
    width: 60px;
    height: 60px;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.5s ease, box-shadow 0.5s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Smooth hover scale + shadow */
.settings-btn:hover {
    transition: 0.5s;
    transform: scale(1.1);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

/* Target the <i> icon inside button */
.settings-btn i {
    display: inline-block;
    transition: transform 0.8s ease; /* smooth rotation */
}

/* Rotate icon only on hover */
.settings-btn:hover i {
    transform: rotate(180deg);
}

.settings-menu {
    position: absolute;
    bottom: 70px;
    right: 0;
    background: white;
    border-radius: 10px;
    padding: 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.settings-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
}

.settings-header h6 {
    margin: 0;
    font-weight: 600;
}

.settings-close-btn {
    padding: 0;
    width: 20px;
    height: 20px;
    font-size: 12px;
}

.settings-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-body .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* Dark mode support for settings menu */
body.dark-mode .settings-menu {
    background: #222;
    border: 1px solid #444;
}

body.dark-mode .settings-header {
    border-bottom: 1px solid #444;
}

body.dark-mode .settings-header h6 {
    color: white;
}

body.dark-mode .settings-close-btn {
    filter: invert(1);
}

/* Scroll to Top Button */
.floating-top {
    position: fixed;
    bottom: 100px; /* Position above the settings button */
    z-index: 999; /* Just below settings button */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.floating-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.go-top-btn {
    width: 60px;
    height: 60px;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: 2px solid white;
    color: white;
}

.go-top-btn:hover {
    box-shadow: 0 6px 15px rgba(0, 123, 255, 0.4);
    background: linear-gradient(135deg, #0056b3, #004494);
    color: white;
}

/* === Alpha-style Lyrics Panel === */
#lyricsPanel {
  transition: background-color 0.8s ease-in-out, color 0.8s ease-in-out, border-color 0.8s ease-in-out;
  background-color: #fafafa;
  color: #222;
  border-radius: 6px;
  padding: 10px;
  width: 800px;
  margin: 20px auto;
  max-height: 400px;
  overflow-y: auto;
  font-family: "Segoe UI", sans-serif;
  border: none;
}

#lyricsTitle {
    font-weight: bold;
    transition: color 0.8s ease-in-out;
}

body.dark-mode #lyricsPanel {
  background-color: #222;
  color: #e6e6e6;
  border: none
}

#lyricsHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  transition: all 0.8s ease-in-out;
}

#lyricsMeta {
    font-size: 12px;
    color: gray;
    transition: color 0.8s ease-in-out;
}

#lyricsText {
  overflow-y: auto;
  font-size: 15px;
  line-height: 1.7;
  max-height: 300px;
  scroll-behavior: smooth;
  transition: color 0.8s ease-in-out;
}

.lrc-line {
  padding: 6px 8px;
  border-radius: 4px;
  transition: background 0.8s ease-in-out, color 0.8s ease-in-out;
  display: flex;
  align-items: center;
  gap: 10px;
}

.lrc-time {
  font-size: 13px;
  color: #a0a0a0;
  width: 50px;
  text-align: right;
  transition: color 0.8s ease-in-out;
}

.lrc-line.highlight {
  background: rgba(0, 123, 255, 0.18);
  color: #fff;
  font-weight: bold;
  transition: background 0.8s ease-in-out, color 0.8s ease-in-out;
}

.plain-line {
  transition: color 0.8s ease-in-out;
}

/* Dark Mode Lyrics */
body.dark-mode #lyricsPanel {
  background-color: #222;
  color: #e6e6e6;
  border: none;
}

body.dark-mode #lyricsTitle {
    color: #ffffff;
}

body.dark-mode #lyricsMeta {
    color: #bbb !important;
}

body.dark-mode .lrc-line {
  color: #e0e0e0;
}

body.dark-mode .lrc-line .lrc-time {
  color: #aaa;
}

/* Lyrics Control Buttons - Match Dark Mode Toggle Style */
.lyrics-controls button {
  background: black;
  color: white;
  border: 2px solid black;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: background-color 0.8s ease-in-out, color 0.8s ease-in-out, border 0.8s ease-in-out, opacity 0.8s ease-in-out !important;
  opacity: 1;
}

.lyrics-controls button:hover {
  opacity: 0.7;
  transition: opacity 0.8s ease-in-out;
}

/* Dark Mode - Switch to white background like dark mode toggle */
body.dark-mode .lyrics-controls button {
  background: white !important;
  color: black !important;
  border: 2px solid white !important;
  transition: background-color 0.8s ease-in-out, color 0.8s ease-in-out, border 0.8s ease-in-out, opacity 0.8s ease-in-out;
}

body.dark-mode .lyrics-controls button:hover {
  opacity: 0.7;
  transition: opacity 0.8s ease-in-out;
}

/* Click Animation (Shrink Effect) - Match dark mode toggle */
.lyrics-controls button:active {
  transform: scale(0.9);
  transition: transform 0.1s ease-in-out;
}

/* Ensure all buttons have consistent styling */
#toggleSyncBtn,
#refreshLyricsBtn, 
#openRawBtn {
  border-radius: 8px !important;
}

/* Highlighted lyric line */
.lrc-line.highlight {
  color: black;
}

body.dark-mode .lrc-line.highlight {
  color: white;
}

#lyricsPanel {
  transition: all 0.8s ease-in-out;
  opacity: 1;
}

#lyricsPanel.hidden {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: all 0.8s ease-in-out;
}

/* Smooth transitions for lyrics text content */
#lyricsText * {
  transition: color 0.8s ease-in-out, background-color 0.8s ease-in-out;
}