/* style.css */

:root {
    --bg-color: #000000;
    --card-bg-color: #1e1e1e;
    --card-hover-bg-color: #282828;
    --text-color: #ffffff;
    --text-color-subtle: #b3b3b3;
    --primary-color: #FFC107; /* Yellow 500 */
    --border-radius-main: 25px;
    --highlight-color: #ffc10740;
}
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background-color: var(--bg-color); color: var(--text-color); margin: 0; padding: 20px 0; padding-bottom: 80px; }
body.modal-open { overflow: hidden; }
.container { max-width: 1800px; margin: auto; padding: 0 80px; }

#results-wall {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.corner-btn {
    position: fixed;
    right: 20px;
    background-color: var(--card-bg-color);
    border: 1px solid #555;
    color: #000;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: all 0.2s;
}
.corner-btn:hover {
    border-color: var(--primary-color);
    transform: scale(1.1);
}
.corner-btn svg {
    width: 24px;
    height: 24px;
    fill: var(--text-color-subtle);
    transition: fill 0.2s;
}
.corner-btn:hover svg {
    fill: var(--primary-color);
}

.back-to-top-btn {
    position: fixed;
    bottom: 30px;
    right: 20px;
    background-color: var(--primary-color);
    color: #000;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
}
.back-to-top-btn.show {
    display: flex;
    opacity: 1;
}
.back-to-top-btn:hover {
    transform: scale(1.1);
}
.back-to-top-btn svg {
    fill: #000;
}

header { background-color: var(--bg-color); padding: 20px; border-radius: 8px; margin-bottom: 10px; display: flex; flex-direction: column; align-items: center; gap: 20px; }
header h1 { margin: 0; cursor: pointer; }
.search-container { width: 100%; max-width: 700px; display: flex; flex-direction: column; align-items: center; gap: 15px; }
.search-bar { display: flex; width: 100%; border-radius: var(--border-radius-main); border: 1px solid #555; transition: border-color 0.2s; }
.search-bar:focus-within { border-color: var(--primary-color); }
#searchInput { flex-grow: 1; padding: 10px 15px; border: none; background: #333; color: var(--text-color); font-size: 1em; border-radius: var(--border-radius-main) 0 0 var(--border-radius-main); accent-color: var(--primary-color); }
#searchInput:focus { outline: none; }
#searchInput::-webkit-search-cancel-button {
    filter: hue-rotate(165deg);
    cursor: pointer;
}
.search-bar button { padding: 10px 20px; border: none; background-color: #333; color: var(--text-color); cursor: pointer; font-weight: bold; transition: background-color 0.2s; white-space: nowrap; border-left: 1px solid #555; border-radius: 0; }
.search-bar button#downloadUrlButton { border-radius: 0 var(--border-radius-main) var(--border-radius-main) 0; }
button:disabled { background-color: #555; color: #888; cursor: not-allowed; }
.search-tabs { display: flex; gap: 10px; }
.tab-btn { padding: 8px 18px; border: 1px solid #555; border-radius: var(--border-radius-main); background-color: transparent; color: var(--text-color-subtle); cursor: pointer; transition: all 0.2s; }
.tab-btn.active { background-color: var(--primary-color); color: #000; border-color: var(--primary-color); font-weight: bold; }
.search-bar button:hover:not(:disabled), .tab-btn:hover { color: var(--primary-color); }
.tab-btn.active:hover {
    color: #000;
}
.player-btn:hover:not(:disabled) svg, .card-actions button:hover:not(:disabled) svg { fill: var(--primary-color); }
.track-actions button:hover svg { fill: var(--primary-color); }
.action-btn:hover:not(:disabled) { color: var(--primary-color); border-color: var(--primary-color); }
.section-title {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.5em;
    font-weight: bold;
    color: var(--text-color);
    margin: 30px 0 15px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #333;
}
.collapse-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.collapse-btn svg {
    width: 24px;
    height: 24px;
    fill: var(--text-color-subtle);
    transition: transform 0.3s ease, fill 0.2s;
}
.collapse-btn:hover svg {
    fill: var(--primary-color);
}
.collapse-btn.is-collapsed svg {
    transform: rotate(-90deg);
}

/*封面大小*/
.cover-wall { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); 
    gap: 10px;
    padding: 10px;
}
.cover-wall.is-collapsed {
    max-height: 0;
    margin: 0;
    padding: 0;
}
.load-more-sentinel {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
}

.card {
    background-color: transparent; 
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    overflow: visible;
    box-shadow: none; 
    position: relative;
}

.card:hover { 
    transform: translateY(-5px); 
    background-color: transparent;
}

.card.is-active-album {
    box-shadow: 0 0 0 6px var(--primary-color);
}

.card[data-artist-id] .img-container {
    border-radius: 50%;
    overflow: hidden;
    background-color: var(--card-bg-color); 
}

.card[data-artist-id] .img-container img {
    border-radius: 50%; 
}

.img-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    cursor: pointer;
    border-radius: 8px;
}
.img-container img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-actions { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 10px; background: rgba(0,0,0,0.7); opacity: 0; transition: opacity 0.2s ease-in-out; pointer-events: none; }
.card:hover .card-actions { opacity: 1; }
.card-actions button { pointer-events: auto; }
.card-actions-top { display: flex; justify-content: space-between; align-items: flex-start; }
.card-actions-bottom { display: flex; justify-content: space-around; align-items: center; width: 100%; }
.card-actions button { background: none; border: none; padding: 0; line-height: 0; cursor: pointer; }
.card-actions button svg { width: 22px; height: 22px; fill: white; transition: fill 0.2s; }
.card-actions-top-right { display: flex; gap: 8px; }
.card-metadata-overlay {
    color: white;
    font-size: 0.85em;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
    margin-top: 8px; 
}

.card-badge {
    position: absolute;
    top: 0;
    left: 0;
    background-color: var(--primary-color);
    color: #000;
    font-size: 12px;
    font-weight: bold;
    padding: 3px 6px;
    border-radius: 8px 0px 8px 0px;
    z-index: 1;
    line-height: 1;
}

.card-info {
    margin-top: auto;
    padding: 10px 15px 15px;
}
.card-title-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-title-row h3 { margin: 0; font-size: 1em; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; flex-grow: 1; font-weight: normal; }
.explicit-badge {
    background-color: var(--primary-color);
    color: #000;
    font-size: 15px;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 2px;
    line-height: 1;
    display: inline-block;
    flex-shrink: 0;
    margin-right: -2px;
}
.card-play-btn { background: none; border: none; padding: 0; line-height: 0; cursor: pointer; flex-shrink: 0; }
.card-play-btn svg { width: 24px; height: 24px; fill: var(--text-color-subtle); transition: fill 0.2s; }
.card-play-btn:hover .play-icon { fill: var(--primary-color); }

.card-play-btn .play-icon, 
.card-play-btn .pause-icon {
    display: none;
}
.card:not(.is-active-album) .card-play-btn .play-icon {
    display: block;
}
.card.is-active-album:not(.is-playing) .card-play-btn .play-icon {
    display: block;
    fill: var(--primary-color);
}
.card.is-active-album:not(.is-playing) .card-play-btn .pause-icon {
    display: none;
}
.card.is-active-album.is-playing .card-play-btn .play-icon {
    display: none;
}
.card.is-active-album.is-playing .card-play-btn .pause-icon {
    display: block;
    fill: var(--primary-color);
}

.action-btn-success svg { fill: var(--primary-color) !important; }
.modal { display: none; position: fixed; z-index: 1000; inset: 0; overflow: auto; background-color: rgba(0,0,0,0.7); align-items: center; justify-content: center; }
#settings-modal { z-index: 1030; }
#tracklist-modal { z-index: 1020; } 
#artist-modal { z-index: 1010; } 
#download-queue-modal { z-index: 1040; }
.modal.is-visible { display: flex; }
.modal-content { 
    background-color: #282828; 
    padding: 20px; 
    width: 80%; 
    max-width: 800px; 
    border-radius: 8px; 
    position: relative; 
    max-height: 80vh; 
    display: flex; 
    flex-direction: column; 
}

.settings-modal-content {
    max-width: 500px; /*设置窗口宽度为500px */
    max-height: 90vh;
    /*height: auto;*/
    padding: 12px;
    background-color: #282828;
    width: 90%;
    border-radius: 8px;
    position: relative; 
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto; 
}

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.modal-title-container { display: flex; align-items: center; gap: 15px; overflow: hidden; flex-grow: 1; }
#modal-album-art { width: 50px; height: 50px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.modal-content h3 { margin: 0; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.action-btn { padding: 8px 18px; border: 1px solid #555; border-radius: var(--border-radius-main); background-color: transparent; color: var(--text-color-subtle); cursor: pointer; transition: all 0.2s; flex-shrink: 0; display: flex; align-items: center; gap: 8px; }
#modal-download-album-btn { margin-right: 30px; }
.modal-close-btn { color: #aaa; position: absolute; top: 1px; right: 10px; font-size: 28px; font-weight: bold; cursor: pointer; z-index: 10; }
#modal-body, #modal-body-artist, .settings-body { overflow-y: auto; }
.track-list-item { display: flex; flex-direction: column; padding: 10px 5px; border-bottom: 1px solid #444; }
.track-list-item:last-child { border-bottom: none; }
.track-list-item.is-playing { background-color: rgba(255, 193, 7, 0.1); }
.track-info-row { display: flex; justify-content: space-between; align-items: center; }
.track-actions { display: flex; align-items: center; gap: 15px; }
.track-actions button { background: none; border: none; font-size: 0.9em; cursor: pointer; padding: 0; color: var(--text-color-subtle); transition: color 0.2s; line-height: 0; }
.track-actions button svg { width: 20px; height: 20px; fill: var(--text-color-subtle); transition: fill 0.2s; }
.track-actions .play-btn .play-icon, .track-actions .play-btn .pause-icon { display: none; }
.track-actions .play-btn:not(.is-playing) .play-icon { display: block; }
.track-actions .play-btn.is-playing .pause-icon { display: block; fill: var(--primary-color); }
.track-progress-bar-container { margin-top: 8px; }
.track-progress-bar { width: 100%; accent-color: var(--primary-color); }

#artist-page-container {

}

.artist-page-back-btn {
    padding: 8px 18px; 
    border: 1px solid #555; 
    border-radius: var(--border-radius-main); 
    background-color: transparent; 
    color: var(--text-color-subtle); 
    cursor: pointer; 
    transition: all 0.2s; 
    flex-shrink: 0; 
    display: inline-flex;
    align-items: center; 
    gap: 8px;
    margin-bottom: 20px; 
}
.artist-page-back-btn:hover {
     color: var(--primary-color); 
     border-color: var(--primary-color);
}
.artist-page-header { display: flex; align-items: center; gap: 15px; margin-bottom: 20px; }
#artist-page-avatar { 
    width: 64px; 
    height: 64px; 
    border-radius: 50%;
    object-fit: cover; 
    background-color: var(--card-bg-color); 
}
#artist-page-title { margin: 0; font-size: 1.5em; }
#artist-page-body { overflow-y: auto; }

.artist-section-title { margin: 25px 0 15px; color: var(--text-color); padding-bottom: 8px; font-size: 1.2em; }
#artist-page-body > .artist-section-title:first-child { margin-top: 0; }
.artist-page-body > .cover-wall { 
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); 
    background: none; 
}

.video-modal-content {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    background-color: #282828;
}

#video-modal-body {
    padding: 10px 0 0 0;
    line-height: 0;
    overflow: hidden;
}

#player-video-element {
    width: 100%;
    height: auto;
    max-height: 75vh;
    background-color: #000;
    border-radius: 4px;
    accent-color: var(--primary-color);
}

#video-modal { 
    z-index: 1050; 
}


.settings-body {
    display: block;
    padding: 0;
    position: static; 
}

.setting-item:has(#setting-api-base-url),
.setting-item:has(#qobuz-login-btn),
.setting-item:has(#setting-folder-format),
.setting-item:has(#setting-filename-format) {
    margin-bottom: 2px;
    padding-bottom: 2px;
    position: relative;
}

.setting-item {
    padding-top: 2px; 
    padding-bottom: 2px;
    gap: 2px; 
}


.setting-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    position: static; 
}

.help-btn {
    width: 18px;
    height: 18px;
    font-size: 11px;
    background-color: #555;
    color: white;
    border: none;
    border-radius: 50%;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
    margin-left: 2px;
}

.api-input-container {
    position: relative;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}

#setting-api-base-url {
    flex-grow: 1;
    padding-right: 35px; 
}

#api-select-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 25px;
    height: 25px;
    font-size: 16px;
    background-color: transparent; 
    color: var(--text-color);
    border: none; 
    border-radius: 4px;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 14px;
    font-weight: bold;
}
#api-select-btn:hover {
    color: var(--primary-color);
}


.api-select-dropdown {
    position: absolute;
    top: 100%; 
    left: 0;
    width: 100%;
    max-height: 250px;
    overflow-y: auto;
    background-color: #1e1e1e;
    border: 1px solid #555;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    z-index: 20; 
    margin-top: 2px;
}

.api-select-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background-color 0.1s;
}

.api-select-item:hover {
    background-color: var(--primary-color); 
    color: #000; 
}

.setting-input {
    width: 100%;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 13px;
    background: #333;
    color: var(--text-color);
    border: 1px solid #555;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.setting-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.help-text {
    position: absolute;
    top: 100%;
    left: 10px;
    right: auto;
    transform: none; 

    border-radius: 6px;
    padding: 8px;
    max-width: 420px;
    
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    font-size: 12px;
    margin-top: 5px;
    display: none;
    background-color: var(--card-hover-bg-color);
    border: 1px solid #555;
    z-index: 10000;
    width: auto; 
}

.setting-item:has(#qobuz-login-help) .help-text,
.setting-item:has(#api-base-url-help) .help-text,
.setting-item:has(#folder-format-help) .help-text,
.setting-item:has(#filename-format-help) .help-text {
    top: 100%;
    left: 10px;
}

.setting-grid-item:has(.help-btn) .help-text {
    top: 100%;
    left: 22px;
}

.help-text.visible { display: block; }
.help-text p { margin: 0 0 8px; }
.help-text ul { margin: 0; padding-left: 18px; }
.help-text code { background-color: #111; padding: 2px 4px; border-radius: 3px; }

#toggle-settings-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0 10px;
    padding-bottom: 0; 
    margin-bottom: 0; 
}

/* Meta Data Checkboxes Container (元数据字段) */
#metadata-settings-container {
    display: flex; /* 使用 Flex 布局 */
    flex-wrap: wrap; /* 允许换行 */
    gap: 2px 10px; /* 垂直 2px，水平 10px (稍微留空) */
    padding-top: 4px;
    padding-bottom: 4px;
    border-top: 1px solid #333; 
    margin-top: 4px;
}

.setting-grid-item {
    display: flex;
    align-items: center;
    justify-content: flex-start; 
    position: relative;
    padding: 2px 0;
    line-height: 1.2;
    flex-basis: auto; 
    min-width: fit-content;
}

.hi-res-threads-container {
    flex-basis: 100%;
    display: none; 
    flex-direction: row;
    align-items: center;
    justify-content: flex-start; 
    gap: 4px; 
    padding: 0; 
    margin-top: -4px; 
    margin-left: 0; 
    position: relative; 
}
.hi-res-threads-container .setting-label {
    margin-left: 0;
    gap: 4px; 
}
.hi-res-threads-container input {
    margin-left: 4px; 
    width: 60px !important;
}

.setting-input-small {
    width: 50px !important; 
    flex-shrink: 0;
    text-align: center;
    margin-left: 8px;
}

.am-region-item {
}
.am-region-item input {
    margin-left: 8px; 
}

.setting-grid-item .setting-label {
    display: flex;
    align-items: center;
    gap: 2px; /* 标签和问号紧密对齐 */
    white-space: nowrap;
    flex-shrink: 1;
    margin-right: 2px;
    position: static;
}
.setting-grid-item .help-btn {
    margin-left: 0;
}

.setting-checkbox,
.checkbox-item input[type="checkbox"] { 
    margin: 0;
    width: 16px; 
    height: 16px;
    flex-shrink: 0;
    
    appearance: none;
    -webkit-appearance: none;
    border: 2px solid var(--text-color-subtle);
    border-radius: 4px;
    background-color: transparent;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    
    outline: none !important;
    box-shadow: none !important;
}

.setting-checkbox:checked,
.checkbox-item input[type="checkbox"]:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.setting-checkbox:checked::after,
.checkbox-item input[type="checkbox"]:checked::after {
    content: '✓';
    color: #000;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    line-height: 1;
    font-weight: bold;
}

.checkbox-item {
    display: flex;
    align-items: center;
    font-size: 14px;
    gap: 0px;
    white-space: nowrap;
    flex-basis: auto; 
    min-width: fit-content;
}
.checkbox-item label {
    display: flex;
    align-items: center;
    gap: 0px;
    white-space: nowrap;
}
.checkbox-item input[type="checkbox"] { 
    margin-left: 0; 
    margin-right: 2px;
}

.modal-footer {
    margin-top: 0;
    display: flex;
    justify-content: flex-end;
}

hr.setting-divider {
    display: none;
}


.global-player {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 200;
    display: none;
}
#player-album-art {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    object-fit: cover;
    background-color: #333;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    cursor: pointer;
    transition: transform 0.2s;
}
.global-player:hover #player-album-art {
    transform: scale(1.05);
}
.player-controls {
    position: absolute;
    top: 66px;
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    justify-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    padding: 10px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}
.global-player:hover .player-controls {
    opacity: 1;
    visibility: visible;
}
.player-btn {
    background: transparent;
    border: none;
    color: var(--text-color-subtle);
    fill: var(--text-color-subtle);
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}
.player-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    fill: var(--text-color-subtle);
}
.player-btn svg {
    width: 20px;
    height: 20px;
}
.player-btn.large svg {
    width: 22px;
    height: 22px;
}
#player-play-pause-btn .play-icon, #player-play-pause-btn .pause-icon, #player-play-pause-btn .loader {
    display: none;
}
#player-play-pause-btn.is-playing:not(.is-loading) .pause-icon {
    display: block;
    fill: var(--primary-color);
}
#player-play-pause-btn.is-loading .loader {
    display: block;
}
#player-play-pause-btn:not(.is-playing):not(.is-loading) .play-icon {
    display: block;
}
.loader {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.volume-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}
#player-volume-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}
#player-volume-btn svg {
    width: 20px;
    height: 20px;
    fill: var(--text-color-subtle);
    transition: fill 0.2s;
    display: block;
    transform: translateX(3px);
}
.volume-popup {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 15px;
    background: transparent;
    border: none;
    width: 36px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: all 0.2s;
}
.volume-container:hover .volume-popup {
    visibility: visible;
    opacity: 1;
}
.volume-slider {
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    background-color: transparent;
    width: 120px;
    height: 20px;
    cursor: pointer;
    transform: rotate(-90deg);
}
.volume-slider::-webkit-slider-runnable-track {
    height: 8px;
    background: #555;
    border-radius: 4px;
}
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 16px;
    width: 16px;
    margin-top: -4px;
    background: var(--primary-color);
    border-radius: 50%;
}
.volume-slider::-moz-range-track {
    height: 8px;
    background: #555;
    border-radius: 4px;
}
.volume-slider::-moz-range-thumb {
    height: 16px;
    width: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    border: none;
}

.download-manager { 
    position: fixed; 
    bottom: 0; 
    left: 50%; 
    width: 90%; 
    max-width: 600px; 
    background-color: var(--card-bg-color); 
    border: 1px solid #444; 
    border-radius: 8px;
    padding: 10px 20px; 
    padding-bottom: 15px;
    display: flex; 
    align-items: center; 
    gap: 15px; 
    z-index: 2000; 
    box-shadow: 0 -4px 15px rgba(0,0,0,0.3); 
    transition: opacity 0.5s, transform 0.5s; 
    opacity: 0; 
    transform: translate(-50%, 120%); 
    pointer-events: none; 
}
.download-manager.visible { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
#download-progress-bar-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background-color: #444;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}

#download-progress-bar {
    width: 0%;
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.2s ease-out;
}
.queue-count { 
    flex-shrink: 0; 
    background-color: var(--primary-color); 
    color: #000; 
    font-weight: bold; 
    font-size: 14px; 
    min-width: 32px; 
    height: 32px; 
    border-radius: 16px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    padding: 0 10px; 
    transition: all 0.2s, transform 0.2s;
    cursor: pointer;
}
.queue-count:hover {
    transform: scale(1.1);
}
.queue-count.hidden { display: none; }
.status-text { display: flex; flex-direction: column; overflow: hidden; font-size: 14px; flex-grow: 1; }
#download-album-title { font-weight: bold; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
#download-track-status { color: var(--text-color-subtle); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }

.download-cancel-btn {
    background-color: #333;
    border: 1px solid #555;
    color: var(--text-color-subtle);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    padding: 0;
}
.download-cancel-btn:hover {
    background-color: var(--card-hover-bg-color);
    color: var(--primary-color);
    border-color: var(--primary-color);
}
.download-cancel-btn svg {
    fill: currentColor;
}

.download-queue-modal-content {
    max-width: 500px;
}

.download-queue-body {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 10px;
    max-height: 60vh;
}

.queue-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    background-color: var(--card-bg-color);
    border-radius: 6px;
    border: 1px solid #444;
}

.queue-item.is-processing {
    border-color: var(--primary-color);
}

.queue-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.queue-item-title {
    font-weight: bold;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.queue-item-cancel-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 0;
}
.queue-item-cancel-btn svg {
    width: 20px;
    height: 20px;
    fill: var(--text-color-subtle);
    transition: fill 0.2s;
}
.queue-item-cancel-btn:hover svg {
    fill: #f44336;
}

.queue-item-progress-container {
    width: 100%;
    height: 6px;
    background-color: #555;
    border-radius: 3px;
    overflow: hidden;
}

#download-progress-bar {
    width: 0%;
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.2s ease-out;
}

@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
    .search-tabs {
        gap: 2px;
        justify-content: flex-start;
        padding: 0 2px;
    }
    
    .tab-btn {
        padding: 6px 10px;
        font-size: 0.85em;
        min-width: auto;
    }
    
    .region-selector-container {
        width: 20%;
    }
    
    #searchInput { 
        padding: 8px 12px;
        font-size: 0.9em;
    }
    
    .search-bar {
        border-radius: 20px;
    }
    
    .search-bar button {
        padding: 8px 12px;
        font-size: 0.9em;
    }
    
    .cover-wall {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
    }
        
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
    header h1 {
        font-size: 1.6em;
    }
    .corner-btn {
        right: 10px;
        width: 40px;
        height: 40px;
    }
    .corner-btn svg {
        width: 20px;
        height: 20px;
    }
    #settings-btn {
        top: 10px;
    }
    .back-to-top-btn {
        right: 10px;
        bottom: 15px;
        width: 40px;
        height: 40px;
    }
    .back-to-top-btn svg {
        width: 20px;
        height: 20px;
    }
    .img-container {
        display: block;
    }
    .img-container img {
        display: block;
        width: 100%;
        height: 100%;
    }
    .card-actions button {
        display: block;
    }
    .card-actions button svg {
        width: 20px;
        height: 20px;
    }
    .card {
        min-height: 250px;
    }

    #toggle-settings-container {
        flex-direction: column;
        gap: 0;
    }
    .setting-grid-item {
        flex-basis: 100%; 
        min-width: 100%;
        justify-content: space-between;
    }
    .setting-grid-item:has(#am-region-help) {
        flex-basis: 100%;
        justify-content: space-between;
        gap: 8px;
    }
    .setting-grid-item:has(#am-region-help) input {
        margin-left: 0;
    }
    .setting-grid-item:has(#setting-hires-threads-container) {
        flex-basis: 100%;
        justify-content: space-between;
    }

    #metadata-settings-container {
        flex-direction: column;
        gap: 0;
    }
}

@media (max-width: 380px) {
    .cover-wall {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 6px;
    }
    .tab-btn {
        padding: 6px 12px;
        font-size: 0.85em;
    }
    .card {
        min-height: 180px;
    }
    .img-container img {
        display: block;
    }
    .card-actions {
        opacity: 1;
        pointer-events: auto;
    }
}

@media (max-height: 768px) and (orientation: landscape) {
    .container {
        padding: 0 15px;
    }
    
    .cover-wall {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
    }
    
    .search-tabs {
        flex-wrap: wrap; 
        gap: 2px; 
        justify-content: flex-start;
        padding: 0 2px;
    }
    
    .tab-btn {
        font-size: 1.2em;
    }

    .corner-btn {
        right: 15px;
        width: 44px;
        height: 44px;
    }
    .back-to-top-btn {
        right: 15px;
        bottom: 20px;
        width: 44px;
        height: 44px;
    }
    .back-to-top-btn svg {
        width: 20px;
        height: 20px;
    }
    .img-container {
        display: block;
    }
    .img-container img {
        display: block;
        width: 100%;
        height: 100%;
    }

    .card-actions button {
        display: block;
    }

    .card {

    }

    .modal-content {
        width: 90%;
        max-height: 85vh;
    }

    .search-container {
        width: 100%;
        max-width: 1000px;
    }

    #toggle-settings-container {
        flex-direction: row;
        gap: 2px 10px;
    }
    #metadata-settings-container {
        flex-direction: row;
        gap: 2px 10px;
    }
}

.login-modal-content {
    max-width: 400px;
    width: 90%;
    background-color: var(--card-bg-color);
    text-align: center;
    padding: 30px 35px;
    border-radius: 12px;
}

.login-form-group {
    margin-bottom: 20px;
    text-align: left;
}

.login-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color-subtle);
}

.login-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #555;
    border-radius: 8px;
    font-size: 1em;
    background-color: #333;
    color: var(--text-color);
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.3);
}

.login-btn {
    width: 100%;
    padding: 12px;
    border: none;
    background-color: var(--primary-color);
    color: #000;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    border-radius: var(--border-radius-main);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-btn:hover:not(:disabled) {
    opacity: 0.85;
}

.login-btn:disabled {
    background-color: #555;
    cursor: not-allowed;
}

.login-error-text {
    color: #f44336;
    font-size: 0.9em;
    height: 1.2em;
    margin-bottom: 15px;
}

#login-modal.is-visible {
    align-items: flex-start;
    padding-top: 30px;
}

.login-input {
    color: #FFFFFF; 
}

.login-input::placeholder {
    color: #888;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.modal.shake .modal-content {
    animation: shake 0.5s ease-in-out;
}

:root {
    --plyr-color-main: var(--primary-color); 
    --plyr-video-progress-buffered-background: rgba(255, 255, 255, 0.25);
    --plyr-range-thumb-background: var(--primary-color);
    --plyr-range-track-background: #555;
    --plyr-control-radius: 6px;
}

#video-modal-body .plyr {
    width: 100%;
    height: auto;
    max-height: 75vh;
    border-radius: 4px;
}

.region-selector-container {
    margin: 0;
    padding: 0;
}

#region-selector option {
    background-color: var(--card-bg-color);
    color: var(--text-color);
}

.search-tabs {
    gap: 5px;
    align-items: center;
}

#tidal-login-btn {
    display: flex;
    align-items: center; 
    justify-content: center;
    gap: 5px;
}


#tidal-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

#tidal-login-btn svg {
    display: block; 
}

.region-badge {
    background-color: var(--primary-color);
    color: #000;
    font-size: 13px;
    font-weight: bold;
    padding: 3px 6px;
    border-radius: 5px;
    line-height: 1.2;
    text-align: center;
    display: none; 
    white-space: nowrap;
}

.hidden {
    display: none !important;
}

.setting-input-small {
    width: 55px;
    flex-grow: 0;
    flex-shrink: 0;
}

#am-region-help {
    word-break: break-all;
}

#quality-select-modal .modal-content {
    width: 40%;
    max-width: 200px;
}

.quality-select-btn {
    white-space: pre-line;
    justify-content: center;
}

#quality-select-modal .settings-body {
    grid-template-columns: 1fr;
    display: grid;
    gap: 10px;
    justify-items: center;
}

#quality-select-title {
    text-align: center;
}

.action-pdf.action-pdf-text {
    line-height: 1;
    font-size: 14px;
    font-weight: bold;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    padding: 0;
}

.action-pdf.action-pdf-text:hover {
    color: var(--primary-color);
}

.card-quality-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 10px;
    box-sizing: border-box;
    z-index: 30; 
}

.card-quality-overlay .quality-btn {
    background-color: var(--card-bg-color);
    color: var(--text-color) !important; 
    border: 1px solid #555;
    padding: 10px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    width: 90%; 
    max-width: 200px; 
}

.card-quality-overlay .quality-btn:hover {
    background-color: #333;
    color: var(--primary-color) !important;
    border-color: var(--primary-color);
}

.help-text,
[id$="-help"] {
    display: none !important;
}

.help-text.visible,
[id$="-help"].visible {
    display: block !important;
}

.help-text,
[id$="-help"] {
    display: none !important;
    white-space: normal !important;
    word-wrap: break-word;
    line-height: 1.5;
    padding: 10px 12px !important;
    box-sizing: border-box;
}

.help-text.visible,
[id$="-help"].visible {
    display: block !important;
}

.card[data-artist-id] .card-info {
    text-align: center;
}

.card[data-artist-id] .card-title-row h3 {
    text-align: center;
    margin: auto; 
}

.corner-buttons-container {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.corner-buttons-container .corner-btn,
.corner-buttons-container #region-selector-container {
    position: relative; 
    top: auto;
    right: auto;
}

#region-selector-container {
    padding: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--card-bg-color); 
    border: 1px solid #555;                 
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);   
    border-radius: 50%;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s; 
}

#region-selector-container:hover {
    border-color: #00FF00;
    transform: scale(1.1);              
}

#region-selector {
    background-color: #00FF00;
    color: #000000;
    font-weight: bold;
    font-size: 13px;
    padding: 3px 6px;
    border-radius: 5px;
    width: auto;
    height: auto;
    border: none;
    -webkit-appearance: none;
    appearance: none;
    text-align: center;
    text-align-last: center;
    cursor: pointer;
}

#region-selector:focus {
    outline: none;
}

.search-tabs .region-selector-container {
    display: none;
}

@media (max-width: 768px) {
    #region-selector-container {
        width: 44px;
        height: 44px;
    }
}