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

:root {
    --spotify-green: #1DB954;
    --spotify-green-bright: #1ed760;
    --spotify-black: #191414;
    --spotify-white: #FFFFFF;
    --spotify-gray: #282828;
    --spotify-dark-gray: #181818;
    --spotify-light-gray: #B3B3B3;
    --danger-red: #E22134;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.2);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--spotify-black) 0%, #1a1a1a 100%);
    color: var(--spotify-white);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: rgba(25, 20, 20, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--spotify-white);
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--spotify-green);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--spotify-green);
}

.user-name {
    font-weight: 500;
}

/* Main Content */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 80px);
}

/* Login Screen */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
}

.login-card {
    background: var(--spotify-gray);
    padding: 3rem;
    border-radius: 16px;
    text-align: center;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
}

.login-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 1.5rem;
    color: var(--spotify-green);
}

.login-card h2 {
    margin-bottom: 1rem;
    font-size: 2rem;
}

.login-card p {
    color: var(--spotify-light-gray);
    margin-bottom: 2rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 24px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--spotify-green);
    color: var(--spotify-white);
    box-shadow: 0 2px 8px rgba(29, 185, 84, 0.2);
}

.btn-primary:hover {
    background: var(--spotify-green-bright);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(29, 185, 84, 0.4);
}

.btn-primary:active {
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(29, 185, 84, 0.3);
}

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

.btn-secondary:hover {
    border-color: var(--spotify-white);
    background: rgba(255, 255, 255, 0.05);
    transform: scale(1.05);
}

.btn-secondary:active {
    transform: scale(1.02);
}

.btn-danger {
    background: var(--danger-red);
    color: var(--spotify-white);
    box-shadow: 0 2px 8px rgba(226, 33, 52, 0.2);
}

.btn-danger:hover {
    background: #c41d2f;
    box-shadow: 0 4px 12px rgba(226, 33, 52, 0.4);
}

.btn-danger:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(226, 33, 52, 0.3);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--spotify-light-gray);
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--spotify-white);
}

.tab-btn.active {
    color: var(--spotify-green);
    border-bottom-color: var(--spotify-green);
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-pane.active {
    display: block;
}

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

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.tab-header h2 {
    font-size: 2rem;
}

/* Playlists Grid - Desktop Default */
.playlists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    padding: 0.5rem 0;
}

/* Tablet responsiveness (2-column optimized) */
@media (max-width: 1024px) and (min-width: 601px) {
    .playlists-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 1.25rem;
    }
}

/* Mobile responsiveness - List view */
@media (max-width: 600px) {
    .playlists-grid {
        display: flex;
        flex-direction: column;
        gap: 0.875rem;
        padding: 0.5rem 0;
    }
}

.playlist-card {
    background: var(--spotify-gray);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.3, 0, 0.4, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

/* Mobile list view layout */
@media (max-width: 600px) {
    .playlist-card {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 1rem;
        padding: 1rem;
        min-height: 88px;
        overflow: visible;
    }
}

.playlist-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(29, 185, 84, 0.1) 0%, rgba(29, 185, 84, 0) 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.playlist-card:hover::before {
    opacity: 1;
}

.playlist-card:hover {
    background: #2a2a2a;
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(29, 185, 84, 0.2), 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Mobile - disable hover lift effect, use active state instead */
@media (max-width: 600px) {
    .playlist-card:hover {
        transform: none;
    }

    .playlist-card:active {
        background: #2a2a2a;
        transform: scale(0.98);
    }
}

.playlist-card:focus {
    outline: 2px solid var(--spotify-green);
    outline-offset: 2px;
}

.playlist-card:focus:not(:focus-visible) {
    outline: none;
}

.playlist-image {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    margin-bottom: 1rem;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s ease;
}

/* Mobile list view - fixed size thumbnail */
@media (max-width: 600px) {
    .playlist-image {
        width: 80px;
        height: 80px;
        min-width: 80px;
        margin-bottom: 0;
        font-size: 2rem;
        flex-shrink: 0;
    }
}

.playlist-card:hover .playlist-image {
    transform: scale(1.02);
}

/* Mobile - no image scale on hover */
@media (max-width: 600px) {
    .playlist-card:hover .playlist-image {
        transform: none;
    }
}

.playlist-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
    min-height: 2.6rem;
    white-space: normal;
}

/* Mobile list view - text container */
@media (max-width: 600px) {
    .playlist-name {
        min-height: unset;
        margin-bottom: 0.25rem;
        -webkit-line-clamp: 1;
        line-height: 1.3;
        font-size: 1.0625rem;
        font-weight: 700;
    }
}

.playlist-info {
    color: var(--spotify-light-gray);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Playlist text content wrapper */
.playlist-text-content {
    display: contents;
}

/* Mobile list view - text content wrapper */
@media (max-width: 600px) {
    .playlist-text-content {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}

.playlist-info::before {
    content: '♫';
    color: var(--spotify-green);
    font-size: 0.75rem;
}

/* Playlist Actions */
.playlist-actions {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 10;
}

/* Mobile - position actions on the right, always visible, larger touch target */
@media (max-width: 600px) {
    .playlist-actions {
        position: relative;
        top: unset;
        right: unset;
        display: flex;
        align-items: center;
        margin-left: auto;
    }
}

.playlist-play-btn {
    background: rgba(29, 185, 84, 0.9);
    border: none;
    color: var(--spotify-white);
    padding: 0.5rem;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    opacity: 0;
}

/* Mobile - larger touch target, always visible */
@media (max-width: 600px) {
    .playlist-play-btn {
        width: 44px;
        height: 44px;
        opacity: 1;
        font-size: 1rem;
        background: var(--spotify-green);
    }
}

.playlist-card:hover .playlist-play-btn {
    opacity: 1;
}

.playlist-play-btn:hover {
    background: var(--spotify-green-bright);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(29, 185, 84, 0.4);
}

.playlist-play-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--spotify-gray);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 10000;
    overflow: hidden;
}

/* Mobile - better positioning for list view - appear to the left, overlapping card */
@media (max-width: 600px) {
    .playlist-play-menu {
        min-width: 120px;
        left: auto;
        right: 2.5rem;
        margin-right: 0;
        margin-top: 0;
        top: 0;
    }

    .playlist-actions {
        overflow: visible;
    }
}

.playlist-play-menu button {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--spotify-white);
    padding: 0.75rem 1rem;
    text-align: left;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.2s ease;
    display: block;
}

/* Mobile - larger touch targets in menu */
@media (max-width: 600px) {
    .playlist-play-menu button {
        padding: 1rem 1.25rem;
        font-size: 0.9375rem;
        min-height: 48px;
        display: flex;
        align-items: center;
    }
}

.playlist-play-menu button:hover {
    background: var(--spotify-dark-gray);
    color: var(--spotify-green);
}

.playlist-play-menu button:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Playlist menu button */
.playlist-menu-btn {
    background: transparent;
    border: none;
    color: var(--spotify-light-gray);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0;
}

.playlist-card:hover .playlist-menu-btn {
    opacity: 1;
}

.playlist-menu-btn:hover {
    color: var(--spotify-white);
    background: rgba(255, 255, 255, 0.1);
}

/* Mobile - always visible */
@media (max-width: 600px) {
    .playlist-menu-btn {
        opacity: 1;
        font-size: 1.5rem;
        width: 36px;
        height: 36px;
        padding: 0;
    }
}

/* Artists Grid */
.artists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.artist-card {
    text-align: center;
}

.artist-image {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    margin-bottom: 0.75rem;
    object-fit: cover;
    box-shadow: var(--shadow);
}

.artist-name {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.artist-action-btn {
    background: transparent;
    border: 1px solid var(--spotify-green);
    color: var(--spotify-green);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 200px;
}

.artist-action-btn:hover {
    background: var(--spotify-green);
    color: var(--spotify-black);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(29, 185, 84, 0.4);
}

/* Tracks List */
.tracks-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.track-item {
    background: var(--spotify-gray);
    padding: 1rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: background 0.3s ease;
}

.track-item:hover {
    background: #303030;
}

.track-image {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    object-fit: cover;
}

.track-info {
    flex: 1;
}

.track-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.track-artist {
    color: var(--spotify-light-gray);
    font-size: 0.875rem;
}

.track-duration {
    color: var(--spotify-light-gray);
    font-size: 0.875rem;
}

.track-actions {
    display: flex;
    gap: 0.5rem;
    position: relative;
}

.track-btn {
    background: transparent;
    border: 1px solid var(--spotify-light-gray);
    color: var(--spotify-white);
    padding: 0.5rem 1rem;
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.track-btn:hover {
    border-color: var(--spotify-white);
    transform: scale(1.05);
}

/* Track three-dot menu button */
.track-menu-btn {
    background: transparent;
    border: none;
    color: var(--spotify-light-gray);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.track-menu-btn:hover {
    color: var(--spotify-white);
    background: rgba(255, 255, 255, 0.1);
}

/* Mobile - slightly larger touch target */
@media (max-width: 600px) {
    .track-menu-btn {
        font-size: 1.5rem;
        min-height: 44px;
        min-width: 44px;
    }
}

/* Create Dropdown */
.create-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--spotify-gray);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 10000;
    overflow: hidden;
}

.create-dropdown.dropdown-up {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.create-dropdown button {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--spotify-white);
    padding: 0.75rem 1rem;
    text-align: left;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.2s ease;
    display: block;
}

.create-dropdown button:hover {
    background: var(--spotify-dark-gray);
    color: var(--spotify-green);
}

.create-dropdown button:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Mobile - better positioning for track dropdown */
@media (max-width: 600px) {
    .create-dropdown {
        right: 0;
        left: auto;
        min-width: 180px;
        max-width: calc(100vw - 2rem);
    }

    .create-dropdown button {
        padding: 1rem;
        font-size: 0.9375rem;
        min-height: 48px;
        white-space: normal;
        word-wrap: break-word;
    }
}

/* Discover Section */
.discover-section {
    margin-bottom: 3rem;
}

.discover-section h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.time-range-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.time-btn {
    background: var(--spotify-gray);
    border: 2px solid transparent;
    color: var(--spotify-white);
    padding: 0.5rem 1rem;
    border-radius: 24px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.time-btn:hover {
    background: #333333;
    transform: translateY(-2px);
}

.time-btn.active {
    background: var(--spotify-green);
    border-color: var(--spotify-green);
    font-weight: 600;
}

.time-btn.active:hover {
    background: var(--spotify-green-bright);
    border-color: var(--spotify-green-bright);
}

/* Search */
.search-box {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    background: var(--spotify-gray);
    color: var(--spotify-white);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.search-input:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: #2a2a2a;
}

.search-input:focus {
    outline: none;
    border-color: var(--spotify-green);
    background: #2a2a2a;
    box-shadow: 0 0 0 3px rgba(29, 185, 84, 0.1);
}

.search-results {
    margin-top: 2rem;
}

.search-section {
    margin-bottom: 2rem;
}

.search-section h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

/* Playback Control */
.playback-card {
    background: var(--spotify-gray);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

.playback-album-art {
    width: 200px;
    height: 200px;
    margin: 0 auto 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

.playback-track-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.playback-artist-name {
    color: var(--spotify-light-gray);
    font-size: 1.125rem;
}

.playback-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
}

.control-btn {
    background: transparent;
    border: none;
    color: var(--spotify-white);
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn svg {
    width: 24px;
    height: 24px;
}

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

.control-btn-main {
    background: var(--spotify-green);
    padding: 1.25rem;
}

.control-btn-main svg {
    width: 32px;
    height: 32px;
}

.control-btn-main:hover {
    background: #1ed760;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--spotify-gray);
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

.modal-large {
    max-width: 800px;
}

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

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.5rem;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--spotify-white);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    color: var(--spotify-white);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-input:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.5);
}

.form-input:focus {
    outline: none;
    border-color: var(--spotify-green);
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 0 3px rgba(29, 185, 84, 0.1);
}

textarea.form-input {
    resize: vertical;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Playlist Tracks List */
.playlist-tracks-list {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 1rem;
}

.track-search {
    margin-bottom: 1.5rem;
}

.track-search-results {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 0.5rem;
}

/* Loading */
.loading {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--spotify-light-gray);
    font-size: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.loading::before {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid rgba(29, 185, 84, 0.1);
    border-top-color: var(--spotify-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Empty state styling */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--spotify-light-gray);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #fff;
}

.empty-state-message {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    color: var(--spotify-light-gray);
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 2rem;
}

.mb-2 {
    margin-bottom: 2rem;
}

hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 1.5rem 0;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--spotify-black);
}

::-webkit-scrollbar-thumb {
    background: var(--spotify-gray);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #404040;
}

/* Genre Buttons */
.genre-button {
    padding: 1rem 1.25rem;
    background: var(--spotify-gray);
    border: 2px solid transparent;
    border-radius: 12px;
    color: var(--spotify-white);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.3, 0, 0.4, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.genre-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(29, 185, 84, 0.1) 0%, rgba(30, 215, 96, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.genre-button:hover {
    background: #2a2a2a;
    border-color: rgba(29, 185, 84, 0.3);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.genre-button:hover::before {
    opacity: 1;
}

.genre-button:active {
    transform: translateY(-1px) scale(1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Featured Cards (My randomiser, Similar Artists, Similar Songs) */
.featured-card {
    background: linear-gradient(135deg, var(--spotify-gray) 0%, #202020 100%);
    border: 2px solid transparent;
    border-radius: 16px;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.3, 0, 0.4, 1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}

.featured-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(29, 185, 84, 0.1) 0%, rgba(30, 215, 96, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.featured-card:hover {
    transform: translateY(-6px);
    border-color: var(--spotify-green);
    box-shadow: 0 12px 32px rgba(29, 185, 84, 0.3);
}

.featured-card:hover::before {
    opacity: 1;
}

.featured-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.featured-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--spotify-white);
    position: relative;
    z-index: 1;
}

.featured-card-description {
    font-size: 0.9rem;
    color: var(--spotify-light-gray);
    line-height: 1.5;
    position: relative;
    z-index: 1;
}

/* Featured card variants */
.featured-card-random .featured-card-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.featured-card-artist .featured-card-icon {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.featured-card-track .featured-card-icon {
    background: linear-gradient(135deg, #1DB954 0%, #1ed760 100%);
}

.featured-card-genres .featured-card-icon {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

/* Category Headers */
.category-header {
    position: relative;
    transition: all 0.2s ease;
}

.category-header:hover {
    background: #202020 !important;
}

/* Custom genre buttons with remove functionality */
.custom-genre-button {
    text-align: left;
    padding-left: 1rem;
}

/* Generator View Container */
.generator-view {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

/* Generator Header */
.generator-header {
    background: linear-gradient(135deg, var(--spotify-gray) 0%, #202020 100%);
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.generator-header-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.generator-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.generator-text h3 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.generator-text p {
    color: var(--spotify-light-gray);
    font-size: 1rem;
    margin: 0;
}

/* Search Results Improved */
.search-results-container {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    max-height: 350px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.search-result-item:hover {
    background: rgba(29, 185, 84, 0.1);
    border-color: rgba(29, 185, 84, 0.3);
}

.search-result-image {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    flex-shrink: 0;
    object-fit: cover;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-weight: 600;
    color: var(--spotify-white);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-artist {
    color: var(--spotify-light-gray);
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Selected Item Card */
.selected-item-card {
    background: linear-gradient(135deg, rgba(29, 185, 84, 0.05) 0%, rgba(30, 215, 96, 0.05) 100%);
    border: 2px solid rgba(29, 185, 84, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.selected-item-card h4 {
    color: var(--spotify-green);
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Config Section */
.config-section {
    background: var(--spotify-gray);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Range Input Improved */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    cursor: pointer;
}

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

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(29, 185, 84, 0.6);
}

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

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(29, 185, 84, 0.6);
}

/* Now Playing Tab */
.now-playing-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--spotify-gray);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.now-playing-artwork {
    width: 100%;
    max-width: 300px;
    margin: 0 auto 2rem;
}

.now-playing-artwork img {
    width: 100%;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: block;
}

.no-artwork {
    width: 100%;
    aspect-ratio: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--spotify-white);
    font-size: 1.5rem;
    font-weight: 600;
}

.now-playing-info {
    text-align: center;
    margin-bottom: 2rem;
}

.now-playing-info .track-name {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--spotify-white);
}

.now-playing-info .track-artist {
    font-size: 1.125rem;
    color: var(--spotify-light-gray);
    margin-bottom: 0.5rem;
}

.now-playing-info .track-album {
    font-size: 0.975rem;
    color: var(--spotify-light-gray);
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.progress-time {
    font-size: 0.875rem;
    color: var(--spotify-light-gray);
    min-width: 40px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--spotify-green);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.control-btn-primary {
    background: var(--spotify-green);
    padding: 1.25rem;
}

.control-btn-primary:hover {
    background: #1ed760;
}

.control-btn-primary svg {
    width: 32px;
    height: 32px;
}

.now-playing-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 2rem;
}

.now-playing-actions .btn {
    width: 100%;
    justify-content: center;
}

.device-info {
    margin-top: 2rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--spotify-light-gray);
    justify-content: center;
}

.no-playback {
    text-align: center;
    padding: 4rem 2rem;
    max-width: 500px;
    margin: 0 auto;
}

.no-playback-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    color: var(--spotify-light-gray);
}

.no-playback h3 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.no-playback p {
    color: var(--spotify-light-gray);
    font-size: 1rem;
    margin-bottom: 2rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .featured-card {
        padding: 1.75rem;
    }
}

@media (max-width: 768px) {
    .featured-card {
        padding: 1.5rem;
    }

    .featured-card-icon {
        width: 48px;
        height: 48px;
        font-size: 1.75rem;
    }

    .featured-card-title {
        font-size: 1.1rem;
    }

    .featured-card-description {
        font-size: 0.85rem;
    }

    .generator-view {
        padding: 1rem;
    }

    .generator-header {
        padding: 1.5rem;
    }

    .generator-header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .generator-icon {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }

    .generator-text h3 {
        font-size: 1.5rem;
    }

    .playlists-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .artists-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .tab-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .search-box {
        flex-direction: column;
    }

    .modal-content {
        width: 95%;
    }

    .modal-actions {
        flex-direction: column;
    }

    .now-playing-container {
        padding: 1.5rem;
    }

    .now-playing-info .track-name {
        font-size: 1.5rem;
    }

    .now-playing-actions {
        flex-direction: column;
    }
}
