:root {
    /* Light Mode Variables (Angelical) */
    --background-color: #fcfdff; /* Very light, almost white with a hint of blue */
    --dark-background: rgb(173, 216, 230); /* Azul celeste for header/nav */
    --text-color: #3a4a5a; /* Soft dark blue-grey */
    --light-text-color: #2a3038; /* Dark text for elements on light backgrounds like header */
    --secondary-text-color: #7a8da0; /* Muted light blue-grey */
    --border-color: #e3effa; /* Very light blue border */
    --player-background: #ffffff; /* Pure white */
    --player-border-top: #e3effa;
    --primary-color: #ffd700; /* Gold, bright and ethereal */
    --primary-color-rgb: 255, 215, 0; /* RGB for primary color */
    --main-bg-image: url('light_background_angelic.png'); /* Angelic background for light mode */
    --popup-background: #f7faff; /* Slightly off-white for popup */
    --popup-border: #ccddee; /* Light blue border for popup */

    /* New: Transparency variables */
    --header-opacity: 0.7;
    --track-card-opacity: 0.7;

    /* Icon Filters (black icons for Angelical) */
    --control-icon-filter: brightness(0) saturate(100%) invert(10%) sepia(20%) hue-rotate(180deg) brightness(90%) contrast(90%); /* Makes black icons a soft, dark blue-grey */
    --main-play-pause-icon-filter: brightness(0) invert(1) sepia(1) saturate(1000%) hue-rotate(0deg) brightness(100%) contrast(100%); /* Turns black to gold */
    /* --burger-icon-color: var(--light-text-color); Removed */

    --font-family-base: 'Inter', sans-serif; /* Base font family */
    --font-size-base: 16px; /* Base font size */
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease; /* Smooth theme transitions */
}

/* Dark Mode Variables (Demoniacal) */
body.dark-mode {
    --background-color: #1c0000; /* Very deep, dark red/black */
    --dark-background: #0a0000; /* Almost pure black, hint of deepest red for header/darker sections */
    --text-color: #f0d0d0; /* Pale, ghost-like red */
    --light-text-color: #ffe0e0; /* Brighter pale red for header text */
    --secondary-text-color: #996666; /* Muted dark red */
    --border-color: #4d0000; /* Deep blood red */
    --player-background: #2a0000; /* Dark, deep red-black */
    --player-border-top: #4d0000;
    --primary-color: #ff0000; /* Fiery red */
    --primary-color-rgb: 255, 0, 0; /* RGB for primary color */
    --secondary-accent-color: #ff6600; /* Burning orange */
    --main-bg-image: url('dark_background_demonic.png'); /* Demonic background for dark mode */
    --popup-background: #1a0000; /* Darker red for popup */
    --popup-border: #660000; /* Deep red border for popup */

    /* Inherit --header-opacity and --track-card-opacity from root, or override if needed */

    /* Icon Filters for Dark Mode (Demoniacal) */
    --control-icon-filter: brightness(0) invert(1) sepia(1) saturate(5000%) hue-rotate(340deg) brightness(100%) contrast(100%); /* Turns black to fiery orange-red */
    --main-play-pause-icon-filter: brightness(0) invert(1) sepia(1) saturate(5000%) hue-rotate(0deg) brightness(100%) contrast(100%); /* Turns black to pure fiery red */
    /* --burger-icon-color: var(--light-text-color); Removed */
}

body {
    font-family: var(--font-family-base); /* Use base font family */
    font-size: var(--font-size-base); /* Use base font size */
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    background-image: var(--main-bg-image); /* taca a background image no app */
    background-size: cover; /* ativa na viewport */
    background-position: center; 
    background-attachment: fixed; /* Parallax */
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header */
.header {
    background-color: var(--dark-background);
    padding: 0; 
    color: var(--light-text-color);
    position: sticky; 
    top: 0; 
    z-index: 1001; 
    opacity: var(--header-opacity); /* Variável de transparência */
}
.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.header-content {
    display: flex;
    justify-content: center; /* Centraliza a busca */
    align-items: center;
    padding-bottom: 0px; 
    min-height: 50px; 
    gap: 20px;
}

/* New: Header Container for padding/max-width */
.header-controls-right {
    /* Keeping this block but ensuring it's hidden or unused as controls moved */
    display: flex;
    align-items: center;
    gap: 10px; /* Space between toggle and settings button */
    flex-shrink: 0;
}

/* Header Settings Button */
.header-settings-btn {
    display: none;
}
.header-settings-btn:hover {
}
.header-settings-btn:active {
}


.logo {
    /* Centralizado */
    margin-left: 0;
    margin-right: 0;
    flex-shrink: 0; /* Previne o fatiamento */
}
.header-content {
    justify-content: center;
}
.logo {
    
}
.dark-mode-toggle-btn {
    display: none; /* Hide if element is still in the DOM */
}
.dark-mode-toggle-btn:hover {
}
.dark-mode-toggle-btn:active {
}

.dark-mode-toggle-btn .dark-mode-icon {
    display: block; 
}

/* Main Content */
.main-content {
    flex-grow: 1; /* enfia a porra do footer no lugar certo */
    padding: 20px 15px;
}

h1 {
    font-size: 2em;
    margin-bottom: 20px;
    color: var(--text-color);
}

/* Search Bar */
.search-bar-container {
    position: relative; /* For positioning the clear button */
    margin-bottom: 0px; /* Removed margin-bottom */
    width: 100%;
    display: flex; /* To align input and button */
    align-items: center;
}

/* New: Specific styling for the search bar when in the header */
.header-search-bar {
    padding: 5px 0; /* Add minimal vertical padding directly to the search bar container */
}

#search-input {
    flex-grow: 1; /* Allow input to take available space */
    padding: 8px 15px; /* Reduced vertical padding inside the input */
    padding-right: 40px; /* Make space for the clear button */
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--player-background); /* Use a consistent background */
    color: var(--text-color);
    font-size: 1em;
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
    transition: border-color 0.3s ease, background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

#search-input::placeholder {
    color: var(--secondary-text-color);
}

#search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.2); 
}

/* Clear Search Button */
.clear-search-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--secondary-text-color);
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px;
    display: none; /* Hidden by default, shown when input has value */
    transition: color 0.2s ease, transform 0.2s ease;
}

.clear-search-btn:hover {
    color: var(--text-color);
    transform: scale(1.1);
}
.clear-search-btn:active {
    transform: scale(0.9);
}

/* For dark mode, adjust search input colors */
body.dark-mode #search-input {
    border-color: var(--border-color); /* Reusing border-color for consistency */
    background-color: var(--player-background); /* Reusing player-background for consistency */
    color: var(--text-color);
}

body.dark-mode #search-input::placeholder {
    color: var(--secondary-text-color);
}

body.dark-mode #search-input:focus {
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.3);
}

.track-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); /* Responsive grid */
    gap: 20px;
}

.track-card {
    background-color: var(--player-background); /* Use player background for cards */
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    text-align: center;
    border: 1px solid var(--border-color); /* Subtle border for definition */
    opacity: var(--track-card-opacity); /* Use transparency variable */
}

body.dark-mode .track-card {
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); /* Stronger shadow in dark mode */
}

.track-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    opacity: 1; /* Full opacity on hover */
}
body.dark-mode .track-card:hover {
    box-shadow: 0 6px 12px rgba(0,0,0,0.4);
}


.track-card.playing {
    border: 2px solid var(--primary-color);
    transform: scale(1.02); /* Slightly enlarge playing card */
    box-shadow: 0 0 15px rgba(var(--primary-color-rgb), 0.5);
    opacity: 1; /* Full opacity for playing track */
}

/* Loading state for track cards */
.track-card.loading {
    opacity: 0.5;
    cursor: wait;
    pointer-events: none; /* Disable interaction during loading */
    border: 2px dashed var(--secondary-text-color);
}


.track-cover-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 Aspect Ratio */
    overflow: hidden;
}

.track-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.track-info {
    padding: 10px;
    display: flex; /* Make track info a flex container */
    flex-direction: column; /* Stack title, artist, and actions */
    gap: 8px; /* Space between elements */
}

.track-title {
    font-weight: 600;
    font-size: 1.1em;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0; /* Reset margin */
}

.track-artist {
    font-size: 0.9em;
    color: var(--secondary-text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-actions {
    margin-top: auto; /* Push actions to the bottom of the info area */
    display: flex; /* Make it a flex container */
    justify-content: center; /* Center the lyrics button */
    align-items: center;
}

/* New: Lyrics Button */
.lyrics-btn {
    background-color: var(--dark-background); /* Use a themed background */
    color: var(--light-text-color); /* Themed text color */
    border: 1px solid var(--border-color);
    /* padding: 8px 12px; Removed for icon sizing */
    border-radius: 5px;
    font-size: 1.2em; /* Adjusted font size for icon */
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
    width: 38px; /* Fixed width for square icon button */
    height: 38px; /* Fixed height for square icon button */
    display: flex; /* Use flexbox to center the icon */
    align-items: center;
    justify-content: center;
    /* width: calc(100% - 20px); Removed */
    /* margin: 0 auto; Removed */
    /* display: block; Removed */
}

.lyrics-btn:hover:not(:disabled) {
    background-color: var(--primary-color); /* Highlight on hover */
    color: #fff; /* White text for contrast on primary color */
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.lyrics-btn:active:not(:disabled) {
    transform: translateY(0);
}

.lyrics-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--border-color);
    color: var(--secondary-text-color);
}

body.dark-mode .lyrics-btn:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: #0a0000; /* Darker text on bright red */
}


/* Message for no search results */
.no-results-message {
    font-size: 1.2em;
    font-style: italic;
    color: var(--secondary-text-color);
    text-align: center;
    padding: 30px 0;
    grid-column: 1 / -1; /* Span across all columns */
    opacity: 0.8;
}

/* Player Bar */
.player-bar {
    background-color: var(--player-background);
    border-top: 1px solid var(--player-border-top);
    padding: 10px 0;
    position: sticky; /* Sticky footer */
    bottom: 0;
    width: 100%;
    z-index: 1000;
}

.player-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping on mobile */
    gap: 15px; /* Spacing between sections */
}

.track-info-player {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 150px; /* Ensure it doesn't shrink too much */
}

.player-cover {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.player-details {
    display: flex;
    flex-direction: column;
}

.player-artist {
    font-size: 0.8em;
    color: var(--secondary-text-color);
}

.player-title {
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text-color);
}

.controls-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1; /* Take up available space */
    min-width: 200px; /* Ensure controls have enough space */
    gap: 5px; /* Gap between playback-actions and progress-bar-container */
}

/* New: Wrapper for player controls and volume controls */
.playback-actions {
    display: flex;
    align-items: center;
    gap: 20px; /* Spacing between the button group and volume controls */
    justify-content: center; /* Center the group within controls-progress */
    flex-wrap: wrap; /* Allow volume to wrap if space is very tight */
}

.player-controls {
    display: flex;
    gap: 10px;
    /* margin-bottom: 5px; Removed, as it's now handled by gap in playback-actions or controls-progress */
}

.control-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px; /* Larger touch target */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.control-btn:hover {
    transform: scale(1.1);
}
.control-btn:active {
    transform: scale(0.9);
}
/* Disable hover/active effects when button is disabled */
.control-btn[disabled]:hover,
.control-btn[disabled]:active {
    transform: none;
    cursor: default;
    opacity: 0.7;
}


.control-btn img {
    height: 20px;
    width: 20px;
    filter: var(--control-icon-filter); /* Use themed filter */
    transition: filter 0.3s ease; /* Smooth transition */
}

.main-play-pause img {
    height: 28px;
    width: 28px;
    /* No filter or transition here, handled by specific selectors below */
}

/* Apply filter ONLY to play.png when it's the src */
.main-play-pause img[src="play.png"] {
    filter: var(--main-play-pause-icon-filter);
    transition: filter 0.3s ease; /* Smooth transition for filter change */
}

/* Ensure no filter is applied to pause images (pause.png or pause_dark.png) as they are full-color */
.main-play-pause img:not([src="play.png"]) {
    filter: none;
    transition: none; /* No filter transition for these images */
}

/* Shuffle button active state */
.control-btn.shuffle-btn--active img {
    filter: var(--main-play-pause-icon-filter); /* Use primary color filter to highlight when active */
}

/* Repeat button active state (new) */
.control-btn.repeat-btn--active img {
    filter: var(--main-play-pause-icon-filter); /* Use primary color filter to highlight when active */
}


.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.time-display {
    font-size: 0.75em;
    color: var(--secondary-text-color);
    width: 35px; /* Fixed width for time display */
    text-align: center;
}

.seek-bar {
    flex-grow: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: var(--border-color); /* Use themed color */
    outline: none;
    opacity: 0.7;
    transition: opacity 0.2s, background 0.3s ease;
    border-radius: 2px;
}

.seek-bar:hover {
    opacity: 1;
}

.seek-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: background 0.3s ease;
}

.seek-bar::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: background 0.3s ease;
}
/* Disabled seek bar */
.seek-bar[disabled] {
    opacity: 0.4;
    cursor: default;
}
.seek-bar[disabled]::-webkit-slider-thumb,
.seek-bar[disabled]::-moz-range-thumb {
    background: var(--secondary-text-color);
    cursor: default;
}


.volume-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px; /* Ensure it has space */
    /* Removed justify-content: center; margin-top: 10px; as these were for mobile and are now handled by parent */
}

.volume-icon {
    height: 20px;
    width: 20px;
    filter: var(--control-icon-filter); /* Use themed filter */
    transition: filter 0.3s ease, transform 0.2s ease;
}
.volume-controls:hover .volume-icon {
    transform: scale(1.1);
}
.volume-controls:active .volume-icon {
    transform: scale(0.9);
}


.volume-bar {
    width: 80px;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: var(--border-color); /* Use themed color */
    outline: none;
    opacity: 0.7;
    transition: opacity 0.2s, background 0.3s ease;
    border-radius: 2px;
}

.volume-bar:hover {
    opacity: 1;
}

.volume-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: background 0.3s ease;
}

.volume-bar::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: background 0.3s ease;
}
/* Disabled volume bar */
.volume-bar[disabled] {
    opacity: 0.4;
    cursor: default;
}
.volume-bar[disabled]::-webkit-slider-thumb,
.volume-bar[disabled]::-moz-range-thumb {
    background: var(--secondary-text-color);
    cursor: default;
}


/* Settings Popup & Lyrics Popup (reusing styles where possible) */
.settings-overlay,
.lyrics-overlay { /* Apply to both overlays */
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* Darker dim effect for popup */
    z-index: 2000; /* Above all other content */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.settings-overlay.is-open,
.lyrics-overlay.is-open { /* Apply to both overlays when open */
    display: block;
    opacity: 1;
}

.settings-popup,
.lyrics-popup { /* Apply to both popups */
    display: none; /* Hidden by default */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* Center the popup */
    width: 90%; /* Max width for mobile */
    max-width: 500px; /* Max width for desktop */
    background-color: var(--popup-background);
    border: 1px solid var(--popup-border);
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 2001; /* Above the settings overlay */
    padding: 20px;
    box-sizing: border-box; /* Include padding in width */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    color: var(--text-color); /* Ensure text color is themed */
    max-height: 80vh; /* Limit height for scrollable content */
    overflow-y: auto; /* Enable scrolling for lyrics */
}

body.dark-mode .settings-popup,
body.dark-mode .lyrics-popup { /* Apply to both popups in dark mode */
    box-shadow: 0 5px 20px rgba(255, 0, 0, 0.2); /* Red glow in dark mode */
}

.settings-popup.is-open,
.lyrics-popup.is-open { /* Apply to both popups when open */
    display: block;
    opacity: 1;
    visibility: visible;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color); /* Themed separator */
    padding-bottom: 10px;
    position: sticky; /* Keep header visible when content scrolls */
    top: 0;
    background-color: var(--popup-background); /* Ensure background for sticky header */
    z-index: 2002;
}

.popup-header h2 {
    margin: 0;
    color: var(--text-color);
    font-size: 1.5em;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    color: var(--secondary-text-color);
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s ease, transform 0.2s ease;
}

.close-btn:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}
.close-btn:active {
    transform: scale(0.9);
}

.popup-content p {
    margin: 0;
    line-height: 1.8;
}

/* New: Lyrics Content Styling */
.lyrics-content {
    font-family: var(--font-family-base); /* Use themed font */
    font-size: var(--font-size-base); /* Use themed font size */
    line-height: 1.8;
    white-space: pre-wrap; /* Preserve whitespace and allow wrapping */
    text-align: left;
    max-height: calc(80vh - 100px); /* Adjust height to prevent header/footer overlap */
    overflow-y: auto;
    padding-right: 10px; /* Space for scrollbar */
    padding-top: 5px; /* Small padding below header */
}

.lyrics-content pre {
    margin: 0;
    font-family: inherit; /* Inherit font from parent */
    font-size: inherit;
    color: inherit;
    white-space: pre-wrap; /* Ensure preformatted text wraps */
}


/* New: Settings Group for font size/family */
.setting-group {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-group label {
    font-weight: 600;
    color: var(--text-color);
}

.setting-group input[type="range"],
.setting-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: var(--player-background);
    color: var(--text-color);
    font-size: 1em;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none; /* For range input */
    appearance: none;
    outline: none;
}

.setting-group input[type="range"]:focus,
.setting-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.2);
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    margin-top: -6px; /* Center thumb vertically */
    box-shadow: 0 0 3px rgba(0,0,0,0.3);
}

.setting-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 0 3px rgba(0,0,0,0.3);
}

#current-font-size,
#current-transparency-value { /* Apply to transparency value too */
    align-self: flex-end; /* Align to the right below slider */
    font-size: 0.9em;
    color: var(--secondary-text-color);
}

/* Scroll to Top Button */
.scroll-to-top-btn {
    position: fixed;
    bottom: 85px; /* Adjust to be above the player bar */
    right: 20px;
    z-index: 999; /* Below player bar, above most content */
    background-color: var(--primary-color);
    color: var(--player-background); /* Contrast color */
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.5em;
    line-height: 1; /* Center icon vertically */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

body.dark-mode .scroll-to-top-btn {
    color: var(--dark-background); /* Black text on red button for dark mode */
}

.scroll-to-top-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top-btn:hover {
    transform: scale(1.1) translateY(0); /* Ensure transform doesn't conflict */
}
.scroll-to-top-btn:active {
    transform: scale(0.95) translateY(0);
}

/* New: Floating Controls Container (for settings and dark mode toggle) */
.floating-controls {
    position: fixed;
    bottom: 140px; /* Base position for the lowest floating control (settings) */
    right: 20px;
    z-index: 998; /* Below scroll-to-top-btn */
    display: flex;
    flex-direction: column;
    gap: 10px; /* Space between buttons */
}

.home-logo-icon {
    height: 28px; /* Slightly larger image within the 45px button */
    width: 28px;
    /* Invert color if necessary, but LogoArkana16.png is blue gradient, let's keep it clean */
}


/* New: Floating Control Buttons (Settings and Dark Mode Toggle) */
.floating-control-btn {
    /* Inherit scroll-to-top-btn styling */
    background-color: var(--player-background); /* Use player background for floating controls */
    color: var(--text-color); /* Themed text color */
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.5em;
    line-height: 1; 
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: transform 0.2s ease, background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.floating-control-btn:hover {
    transform: scale(1.1);
    background-color: var(--primary-color);
    color: var(--player-background); /* Invert text/bg color on hover */
    border-color: var(--primary-color);
}
body.dark-mode .floating-control-btn:hover {
    color: var(--dark-background); /* Dark background text on red button for dark mode */
}

.floating-control-btn:active {
    transform: scale(0.95);
}

/* Ensure the sun/moon icons are properly sized and visible */
.floating-control-btn .light-mode-icon,
.floating-control-btn .dark-mode-icon {
    font-size: 1em; /* Adjust icon size within the button */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ensure dark mode toggle logic works on the new button structure */
.floating-control-btn .dark-mode-icon {
    display: none; /* Hide dark mode icon by default */
}

body.dark-mode .floating-control-btn .light-mode-icon {
    display: none; /* Hide light mode icon when dark mode is active */
}

body.dark-mode .floating-control-btn .dark-mode-icon {
    display: block; /* Show dark mode icon when dark mode is active */
}


/* Scrollbar Styling (Customized for Webkit browsers) */

/* General Scrollbar Track */
body::-webkit-scrollbar,
.lyrics-content::-webkit-scrollbar {
    width: 10px; /* Width of the scrollbar */
    height: 10px; /* Height of horizontal scrollbar */
    background: var(--background-color); /* Match overall background */
}

/* Scrollbar Track area */
body::-webkit-scrollbar-track,
.lyrics-content::-webkit-scrollbar-track {
    background: var(--border-color); /* Light border color for the track */
}

/* Scrollbar Thumb */
body::-webkit-scrollbar-thumb,
.lyrics-content::-webkit-scrollbar-thumb {
    background-color: var(--secondary-text-color); /* Default thumb color (muted) */
    border-radius: 5px; /* Rounded corners */
    border: 2px solid var(--background-color); /* Padding matching the body background */
}

/* Scrollbar Thumb on hover/active */
body::-webkit-scrollbar-thumb:hover,
.lyrics-content::-webkit-scrollbar-thumb:hover {
    background-color: var(--primary-color); /* Highlight with primary color on hover */
}


/* Mobile Responsiveness */
@media (max-width: 768px) {
    .header-container {
        padding: 0 15px; /* Ensure padding is applied to the container */
    }
    
    .header-content {
        flex-wrap: nowrap; /* Keep content on one line for better mobile header */
        justify-content: center; 
        min-height: 50px; /* Maintain minimum height */
    }
    
    .header-search-bar {
        padding: 5px 0; /* Apply minimal padding */
    }

    #search-input {
        padding: 8px 15px; /* Ensure input padding is consistent */
    }
    /* Removed old mobile content positioning as it was simplified */
    
    .player-content {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .track-info-player {
        width: 100%;
        justify-content: center;
    }

    .controls-progress {
        width: 100%;
        margin-top: 10px;
    }

    /* Adjust playback-actions for mobile */
    .playback-actions {
        width: 100%;
        justify-content: center; /* Center player controls and volume together */
        gap: 15px; /* Keep a reasonable gap */
        flex-wrap: wrap; /* Allow wrapping if needed */
    }

    .player-controls {
        /* No specific changes needed here from previous mobile styles */
    }

    .volume-controls {
        /* Remove explicit mobile centering/width from here as it's now handled by playback-actions */
        width: auto; 
        justify-content: center; /* Center its own content (icon/bar) */
        margin-top: 0; 
    }

    .scroll-to-top-btn {
        bottom: 155px; /* Increase bottom spacing for taller mobile player bar */
        width: 40px;
        height: 40px;
        font-size: 1.2em;
        right: 15px; /* Slightly adjust position for mobile padding */
    }
    
    .floating-controls {
        bottom: 205px; /* Adjusted vertical stacking (155px + 40px + 10px gap between controls) */
        right: 15px;
        gap: 8px; /* Slightly smaller gap on mobile */
    }

    .floating-control-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2em;
    }
}

@media (max-width: 480px) {
    .track-list {
        grid-template-columns: 1fr; /* Stack tracks on very small screens */
    }

    h1 {
        font-size: 1.8em;
    }

    .settings-popup,
    .lyrics-popup {
        width: 95%; /* Even wider for very small screens */
        padding: 15px;
    }
    .popup-header {
        margin-bottom: 15px;
    }
    .lyrics-content {
        max-height: calc(80vh - 80px); /* Adjust for smaller header/padding */
    }
}