:root {
    --bg-dark: #050510;
    --grid-line: rgba(0, 243, 255, 0.1);
    --cyan: #00f3ff;
    --magenta: #ff00ff;
    --text-main: #e0e0e0;
    --glass-bg: rgba(5, 5, 16, 0.7);
}

body {
    background-color: var(--bg-dark);
    background-image: 
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 40px 40px;
    color: var(--text-main);
    font-family: 'Rajdhani', sans-serif;
    margin: 0;
    min-height: 100vh;
}

/* CRT Effect */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 999;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 10;
}

h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    background: linear-gradient(90deg, var(--cyan), #fff, var(--magenta));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(0, 243, 255, 0.5);
    margin: 0;
}

.subtitle {
    color: var(--cyan);
    text-transform: uppercase;
    letter-spacing: 4px;
    margin: 0.5rem 0 3rem 0;
}

.panel {
    background: var(--glass-bg);
    border: 1px solid var(--cyan);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.1);
    backdrop-filter: blur(5px);
    position: relative;
}

.panel::before {
    content: "";
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    background: linear-gradient(45deg, var(--cyan), transparent, var(--magenta));
    z-index: -1;
    opacity: 0.5;
}

.panel-header {
    border-bottom: 1px solid var(--grid-line);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0;
    color: var(--cyan);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.stat-cheader {
    text-align: center;
    margin-bottom: 2rem;
}

.year-selector-container {
    margin-top: 1rem;
}

.year-selector {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--accent-color);
    padding: 8px 15px;
    border-radius: 4px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.year-selector:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent-color);
}

.year-selector option {
    background: #121212;
    color: var(--text-color);
}

.stats-notice {
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--muted-text);
    background: rgba(255, 255, 255, 0.05);
    padding: 8px;
    border-radius: 4px;
    display: inline-block;
}

.search-container {
    margin: 1.5rem auto 0;
    max-width: 400px;
    position: relative;
}

#stats-search {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    padding: 10px 15px;
    border-radius: 4px;
    color: var(--text-color);
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    transition: var(--transition);
}

#stats-search:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.15);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #0a0a0a;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 4px 4px;
    z-index: 100;
    display: none;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.search-result-item {
    padding: 10px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(0, 255, 157, 0.1);
}

.search-item-art {
    width: 40px;
    height: 40px;
    margin-right: 12px;
    border-radius: 2px;
}

.search-item-info {
    flex-grow: 1;
}

.search-item-name {
    font-weight: 600;
    color: var(--text-color);
    display: block;
}

.search-item-artist {
    font-size: 0.85rem;
    color: var(--muted-text);
}

.search-item-stats {
    text-align: right;
    font-size: 0.8rem;
    color: var(--accent-color);
}

.search-rank {
    font-weight: bold;
    color: var(--accent-color);
    margin-right: 5px;
}
.stat-card {
    text-align: center;
    padding: 2rem;
    background: rgba(0, 243, 255, 0.05);
    border: 1px solid rgba(0, 243, 255, 0.2);
}

.stat-label {
    font-size: 0.9rem;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.stat-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    color: var(--cyan);
    text-shadow: 0 0 10px var(--cyan);
}

.stat-unit {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.5rem;
}

/* Top Lists */
.top-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.top-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-left: 3px solid var(--cyan);
    transition: all 0.3s;
}

.top-item:hover {
    background: rgba(0, 243, 255, 0.1);
    border-left-color: var(--magenta);
}

.top-rank {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    color: var(--cyan);
    min-width: 40px;
    text-align: center;
}

.top-album-art {
    width: 60px;
    height: 60px;
    border: 2px solid var(--cyan);
    object-fit: cover;
}

.top-info {
    flex: 1;
}

.top-name {
    font-size: 1.1rem;
    color: white;
    margin-bottom: 0.3rem;
}

.top-artist {
    font-size: 0.9rem;
    color: #888;
}

.top-plays {
    font-family: 'Orbitron', sans-serif;
    color: var(--cyan);
    font-size: 1.2rem;
}

.top-percentage {
    font-size: 0.8rem;
    color: #666;
}

/* Artist Expandable Tracks */
.top-item {
    cursor: pointer;
    flex-wrap: wrap; /* Allow wrapping for the sub-list */
}

.artist-tracks {
    flex-basis: 100%;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 243, 255, 0.1);
    display: none; /* Hidden by default */
}

.artist-tracks.visible {
    display: block;
    animation: slideDown 0.3s ease-out;
}

.sub-track {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.9rem;
    color: #bbb;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

.sub-track:last-child {
    border-bottom: none;
}

.sub-track-count {
    color: var(--cyan);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Recent Plays */
.recent-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.recent-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(0, 243, 255, 0.2);
    transition: all 0.3s;
}

.recent-item:hover {
    background: rgba(0, 243, 255, 0.1);
    border-color: var(--cyan);
}

.recent-album-art {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border: 2px solid var(--cyan);
}

.recent-track {
    font-size: 0.95rem;
    color: white;
}

.recent-artist {
    font-size: 0.85rem;
    color: #888;
}

.recent-time {
    font-size: 0.75rem;
    color: #666;
}

.loading {
    text-align: center;
    color: #666;
    padding: 2rem;
}

.back-btn {
    display: inline-block;
    color: var(--cyan);
    text-decoration: none;
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
    font-size: 0.9rem;
    margin-top: 2rem;
    transition: all 0.3s;
}

.back-btn:hover {
    text-shadow: 0 0 10px var(--cyan);
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .recent-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}
