/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    overflow-y: auto;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1db954, #1ed760);
    min-height: 100vh;
    color: white;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Sections */
.section {
    margin-bottom: 30px;
}

.hidden {
    display: none !important;
}

/* Cards */
.auth-card, .setup-card, .game-over-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    margin: 5px;
}

.btn-primary {
    background: #1ed760;
    color: white;
}

.btn-primary:hover {
    background: #1aa34a;
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-outline {
    background: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-success {
    background: #00d4aa;
    color: white;
}

.btn-success:hover {
    background: #00b894;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
}

/* Search */
.search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.search-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 215, 96, 0.3);
}

/* URL Input */
.url-input-container {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.url-input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.url-input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.url-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 215, 96, 0.3);
}

.url-help {
    margin: 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
    text-align: center;
}

/* Game Mode Controls */
.game-mode-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Popular Songs Section */
.popular-songs-instructions {
    margin-bottom: 15px;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
}

.popular-songs-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.popular-songs-controls label {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.popular-count-input {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 14px;
    width: 80px;
    text-align: center;
}

.popular-count-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 215, 96, 0.3);
}

.popular-count-input::-webkit-outer-spin-button,
.popular-count-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.popular-count-input[type=number] {
    -moz-appearance: textfield;
}

.popular-songs-note {
    margin: 10px 0 0 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    text-align: center;
}

/* Extended Popular Songs Section */
.extended-popular-instructions {
    margin-bottom: 15px;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
}

.extended-popular-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.extended-popular-note {
    margin: 10px 0 0 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    text-align: center;
}

/* Albums Section */
#albums-section {
    margin-top: 20px;
}

/* Results */
.results-container {
    margin-top: 20px;
}

.list {
    display: grid;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 10px;
}

.list-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.list-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.list-item.selected {
    border-color: #1ed760;
    background: rgba(30, 215, 96, 0.2);
}

.list-item h4 {
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.list-item p {
    opacity: 0.8;
    font-size: 0.9rem;
}

/* Album checkbox styling */
.album-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.album-check {
    width: 18px;
    height: 18px;
    accent-color: #1ed760;
    cursor: pointer;
}

.album-checkbox label {
    font-size: 0.9rem;
    color: white;
    cursor: pointer;
    margin: 0;
    font-weight: normal;
}

.list-item.selected {
    border-color: #1ed760;
    background: rgba(30, 215, 96, 0.2);
}

.list-item.has-selection {
    border-color: #1ed760;
    background: rgba(30, 215, 96, 0.1);
}

/* Album Controls */
.album-controls {
    margin-bottom: 20px;
}

.album-instructions {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin-bottom: 15px;
    font-style: italic;
}

/* Game Container */
.game-container {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
}

.game-info {
    margin-bottom: 30px;
}

.game-info h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.game-info p {
    font-size: 1.2rem;
    opacity: 0.8;
}

/* Game Content Layout */
.game-content {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    flex: 1;
    min-height: 0;
}

/* Visualization */
.visualization-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

#visualization {
    background: #000;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    width: 600px;
    height: 300px;
}

/* Song List Sidebar */
.song-list-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    padding: 20px;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
}

.song-list-sidebar h3 {
    margin: 0 0 15px 0;
    color: white;
    font-size: 18px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 10px;
    flex-shrink: 0;
    position: relative;
}

.song-list-sidebar h3::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: width 0.3s ease;
}

.song-list-sidebar.scrollable h3::after {
    width: 60px;
}

.song-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    padding-right: 4px;
}

.song-list::-webkit-scrollbar {
    width: 6px;
}

.song-list::-webkit-scrollbar-track {
    background: transparent;
}

.song-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.song-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.song-item {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: var(--song-item-height, 50px);
}

.song-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Removed current and played styling to maintain mystery */

.song-item .song-name {
    font-weight: 500;
    color: white;
    margin-bottom: 3px;
    font-size: 15px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-item .song-album {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive Design */
@media (max-width: 768px) {
    .song-list-sidebar {
        position: relative;
        width: 100%;
        height: 300px;
        order: -1;
    }
    
    .game-content {
        order: 1;
    }
    
    #visualization {
        width: 100%;
        height: 200px;
    }
}

/* Game Controls */
.game-controls {
    margin: 30px 0;
}

/* Volume Control */
.volume-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.volume-control label {
    font-weight: bold;
    font-size: 1.1rem;
    color: white;
    margin: 0;
}

.volume-slider {
    width: 200px;
    height: 8px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.3);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #1ed760;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

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

.volume-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #1ed760;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.volume-slider::-moz-range-thumb:hover {
    background: #1aa34a;
    transform: scale(1.1);
}

#volume-display {
    font-weight: bold;
    color: white;
    min-width: 40px;
    text-align: center;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 10px;
    border-radius: 10px;
}

/* Track Info */
.track-info {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 30px;
    margin-top: 30px;
    display: flex;
    align-items: center;
    gap: 30px;
    text-align: left;
}

.album-art-container {
    flex-shrink: 0;
}

.album-art {
    width: 200px;
    height: 200px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.track-details {
    flex: 1;
}

.track-details h3 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.track-details p {
    font-size: 1.2rem;
    opacity: 0.8;
    margin-bottom: 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .search-container {
        flex-direction: column;
    }
    
    .track-info {
        flex-direction: column;
        text-align: center;
    }
    
    .album-art {
        width: 150px;
        height: 150px;
    }
    
    #visualization {
        width: 100%;
        height: 200px;
    }
    
    .volume-control {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }
    
    .volume-slider {
        width: 150px;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

/* Loading Spinner */
.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 4px solid #1ed760;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
