/* 1. Add Montserrat font */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap');

:root {
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --accent-color: #00b894;
    --dark-color: #232946;
    --light-color: #f5f6fa;
    --text-color: #232946;
    --text-light: #636e72;
    --shadow: 0 10px 32px 0 rgba(44, 62, 80, 0.15);
    --glass-border: rgba(255,255,255,0.25);
    --glow: 0 0 16px 2px var(--primary-color);
}

* {
    font-family: 'Montserrat', 'Poppins', sans-serif;
    box-sizing: border-box;
}

body, html {
    height: 100%;
    margin: 0;
    padding: 0;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(120deg, #6c5ce7 0%, #a29bfe 100%);
    opacity: 0.7;
    z-index: -2;
    width: 100vw;
    height: 100vh;
}

body {
    background: none;
    position: relative;
    min-height: 100vh;
    min-width: 100vw;
    overflow: hidden;
}

.container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    min-height: 100vh;
    width: 100vw;
    min-width: 0;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.music-player {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(18px) saturate(1.2);
    border-radius: 28px;
    border: 1.5px solid var(--glass-border);
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s;
    overflow: hidden;
    min-width: 180px;
    max-width: 300px;
    width: 100%;
    margin: 0 auto;
    padding: 6px 4px 6px 4px;
    max-height: 90vh;
    min-height: 180px;
    height: auto;
    box-sizing: border-box;
}
.music-player:hover {
    box-shadow: 0 16px 48px 0 rgba(44, 62, 80, 0.22);
}

@media (max-width: 480px) {
  .music-player {
    min-width: unset;
    max-width: 99vw;
    min-height: 420px;
    max-height: 98vh;
    padding: 12px 2vw 14px 2vw;
  }
  .container {
    padding: 0;
  }
}

.header {
    display: block;
    width: 100%;
    margin-bottom: 8px;
}

.header h1 {
    display: block;
    width: 100%;
    font-size: 1.1rem;
    letter-spacing: 1px;
    color: var(--primary-color);
    text-shadow: 0 2px 8px rgba(108,92,231,0.08);
    text-align: center;
    margin: 0 auto;
}

.upload-btn {
    position: relative;
}

.upload-btn input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.upload-btn label {
    background: var(--primary-color);
    color: white;
    padding: 10px 15px;
    border-radius: 50px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.upload-btn label:hover {
    background: #5649c5;
    transform: translateY(-2px);
}

.player-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.album-art-container {
    position: relative;
    margin-bottom: 30px;
    filter: drop-shadow(0 8px 32px rgba(108,92,231,0.18));
}

.vinyl {
    max-width: 80px;
    max-height: 80px;
    width: 12vw;
    height: 12vw;
    min-width: 60px;
    min-height: 60px;
    background: linear-gradient(135deg, #2d3436 0%, #000000 100%);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 32px rgba(44, 62, 80, 0.18);
    border: 4px solid rgba(108,92,231,0.08);
    position: relative;
    animation: rotate 20s linear infinite;
    animation-play-state: paused;
    transition: box-shadow 0.3s, border 0.3s;
}

.vinyl::before {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    background: #fff;
    border-radius: 50%;
    z-index: 2;
}

.vinyl-inner {
    max-width: 48px;
    max-height: 48px;
    width: 7vw;
    height: 7vw;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    z-index: 1;
    box-shadow: 0 0 0 6px rgba(162,155,254,0.12);
}

.album-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0 0 24px 0 rgba(108,92,231,0.18);
    border: 2px solid #fff;
}

.music-player.playing .vinyl {
    animation-play-state: running;
    box-shadow: 0 0 32px 4px var(--primary-color), 0 8px 32px rgba(44, 62, 80, 0.18);
    border: 4px solid var(--primary-color);
}

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

.song-info {
    text-align: center;
    margin-bottom: 25px;
    width: 100%;
}

.song-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.artist {
    font-size: 10px;
    color: var(--text-light);
}

.progress-container {
    width: 100%;
    background: #e0e0e0;
    border-radius: 5px;
    height: 6px;
    margin: 20px 0 10px;
    cursor: pointer;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 5px;
    height: 100%;
    width: 0%;
    transition: width 0.1s linear;
    position: relative;
    box-shadow: 0 0 8px 0 var(--primary-color);
}

.progress-bar::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: var(--accent-color);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 0 8px 0 var(--accent-color);
}

.progress-container:hover .progress-bar::after {
    opacity: 1;
}

.time-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-light);
    margin-top: 5px;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin: 6px 0;
}

.control-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 8px;
    cursor: pointer;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

.control-btn:hover, .control-btn:focus {
    background: rgba(162,155,254,0.18);
    color: var(--primary-color);
    box-shadow: 0 0 8px 0 var(--primary-color);
}

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

.play-btn {
    background: var(--primary-color);
    color: white;
    width: 24px;
    height: 24px;
    font-size: 10px;
    box-shadow: 0 2px 12px 0 rgba(108,92,231,0.18);
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    position: relative;
    z-index: 1;
}

.play-btn:hover {
    background: #5649c5;
    transform: scale(1.05);
    color: white;
}

.play-btn:active {
    transform: scale(0.97);
    box-shadow: 0 0 24px 0 var(--primary-color);
}
.play-btn::after {
    content: '';
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%,-50%);
    width: 80%; height: 80%;
    border-radius: 50%;
    box-shadow: 0 0 24px 0 var(--primary-color);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: -1;
}
.music-player.playing .play-btn::after {
    opacity: 0.5;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 250px;
}

.volume-control i {
    color: var(--text-light);
    font-size: 16px;
}

.volume-control input {
    flex: 1;
    height: 5px;
    cursor: pointer;
    -webkit-appearance: none;
    background: #e0e0e0;
    border-radius: 5px;
}

.volume-control input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 15px;
    height: 15px;
    background: var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 0 8px 0 var(--primary-color);
    border: 2px solid #fff;
}

.playlist-container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    margin-top: 18px;
}

.playlist-container h3 {
    font-size: 18px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
}

.playlist-scroll {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 120px;
    overflow-y: auto;
    padding-right: 10px;
}

.playlist-scroll::-webkit-scrollbar {
    width: 6px;
}

.playlist-scroll::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.playlist-scroll::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

#playlist {
    list-style: none;
    border-radius: 10px;
    overflow: hidden;
}

#playlist li {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    margin-bottom: 6px;
    transition: background 0.2s, box-shadow 0.2s, color 0.2s;
}

#playlist li:last-child {
    border-bottom: none;
}

#playlist li:hover {
    background: rgba(162,155,254,0.12);
    color: var(--primary-color);
    box-shadow: 0 0 8px 0 var(--secondary-color);
}

#playlist li.playing {
    background: rgba(108, 92, 231, 0.18);
    font-weight: 600;
    color: var(--primary-color);
    box-shadow: 0 0 16px 0 var(--primary-color);
    border-left: 4px solid var(--accent-color);
    border-radius: 8px;
}

#playlist li .song-number {
    margin-right: 15px;
    color: var(--text-light);
    font-size: 14px;
    width: 20px;
}

#playlist li .song-details {
    flex: 1;
    overflow: hidden;
}

#playlist li .song-title {
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

#playlist li .song-artist {
    font-size: 13px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#playlist li .song-duration {
    font-size: 13px;
    color: var(--text-light);
    margin-left: 15px;
}

.empty-playlist {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-light);
}

.empty-playlist i {
    font-size: 40px;
    margin-bottom: 15px;
    color: var(--secondary-color);
}

.empty-playlist p {
    margin-bottom: 5px;
}

.playlist-search {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1.5px solid #e0e0e0;
    font-size: 15px;
    outline: none;
    margin-bottom: 18px;
    background: rgba(255,255,255,0.85);
    transition: border 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px 0 rgba(108,92,231,0.04);
}

.playlist-search:focus {
    border: 1.5px solid var(--primary-color);
    box-shadow: 0 0 0 2px rgba(108,92,231,0.10);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .music-player {
        padding: 20px;
        border-radius: 18px;
    }
    
    .vinyl {
        width: 200px;
        height: 200px;
    }
    
    .vinyl-inner {
        width: 120px;
        height: 120px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
    }
    
    .header h1 {
        font-size: 1.3rem;
    }
}

/* Animation for when song changes */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.song-change-animation {
    animation: fadeIn 0.5s ease;
}

@media (max-height: 700px) {
  .music-player {
    max-height: 88vh;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .playlist-scroll {
    max-height: 120px;
  }
}

@media (max-width: 600px) {
  .music-player {
    min-width: unset;
    max-width: 99vw;
    width: 100vw;
    min-height: 420px;
    max-height: 98vh;
    padding: 12px 2vw 14px 2vw;
  }
  .header h1 {
    font-size: 1.3rem;
  }
  .vinyl {
    width: 120px;
    height: 120px;
    max-width: 120px;
    max-height: 120px;
  }
  .vinyl-inner {
    width: 70px;
    height: 70px;
    max-width: 70px;
    max-height: 70px;
  }
  .song-title {
    font-size: 16px;
  }
  .artist {
    font-size: 12px;
  }
  .controls {
    gap: 8px;
    margin: 12px 0;
  }
  .play-btn {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
  .control-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
}
