* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Custom Properties (Color Variables) */
:root {
    /* Primary colors */
    --color-spotify-green: #1db954;
    --color-spotify-green-hover: #1ed760;

    /* Background colors */
    --color-bg-primary: #121212;
    --color-bg-dark: #1a1a1a;
    --color-bg-darker: rgb(10, 10, 10);
    --color-bg-panel: #1e1e1e;
    --color-bg-secondary: #242424;
    --color-bg-tertiary: #282828;
    --color-bg-border: #2a2a2a;
    --color-bg-hover: 2d2d2d;

    /* Text colors */
    --color-text-primary: #ffffff;
    --color-text-secondary: #ccc;
    --color-text-muted: #888;
    --color-text-disabled: #666;
    --color-text-subtle: #555;
    --color-text-dark: #444;
    --color-text-darker: #333;

    /* Border colors */
    --color-border-light: #e0e0e0;
    --color-border-medium: #b0b0b0;
    --color-border-muted: #aaa;

    /* Utility colors */
    --color-black: #000;
    --color-white: #fff;
}

html, body {
    overflow-x: hidden;
    overflow: scroll; /* hide scrollbar: or auto */
    scrollbar-width: none; /* hide scrollbar: Firefox */
    -ms-overflow-style: none; /* hide scrollbar: IE and Edge */
}

/*  Hide scrollbar */
body::-webkit-scrollbar {
    display: none;
}


body {
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxgen, Ubuntu, Cantarell, sans-serif;
    padding-left: 0;
    transition: padding-left 0.3s ease;
    min-height: 100vh;
}

body.shifted {
    padding-left: 320px;
}

/* Starry background */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    animation: twinkle 5s infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* Logo Menu Button */
.logo-menu-btn {
    position: fixed;
    top: 16px;
    left: 20px;
    width: 56px;
    height: 56px;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(8px);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
    animation: viewFadeIn 0.6s ease-in forwards;
}

.logo-menu-btn:hover {
    transform: scale(1.08) rotate(5deg);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.logo-menu-btn:hover .logo-menu-svg {
    opacity: 1;
}

.logo-menu-btn.active {
    transform: rotate(90deg);
}

.logo-menu-svg {
    width: 100%;
    height: 100%;
    display: block;
    opacity: 0.95;
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.9)) drop-shadow(0 0 8px rgba(255, 255, 255, 0.5));
}

/* First visit hint animation */
@keyframes hintBounce {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-8px); }
    50% { transform: translateY(0); }
    75% { transform: translateY(-4px); }
}

@keyframes hintGlow {
    0%, 100% { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); }
    50% { box-shadow: 0 4px 24px rgba(245, 245, 245, 0.5), 0 0 30px rgba(245, 245, 245, 0.3); }
}

.logo-menu-btn.first-visit-hint {
    animation: hintBounce 1.2s ease-in-out 0.5s 1, hintGlow 1.2s ease-in-out 0.5s 1;
}

/* Side Panel */
.side-panel {
    position: fixed;
    top: 0;
    left: -100%;  /* Note: We want it closed by default */
    width: 320px;
    height: 100vh;
    background-color: var(--color-bg-dark);
    z-index: 999;
    transition: left 0.3s ease;
    padding: 96px 20px 20px 20px;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    overflow: scroll; /* hide scrollbar: or auto */
    scrollbar-width: none; /* hide scrollbar: Firefox */
    -ms-overflow-style: none; /* hide scrollbar: IE and Edge */
}

/*  Hide scrollbar */
.side-panel::-webkit-scrollbar {
    display: none;
}

.side-panel.open {
    left: 0;
}

.panel-section {
    margin-bottom: 44px;
}

.panel-section-title {
    font-size: 14px;
    font-weight: 600px;
    margin-bottom: 12px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Navigation Section */
.nav-section {
    margin-bottom: 44px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--color-bg-border);
}

.nav-section:last-child {
    border-bottom: none;
}

.nav-section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--color-spotify-green);
}

.nav-items {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background-color: var(--color-bg-tertiary);
    border-radius: 8px;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2 ease;
}

.nav-item:hover {
    background-color: var(--color-bg-border);
    color: var(--color-white);
}

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background-color: var(--color-bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.collapsible-header:hover {
    background-color: var(--color-bg-border);
    color: --var(--color-white);
}

.collapsible-icon {
    font-size: 12px;
    color: var(--color-text-muted);
    transition: transform 0.3s ease;
}

.collapsible-header.collapsed .collapsible-icon {
    transform: rotate(-90deg);
}

.collapsible-content {
    margin-left: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;  /* smooth transition for openning closing */
    opacity: 1;
    padding-top: 12px;
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
}

.subsection {
    margin-bottom: 32px;
}

/* Time Range Slider */
.time-range-control {
    background-color: var(--color-bg-dark);
    padding: 16px;
    border-radius: 8px;
}

.time-range-display {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.time-range-label-text {
    font-size: 14px;
    color: var(--color-text-secondary);
    padding-top: 2px;
}

.time-range-value-container {
    text-align: right;
}

.time-range-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-spotify-green);
    margin-bottom: 2px;
}

.time-range-desc {
    font-size: 11px;
    color: var(--color-text-muted);
}

.time-range-hint {
    font-size: 11px;
    color: var(--color-text-disabled);
    margin-top: 8px;
    text-align: center;
}

.time-range-slider-container {
    position: relative;
    margin: 20px 0;
}

.time-range-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--color-text-darker);
    outline: none;
    -webkit-appearance: none;
}

.time-range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-spotify-green);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(29, 185, 84, 0.4);
}

.time-range-slider::-webkit-slider-thumb {
    background: var(--color-spotify-green-hover);
    transform: scale(1.15);
    box-shadow: 0 2px 12px rgba(29, 185, 84, 0.6);
}

.time-range-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-spotify-green);
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(29, 185, 84, 0.4);
}

.time-range-slider::-moz-range-thumb:hover {
    background: var(--color-spotify-green-hover);
    transform: scale(1.15);
    box-shadow: 0 2px 12px rgba(29, 185, 84, 0.6);
}

.time-range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
}

.time-range-label {
    font-size: 11px;
    color: var(--color-text-disabled);
    text-align: center;
    flex: 1;
    cursor: pointer;
    transition: color 0.2s ease;
}

.time-range-label:hover {
    color: var(--color-spotify-green);
}

.time-range-label:active {
    color: var(--color-spotify-green);
    font-weight: 600;
}

/* Max Genres Control */
.max-genres-control {
    background-color: var(--color-bg-dark);
    padding: 16px;
    border-radius: 8px;
}

.max-genres-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.max-genres-label {
    font-size: 14px;
    color: var(--color-text-secondary);
}

.max-genres-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-spotify-green);
}

.max-genres-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--color-text-darker);
    outline: none;
    -webkit-appearance: none;
}

.max-genres-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-spotify-green);
    cursor: pointer;
    transition: all 0.2s ease;
}

.max-genres-slider::-webkit-slider-thumb:hover {
    background: var(--color-spotify-green-hover);
    transform: scale(1.1);
}

.max-genres-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-spotify-green);
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.max-genres-slider::-moz-range-thumb:hover {
    background: var(--color-spotify-green-hover);
    transform: scale(1.1);
}

.max-genres-hint {
    font-size: 11px;
    color: var(--color-text-disabled);
    margin-top: 8px;
    text-align: center;
}

/* View Mode Control */
.view-mode-control {
    background-color: var(--color-bg-dark);
    padding: 16px;
    border-radius: 8px;
}

.view-mode-options {
    display: flex;
    gap: 8px;
}

.view-mode-btn {
    flex: 1;
    padding: 12px;
    background-color: var(--color-bg-secondary);
    border: 2px solid var(--color-text-darker);
    border-radius: 6px;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    text-align: center;
}

.view-mode-btn:hover {
    background-color: var(--color-bg-hover);
    color: var(--color-white);
    border-color: var(--color-text-subtle);
}

.view-mode-btn.active {
    background-color: var(--color-spotify-green);
    color: var(--color-black);
    border-color: var(--color-spotify-green);
}

/* Starry Control */
.starry-control {
    background-color: var(--color-bg-dark);
    padding: 16px;
    border-radius: 8px;
}

.starry-enable-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.starry-enable-label {
    font-size: 14px;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.starry-toggle-btn {
    width: 52px;
    height: 28px;
    background-color: var(--color-text-subtle);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s ease;
}

.starry-toggle-btn.enabled {
    background-color: var(--color-spotify-green);
}

.starry-toggle-btn::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background-color: var(--color-white);
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.2 ease;
}

.starry-toggle-btn.enabled::after {
    transform: translateX(24px);
}


/* Visual Effects Control */
/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    display: none;
    transition: opacity 0.3s ease;
}

.overlay.show {
    display: block;
}

/* Fixed Header Bar */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 96px;
    background-color: rgba(18, 18, 18, 0.95);
    backdrop-filter: blur(10px);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;;
    padding: 0 20px 0 90px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    transition: left 0.3s ease;
    animation: viewFadeIn 0.6s ease-in forwards;
}

body.shifted .header {
    left: 320px;
}

/* Hide current time range on larger screens when side panel is open */
@media (min-width: 1001px) {
    body.shifted .current-time-range {
        opacity: 0;
    }
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
}

.header-left-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

h1 {
    font-size: 28px;
    font-weight: 600;
    margin: 0;
}

.header-subtitle {
    font-size: 16px;
    color: #b0b0b0;
    font-weight: 400;
    margin: 0;
}

.header-subtitle #userName {
    color: #e0e0e0;
    font-weight: 500;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
}

.current-time-range {
    position: absolute;
    right: 20px;
    font-size: 16px;
    color: #808080;
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
    transition: opacity 0.2s ease-in-out;
}

/* Main Content */
.container {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 116px 20px 20px 20px;
    animation: fadeIn 0.6s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* VIew Containers */
.view-container {
    display: none;
    opacity: 0;
    position: relative;
}

.view-container.active {
    display: block;
    animation: viewFadeIn 0.6s ease-in forwards;
}

@keyframes viewFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


/* Word Cloud Styles */
#wordcloud {
    width: 100%;
    height: calc(100vh - 140px);
    min-height: 500px;
    cursor: default;
}

/* Shuffle Button */
.shuffle-btn {
    position: absolute;
    bottom: 25px;
    right: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
    color: var(--color-white);
}

.shuffle-btn:hover {
    transform: scale(1.1);
}

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

.shuffle-btn i {
    transition: transform 0.3s ease;
    color: var(--color-border-muted);
    font-size: 16px;
}

.shuffle-btn i:hover {
    color: #F5F5F5;
}

.shuffle-btn.spinning i {
    animation: spin 0.6s ease-in-out;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.95);
    color: var(--color-white);
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 13px;
    pointer-events: none;
    opacity: 0;
    z-index: 1000;
    max-width: 350px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    line-height: 1.5;
}

@media (max-width: 768px) {
    .tooltip {
        max-width: 320px;
        font-size: 12px;
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    .tooltip {
        max-width: 320px;
        font-size: 11px;
        padding: 10px 14px;
    }
}

.tooltip.show {
    opacity: 1;
    animation: tooltipFadeIn 1.2s ease-in-out;
}

.tooltip-genre {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-spotify-green);
}

.tooltip-info {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
}

.tooltip-track {
    font-size: 12px;
    color: var(--color-text-muted);
    font-style: italic;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--color-text-darker);
}

/* Grid Styles */
.grid {
    background-color: var(--color-bg-dark);
    border-radius: 8px;
    overflow: hidden;
}

.grid-row {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    transition: background-color 0.2 ease;
    border-bottom: 3px solid rgba(10, 10, 10, 0.6);
}

.grid-row:hover {
    background-color: var(--color-bg-hover);
}

.grid-row.expanded {
    background-color: var(--color-bg-panel);
    border-bottom: none;
}

.row-number {
    padding-right: 24px;
    color: var(--color-text-muted);
    font-size: 14px;
    flex-shrink: 0;
    width: 30px;  /* Was seeing that some were taking up more space (single digit vs double digit numbers) */
}

.row-icon {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    margin-right: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 20px;
    color: var(--color-white);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.row-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 20px;
}

.row-main {
    flex: 1;
    min-width: 0;
}

.genre-name {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 2px;
}

.artist-count {
    font-size: 13px;
    color: var(--color-text-muted);
}

.spotify-link-btn {
    background-color: transparent;
    border: none;
    color: var(--color-text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 8px;
}

.spotify-link-btn:hover {
    color: var(--color-spotify-green);
    transform: scale(1.2);
}

.spotify-link-btn.disabled {
    color: var(--color-text-dark);
    opacity: 0.3;
    cursor: default;
}


.spotify-link-btn.disabled:hover {
    color: var(--color-text-dark);
    transform: none;
}

.artists-list {
    display: none;
    background-color: #1f1f1f;
}

.artists-list.show {
    display: block;
}

.artists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    padding: 16px 16px 32px 100px;
    background-color: #161616;
    border-radius: 4px;
}

.artist-item {
    padding: 16px 20px;
    background-color: var(--color-bg-border);
    border-radius: 4px;
    font-size: 14px;
    color: var(--color-text-secondary);
    transition: all 0.2s ease;
}

.artist-item:hover {
    background-color: var(--color-text-darker);
    color: var(--color-white);
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--color-text-disabled);
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .side-panel {
        width: 100%;
    }

    body.shifted {
        padding-left: 0;
    }

    .artists-grid {
        padding: 16px 16px 32px 16px;
    }
}

@media(max-width: 1000px) {
    .logo-menu-btn {
        top: 11px;
        left: 15px;
        width: 44px;
        height: 44px; 
        padding: 9px;
    }

    .header {
        height: 65px;
        padding: 0 70px 0 70px;
    }

    body.shifted .header {
        padding-left: 15px;
    }

    .header-content {
        flex-direction: column;
        gap: 6px;
    }

    .header-left-group {
        text-align: center;
    }

    h1 {
        font-size: 20px;
    }

    .header-subtitle {
        display: none;
    }

    .current-time-range {
        position: static;
        font-size: 12px;
    }

    .logo-menu-btn {
        width: 48px;
        height: 48px;
        padding: 10px;
        top: 12px;
        left: 15px;
    }

    .current-time-range {
        font-size: 12px;
    }

    .container {
        padding: 68px 15px 5px 15px;
    }

    .view-toggle {
        width: 100%;
    }

    .view-toggle-btn {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .logo-menu-btn {
        top: 9px;
        left: 12px;
        width: 42px;
        height: 42px;
        padding: 8px;
    }

    .header {
        height: 60px;
        padding: 0 65px;
    }

    h1 {
        font-size: 18px;
    }

    .current-time-range {
        font-size: 11px;
    }

    .container {
        padding: 65px 10px 5px 10px;
    }
}