/* ============================================= */
/* ====== SOLAR KNIGHT - MUSIC LIBRARY V2 ====== */
/* ============================================= */

.music-library-btn {
    font-family: 'Cinzel', serif;
    background: linear-gradient(45deg, #2c1445, #4a1b6e);
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(74, 27, 110, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.music-library-btn:before {
    content: '♪';
    font-size: 20px;
}

.music-library-btn:after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.5s ease;
}

.music-library-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 27, 110, 0.4);
    background: linear-gradient(45deg, #4a1b6e, #6b2b8e);
}

.music-library-btn:hover:after {
    left: 100%;
}

.music-library-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 5, 20, 0.85); /* Darker, slightly less transparent */
    backdrop-filter: blur(4px);
    z-index: 2500; /* Ensure it's above game UI */
    display: none; /* Hidden by default */
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    font-family: 'Quicksand', sans-serif;
}

.music-library-modal.active {
    display: flex; /* Use flex to center container */
    opacity: 1;
    align-items: center;
    justify-content: center;
}

.music-library-container {
    background-color: rgba(25, 15, 40, 0.97); /* Dark background */
    border: 2px solid #a080d0; /* Lavender border */
    border-radius: 10px;
    box-shadow: 0 5px 30px rgba(160, 128, 208, 0.3); /* Enhanced shadow */
    color: #eee;
    width: 90%;
    max-width: 800px; /* Increased max-width for landscape */
    height: 75%; /* Adjusted height for landscape */
    max-height: 550px; /* Adjusted max-height */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent container overflow */
}

.music-library-header {
    padding: 12px 15px 10px 15px;
    border-bottom: 1px solid rgba(160, 128, 208, 0.4);
    text-align: center;
    position: relative; /* For close button positioning */
    flex-shrink: 0; /* Prevent shrinking */
}

.music-library-title {
    margin: 0;
    color: #e0d0ff; /* Lighter title color */
    font-family: 'Cinzel', serif;
    font-size: 1.4em;
    letter-spacing: 1px;
}

.close-library-btn {
    position: absolute;
    top: 5px; /* Position relative to header top */
    right: 5px; /* Position relative to header right */
    background: none;
    border: none;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    padding: 5px 10px; /* Easier touch target */
    line-height: 1;
    transition: color 0.2s ease;
    z-index: 10; /* Above title */
}
.close-library-btn:hover {
    color: #ffcc66; /* Gold hover */
}

/* Main Body - Two Columns */
.music-library-body {
    flex-grow: 1; /* Takes up remaining vertical space */
    display: flex;
    overflow: hidden; /* Prevent body overflow */
}

/* Left Panel - Track List */
.music-list-panel {
    flex: 1; /* Takes up available space */
    overflow-y: auto; /* Enables vertical scrolling */
    padding: 10px 5px 10px 15px; /* Add padding, more on left */
    border-right: 1px solid rgba(160, 128, 208, 0.3); /* Separator line */
    scrollbar-width: thin;
    scrollbar-color: #a080d0 rgba(25, 15, 40, 0.97);
}
.music-list-panel::-webkit-scrollbar { width: 8px; }
.music-list-panel::-webkit-scrollbar-track { background: rgba(25, 15, 40, 0.97); border-radius: 4px; }
.music-list-panel::-webkit-scrollbar-thumb { background-color: #a080d0; border-radius: 4px; }

/* Right Panel - Details & Controls */
.music-details-panel {
    flex: 0 0 220px; /* Fixed width for controls panel */
    padding: 20px 15px; /* Padding around controls */
    display: flex;
    flex-direction: column;
    justify-content: space-around; /* Distribute space */
    align-items: center;
    background-color: rgba(0, 0, 0, 0.1); /* Slightly different background */
}

/* Category Styling (Accordion) */
.music-category {
    margin-bottom: 8px;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(160, 128, 208, 0.15); /* Subtle background */
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}
.category-header:hover {
    background-color: rgba(160, 128, 208, 0.25);
}
.category-header.expanded {
    background-color: rgba(160, 128, 208, 0.3);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.category-name {
    font-weight: bold;
    font-size: 1.05em;
    color: #d8c8ff;
}

.category-icon {
    font-size: 0.9em;
    transition: transform 0.2s ease-in-out;
}
.category-header.expanded .category-icon {
    transform: rotate(180deg);
}

/* Track List (Hidden by default) */
.track-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background-color: rgba(0, 0, 0, 0.1); /* Slightly different background */
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    padding-left: 10px; /* Indent tracks */
}
.track-list.expanded {
    max-height: 500px; /* Allow expansion */
    padding-top: 5px;
    padding-bottom: 5px;
}

.track-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: 3px;
    margin-right: 10px; /* Space from scrollbar */
    transition: background-color 0.15s ease;
    color: #ccc;
    font-size: 0.95em;
}
.track-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
}
.track-item.playing {
    background-color: rgba(160, 128, 208, 0.3);
    color: #fff;
    font-weight: bold;
}

.track-icon {
    margin-right: 10px;
    font-size: 0.8em;
    width: 15px; /* Align icons */
    text-align: center;
    color: #a080d0;
}
.track-item.playing .track-icon {
    color: #ffcc66; /* Gold play/pause icon when playing */
}

.track-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1; /* Allow name to take remaining space */
}

/* Right Panel - Now Playing Display */
.now-playing-display {
    text-align: center;
    width: 100%;
    margin-bottom: 20px;
}

.now-playing-label {
    font-size: 0.8em;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.now-playing-track {
    font-size: 1.1em;
    color: #eee;
    font-weight: bold;
    min-height: 2.4em; /* Prevent layout shift */
    line-height: 1.2em;
    /* Allow wrapping */
    white-space: normal;
    overflow-wrap: break-word;
    word-wrap: break-word;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    hyphens: auto;
}

/* Right Panel - Playback Controls */
.playback-controls-container {
    margin-bottom: 25px;
}

.playback-controls {
    display: flex;
    gap: 15px; /* Wider gap */
    align-items: center;
    justify-content: center;
}

.control-btn {
    background: none;
    border: 1px solid #a080d0;
    color: #eee;
    font-size: 24px; /* Larger icons */
    width: 50px; /* Square buttons */
    height: 50px;
    border-radius: 50%; /* Circular buttons */
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
    display: flex; /* Center icon */
    align-items: center;
    justify-content: center;
}
.control-btn:hover {
    background-color: rgba(160, 128, 208, 0.3);
}
.control-btn:active {
    background-color: rgba(160, 128, 208, 0.5);
    transform: scale(0.95);
}
.play-btn {
    background-color: rgba(160, 128, 208, 0.2); /* Slightly highlighted */
    width: 60px; /* Larger play button */
    height: 60px;
    font-size: 30px;
}

/* Right Panel - Volume Control */
.volume-control-container {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    justify-content: center;
}
.volume-icon { font-size: 18px; color: #ccc; }
.volume-slider {
    cursor: pointer;
    flex: 1; /* Take remaining width */
    max-width: 150px; /* Max width for slider */
    height: 6px; /* Thinner */
    appearance: none;
    background: #444; /* Darker track */
    border-radius: 3px;
    outline: none;
    transition: background-color 0.2s ease;
}
.volume-slider:hover {
    background: #555;
}
.volume-slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px; /* Slightly larger thumb */
    height: 16px;
    background: #a080d0;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s ease;
}
.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #a080d0;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}
.volume-slider:active::-webkit-slider-thumb {
    transform: scale(1.1); /* Indicate interaction */
}
.volume-slider:active::-moz-range-thumb {
    transform: scale(1.1);
}

/* Remove old Footer Style */
.music-footer {
    display: none; /* Footer div is no longer used in HTML */
}

/* Remove old mobile query rules that might conflict */
/* @media (max-width: 520px) { ... } */

/* Music Library Button */
.music-library-btn {
    font-family: 'Cinzel', serif;
    background: linear-gradient(45deg, #2c1445, #4a1b6e);
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(74, 27, 110, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.music-library-btn:before {
    content: '♪';
    font-size: 20px;
}

.music-library-btn:after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.5s ease;
}

.music-library-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 27, 110, 0.4);
    background: linear-gradient(45deg, #4a1b6e, #6b2b8e);
}

.music-library-btn:hover:after {
    left: 100%;
}

/* Music Library Modal */
.music-library-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.music-library-modal.active {
    display: block;
    opacity: 1;
}

.music-library-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    background: linear-gradient(180deg, #1a0f2e, #2d1a4a);
    border-radius: 16px;
    padding: 24px;
    color: #ffffff;
    box-shadow: 0 0 30px rgba(74, 27, 110, 0.5);
    opacity: 0;
    transition: all 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.music-library-modal.active .music-library-container {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.music-library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.music-library-title {
    font-family: 'Cinzel', serif;
    font-size: 28px;
    color: #bf9fff;
    text-shadow: 0 0 10px rgba(191, 159, 255, 0.3);
}

.close-library-btn {
    background: none;
    border: none;
    color: #bf9fff;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-library-btn:hover {
    background: rgba(191, 159, 255, 0.1);
    transform: rotate(90deg);
}

.music-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 16px;
}

.music-content::-webkit-scrollbar {
    width: 6px;
}

.music-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.music-content::-webkit-scrollbar-thumb {
    background: rgba(191, 159, 255, 0.3);
    border-radius: 3px;
}

.music-category {
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    overflow: hidden;
}

.category-header {
    padding: 16px;
    background: rgba(191, 159, 255, 0.1);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease;
}

.category-header:hover {
    background: rgba(191, 159, 255, 0.15);
}

.category-name {
    font-family: 'Cinzel', serif;
    font-size: 18px;
    color: #bf9fff;
}

.category-icon {
    transition: transform 0.3s ease;
}

.category-header.expanded .category-icon {
    transform: rotate(180deg);
}

.track-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.track-list.expanded {
    max-height: 500px;
}

.track-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.track-item:hover {
    background: rgba(191, 159, 255, 0.05);
}

.track-item.playing {
    background: rgba(191, 159, 255, 0.1);
}

.track-icon {
    font-size: 14px;
    color: #bf9fff;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.track-item.playing .track-icon {
    opacity: 1;
}

.track-name {
    flex: 1;
    font-size: 14px;
    color: #e0e0ff;
}

.music-controls {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 24px;
}

.playback-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.control-btn {
    background: none;
    border: none;
    color: #bf9fff;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: rgba(191, 159, 255, 0.1);
    transform: scale(1.1);
}

.play-btn {
    width: 48px;
    height: 48px;
    background: linear-gradient(45deg, #4a1b6e, #6b2b8e);
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(74, 27, 110, 0.3);
}

.play-btn:hover {
    background: linear-gradient(45deg, #6b2b8e, #8c3bae);
    transform: scale(1.05);
}

.volume-control {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.volume-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    background: rgba(191, 159, 255, 0.2);
    border-radius: 2px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #bf9fff;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(191, 159, 255, 0.3);
    transition: all 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: #dfc5ff;
}

.now-playing {
    margin-top: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    text-align: center;
}

.now-playing-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 4px;
}

.now-playing-track {
    font-size: 16px;
    color: #bf9fff;
    font-family: 'Cinzel', serif;
} 