* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #ff6b6b;
    --hover-color: #ff8787;
    --text-color: #e0e0e0;
    --text-muted: #a0a0a0;
    --border-color: #2d2d44;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    background: linear-gradient(135deg, #0f0f1e, #1a1a2e, #16213e);
    color: var(--text-color);
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    background: linear-gradient(135deg, #0f0f1e, #1a1a2e, #16213e);
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 250px;
    background: linear-gradient(180deg, rgba(26, 26, 46, 0.9), rgba(15, 15, 30, 0.95));
    border-right: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.sidebar-header h1 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--primary-color), var(--hover-color));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 30px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
}

.vinyl-disc {
    font-size: 2.5rem;
    animation: spin 20s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.logo-container h1 {
    margin: 0;
}

.sidebar-search {
    margin-bottom: 30px;
}

.sidebar-search-input {
    width: 100%;
    padding: 10px 15px;
    background: #1a1a2e;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.sidebar-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 107, 107, 0.1);
}

.sidebar-playlists h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 15px;
}

.recently-played-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recently-played-item {
    padding: 8px;
    background: transparent;
    border-radius: 8px;
    display: flex;
    gap: 10px;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
}

.recently-played-item:hover {
    background-color: var(--border-color);
}

.recently-played-item img {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
}

.recently-played-info {
    flex: 1;
    min-width: 0;
}

.recently-played-title {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recently-played-artist {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, rgba(15, 15, 30, 0.5), rgba(22, 33, 62, 0.3));
    overflow: hidden;
}

/* ===== PLAYLIST SECTION ===== */
.playlist-section {
    flex: 1;
    padding: 20px 30px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.playlist {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding-right: 10px;
    flex: 1;
}

.playlist::-webkit-scrollbar {
    width: 8px;
}

.playlist::-webkit-scrollbar-track {
    background: transparent;
}

.playlist::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.playlist::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

.playlist-item {
    flex: 0 0 auto;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.08), rgba(78, 205, 196, 0.08));
    border-radius: 10px;
    display: flex;
    flex-direction: row;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid var(--border-color);
    padding: 12px;
    align-items: center;
    gap: 15px;
    height: 80px;
}

.playlist-item:hover {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.15), rgba(78, 205, 196, 0.15));
    border-color: var(--primary-color);
    transform: translateX(5px);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.1);
}

.playlist-item.active {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.2), rgba(78, 205, 196, 0.15));
    border-color: var(--primary-color);
}

.playlist-item-cover {
    width: 65px;
    height: 65px;
    border-radius: 8px;
    flex-shrink: 0;
    overflow: hidden;
}

.playlist-item-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.playlist-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.playlist-item-title {
    font-weight: 600;
    margin-bottom: 3px;
    color: var(--text-color);
    font-size: 0.95rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.playlist-item-artist {
    color: var(--text-muted);
    font-size: 0.85rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.playlist-item-duration {
    color: var(--text-muted);
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* ===== PLAYER BOTTOM ===== */
.player-bottom {
    border-top: 2px solid var(--border-color);
    background: linear-gradient(180deg, rgba(26, 26, 46, 0.5), rgba(15, 15, 30, 0.8));
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px 30px;
    flex-shrink: 0;
}

/* ===== NOW PLAYING PLAYER ===== */
.now-playing {
    background: transparent;
    border-radius: 0;
    padding: 0;
    margin: 0;
    border: none;
    display: flex;
    gap: 20px;
    align-items: center;
    flex-shrink: 0;
}

.album-cover {
    position: relative;
    width: 100px;
    height: 100px;
    flex-shrink: 0;
}

.album-cover img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: 0 12px 30px rgba(255, 107, 107, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.1),
                0 0 0 12px rgba(255, 107, 107, 0.15),
                0 0 0 16px rgba(255, 107, 107, 0.08);
    animation: rotate 20s linear infinite;
    object-fit: cover;
}

.album-cover::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    background: radial-gradient(circle at 30% 30%, #333, #000);
    border-radius: 50%;
    z-index: 10;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.album-cover::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: radial-gradient(circle at 30% 30%, #555, #222);
    border-radius: 50%;
    z-index: 11;
}

.album-cover img.paused {
    animation-play-state: paused;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.song-info {
    flex: 1;
    min-width: 0;
}

.song-info h2 {
    font-size: 1.3rem;
    margin-bottom: 5px;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.song-info p {
    color: var(--hover-color);
    font-size: 0.95rem;
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-bar {
    flex: 1;
    height: 4px;
    background-color: var(--border-color);
    border-radius: 2px;
    cursor: pointer;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--hover-color));
    width: 0%;
    border-radius: 2px;
    transition: width 0.1s linear;
}

.progress-bar-container span {
    color: var(--text-muted);
    font-size: 0.8rem;
    min-width: 38px;
    text-align: center;
}

/* ===== CONTROLS ===== */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.control-btn {
    padding: 0;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.15), rgba(78, 205, 196, 0.08));
    color: var(--text-color);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.1);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
}

.control-btn:hover {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.25), rgba(78, 205, 196, 0.15));
    border-color: var(--primary-color);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.3);
}

.play-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--hover-color));
    color: white;
    border: none;
    width: 56px;
    height: 56px;
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
    font-size: 1.4rem;
}

.play-btn:hover {
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.5);
    transform: scale(1.05);
}

/* Icon styles */
.icon-prev::before {
    content: '◀';
    font-size: 1.1rem;
    font-weight: bold;
}

.icon-play::before {
    content: '▶';
    font-size: 1.3rem;
    font-weight: bold;
}

.icon-next::before {
    content: '▶';
    font-size: 1.1rem;
    font-weight: bold;
}

.loading,
.empty {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-spinner {
    width: 40px;
    height: 40px;
    margin: 20px auto;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

audio {
    display: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
        padding: 15px;
    }

    .sidebar-header h1 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }

    .player-bottom {
        padding: 15px 20px;
    }

    .album-cover {
        width: 85px;
        height: 85px;
    }

    .song-info h2 {
        font-size: 1.1rem;
    }

    .song-info p {
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 15px;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
    }

    .sidebar-header h1 {
        font-size: 1.3rem;
        margin-bottom: 0;
        margin-right: 20px;
        white-space: nowrap;
    }

    .sidebar-search {
        flex: 1;
        margin-bottom: 0;
        margin-right: 20px;
        min-width: 200px;
    }

    .sidebar-playlists {
        display: none;
    }

    .playlist-section {
        padding: 15px 20px;
    }

    .playlist-item {
        height: 70px;
    }

    .playlist-item-cover {
        width: 55px;
        height: 55px;
    }

    .album-cover {
        width: 80px;
        height: 80px;
    }

    .song-info h2 {
        font-size: 1rem;
    }

    .song-info p {
        font-size: 0.85rem;
    }

    .control-btn {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }

    .play-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .player-bottom {
        padding: 12px 15px;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        flex-direction: column;
        height: auto;
        padding: 10px;
    }

    .sidebar-header h1 {
        font-size: 1.2rem;
        margin-bottom: 10px;
        margin-right: 0;
    }

    .sidebar-search {
        width: 100%;
        margin-bottom: 10px;
        margin-right: 0;
    }

    .sidebar-search-input {
        font-size: 0.85rem;
        padding: 8px 12px;
    }

    .playlist-section {
        padding: 10px 15px;
    }

    .playlist-item {
        height: 65px;
        padding: 10px;
    }

    .playlist-item-cover {
        width: 50px;
        height: 50px;
    }

    .playlist-item-title {
        font-size: 0.85rem;
    }

    .playlist-item-artist {
        font-size: 0.75rem;
    }

    .album-cover {
        width: 70px;
        height: 70px;
    }

    .song-info h2 {
        font-size: 0.95rem;
    }

    .song-info p {
        font-size: 0.8rem;
    }

    .progress-bar-container span {
        font-size: 0.7rem;
    }

    .control-btn {
        width: 40px;
        height: 40px;
        font-size: 0.95rem;
    }

    .play-btn {
        width: 46px;
        height: 46px;
        font-size: 1.1rem;
    }

    .player-bottom {
        padding: 10px 12px;
        gap: 10px;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .playlist-item {
        height: 60px;
        padding: 8px;
    }

    .playlist-item-cover {
        width: 48px;
        height: 48px;
    }

    .album-cover {
        width: 65px;
        height: 65px;
    }

    .song-info h2 {
        font-size: 0.9rem;
    }

    .song-info p {
        font-size: 0.75rem;
    }

    .player-bottom {
        padding: 8px 15px;
        gap: 10px;
    }

    .control-btn {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }

    .play-btn {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }
}
