:root {
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --bg-color: #dfe6e9;
    --player-bg: #ffffff;
    --text-color: #2d3436;
    --text-secondary: #636e72;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    min-height: 100vh;
    color: var(--text-color);
    padding-top: 150px; /* Adjusted for fixed nav */
}

/* Top Navigation */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 2000;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary-color);
}

.burger-menu {
    display: none;
    cursor: pointer;
}

.burger-menu div {
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    margin: 5px;
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .nav-links {
        position: absolute;
        right: 0;
        height: 92vh;
        top: 60px;
        background-color: white;
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 50%;
        transform: translateX(100%);
        transition: transform 0.3s ease-in;
        box-shadow: -2px 0 5px rgba(0,0,0,0.1);
        padding-top: 50px;
    }

    .nav-links.nav-active {
        transform: translateX(0%);
    }

    .burger-menu {
        display: block;
    }
    
    /* Burger Animation */
    .toggle .line1 {
        transform: rotate(-45deg) translate(-5px, 6px);
    }
    .toggle .line2 {
        opacity: 0;
    }
    .toggle .line3 {
        transform: rotate(45deg) translate(-5px, -6px);
    }
}

.player-container {
    position: relative;
    display: flex;
    flex-direction: row;
    background-color: var(--player-bg);
    border-radius: 20px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    overflow: visible; /* Changed from hidden to allow comment flyouts to show */
    width: 800px;
    max-width: 95%;
    min-height: 140px;
    height: auto;
    margin: 0 auto; /* Center horizontally */
    transition: all 0.3s ease;
    z-index: 10;
    opacity: 1;
    visibility: visible;
}

.player-wrapper {
    flex: 1;
    padding: 20px; /* Reduced from 30px */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.player-content-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px; /* Reduced from 40px */
    margin-bottom: 15px; /* Reduced from 20px */
    width: 100%;
}

.artwork-container {
    width: 120px; /* Reduced from 200px */
    height: 120px; /* Reduced from 200px */
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    /* margin-bottom: 20px; Removed margin as it's handled by gap */
    position: relative;
    flex-shrink: 0;
}

.artwork {
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: rotate 20s linear infinite;
    animation-play-state: paused;
}

.player-wrapper.playing .artwork {
    animation-play-state: running;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.track-info {
    text-align: center;
    margin-bottom: 10px; /* Reduced from 15px */
}

.track-info h2 {
    font-size: 1.3rem; /* Reduced from 1.5rem */
    margin-bottom: 3px; /* Reduced from 5px */
}

.track-info h3 {
    font-size: 0.9rem; /* Reduced from 1rem */
    color: var(--text-secondary);
    font-weight: normal;
}

.progress-container {
    width: 100%;
    margin-bottom: 15px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#waveform-wrapper {
    width: 100%;
    display: block; /* Default to showing waveform */
}

#track-slider {
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    background: #ccc;
    border-radius: 5px;
    outline: none;
    opacity: 0;
    pointer-events: none; /* Hidden by default */
    transition: opacity 0.3s ease-in-out;
    margin-top: 10px; /* Space between time info */
}

#track-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    margin-top: -5px; /* Adjust thumb position */
}

#track-slider.active {
    opacity: 1;
    pointer-events: all;
}

#waveform {
    /* waveform styles */
    width: 100%;
    height: 70px; /* or whatever height you want for the waveform */
}

.progress-container.show-slider #waveform-wrapper {
    display: none;
}

.progress-container.show-slider #track-slider {
    opacity: 1;
    pointer-events: all;
}

.time-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 35px;
}

.action-btn {
    background-color: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.action-btn:hover {
    color: var(--primary-color);
}

.action-btn-big {
    color: var(--primary-color);
    font-size: 2.5rem;
}

.player-extra-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 60px;
    margin-top: 20px;
    flex-wrap: wrap;
    max-width: 100%;
}

.volume-container {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 180px;
    max-width: 100%;
}

#volume-slider {
    flex: 1;
    min-width: 0;
    height: 4px;
    -webkit-appearance: none;
    background: #ddd;
    border-radius: 2px;
    outline: none;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
}

.secondary-controls {
    display: flex;
    gap: 30px;
    align-items: center;
}

#repeat-btn.active-track {
    color: var(--primary-color);
    position: relative;
}

#repeat-btn.active-track::after {
    content: '1';
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 10px;
    font-weight: bold;
    background: var(--primary-color);
    color: white;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#repeat-btn.active-playlist {
    color: var(--primary-color);
}

.action-btn-big:hover {
    transform: scale(1.1);
}

.playlist-wrapper {
    width: 0;
    flex: 0;
    padding: 0;
    opacity: 0;
    background-color: var(--player-bg);
    overflow: hidden;
    border-left: none;
    transition: all 0.3s ease;
    visibility: hidden; /* Hide content when closed */
    position: relative;
    display: flex;
    flex-direction: column;
}

.playlist-container {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 5px;
    padding-bottom: 100px; /* keep last item scrollable above floating save button */
    max-height: none;
}

/* Custom Scrollbar for Playlist */
.playlist-container::-webkit-scrollbar {
    width: 6px;
}

.playlist-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.playlist-container::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 10px;
}

.playlist-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

.playlist-wrapper.active {
    flex: 1;
    min-width: 300px;
    flex-shrink: 0;
    padding: 30px;
    opacity: 1;
    border-left: 1px solid #eee;
    visibility: visible;
}

.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.close-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s, transform 0.2s;
}

.close-btn:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.save-playlist-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: #00b894;
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.2s, background-color 0.2s;
    z-index: 10;
}

.save-playlist-btn:hover {
    transform: scale(1.1);
    background-color: #00a383;
}

.playlist-wrapper h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.playlist {
    list-style-type: none;
}

.playlist li {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: 8px;
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

.playlist li:hover {
    background-color: #f8f9fa;
}

.playlist li.active {
    background-color: var(--secondary-color);
    color: white;
}

.playlist li .song-index {
    margin-right: 10px;
    font-size: 0.8rem;
    opacity: 0.7;
}

@media (max-width: 768px) {
    .player-container {
        flex-direction: column;
        height: auto;
        width: 100%;
        border-radius: 0;
    }
    
    .playlist-wrapper {
        height: 0;
        width: 100%;
        border-left: none;
        border-top: 1px solid #eee;
        flex: none;
    }

    .playlist-wrapper.active {
        height: 300px;
        width: 100% !important;
        min-width: 100% !important;
        flex: none !important;
        display: flex !important;
        flex-direction: column;
    }

    .player-content-row {
        flex-direction: column;
        gap: 20px;
    }
    
    .artwork-container {
        width: 150px;
        height: 150px;
    }
    
    .player-wrapper {
        padding: 20px;
    }
}

/* Basket Icon */
.basket-icon {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 1000;
    transition: transform 0.2s;
}

.basket-icon:hover {
    transform: scale(1.1);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: rgba(45, 52, 54, 0.95);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 0.9rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    backdrop-filter: blur(5px);
    animation: toast-in 0.3s ease-out forwards, toast-out 0.3s ease-in 2.7s forwards;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 4px solid var(--primary-color);
}

.toast.error {
    border-left-color: #ff7675;
}

.toast.success {
    border-left-color: #55efc4;
}

@keyframes toast-in {
    from { transform: translateY(100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes toast-out {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(100px); opacity: 0; }
}

.basket-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ff7675;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

/* Feedback Modal */
.feedback-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.feedback-modal.active {
    opacity: 1;
    pointer-events: all;
}

.feedback-content {
    background-color: white;
    padding: 30px;
    border-radius: 15px;
    width: 400px;
    max-width: 90%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.feedback-content h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.icon-selector {
    margin-bottom: 15px;
}

.icon-selector label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--text-secondary);
}

.icon-selector .icons {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.feedback-icon {
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: transform 0.2s, background-color 0.2s;
}

.feedback-icon:hover {
    transform: scale(1.2);
    background-color: #f0f0f0;
}

.feedback-icon.selected {
    background-color: var(--secondary-color);
    transform: scale(1.2);
}

.feedback-content textarea {
    width: 100%;
    height: 100px;
    margin: 15px 0;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    resize: none;
}

.feedback-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.feedback-actions button {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

#cancel-feedback {
    background-color: #dfe6e9;
    color: var(--text-color);
}

#submit-feedback {
    background-color: var(--primary-color);
    color: white;
}

/* Waveform */
#waveform {
    width: 100%;
    height: 60px;
    cursor: pointer;
    position: relative;
}

/* Waveform Region/Marker Styles */
.wavesurfer-region {
    z-index: 10 !important;
}

.region-icon {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.2rem;
    pointer-events: none;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Active Comment Display */
.active-comment {
    position: absolute;
    bottom: 100%; /* Position above the waveform */
    left: 0;
    background-color: rgba(255, 255, 255, 0.98);
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
    z-index: 10000;
    border: 1px solid var(--secondary-color);
    min-width: 180px;
    max-width: 280px;
    max-height: 180px;
    overflow-y: auto;
    pointer-events: auto; /* Allow scrolling */
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.active-comment.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}

.active-comment::after {
    content: '';
    position: absolute;
    top: 100%;
    left: var(--tail-offset, 50%);
    transform: translateX(-50%);
    border-width: 8px;
    border-style: solid;
    border-color: white transparent transparent transparent;
}

.active-comment-item {
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.active-comment-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.active-comment strong {
    color: var(--primary-color);
    margin-right: 5px;
    display: block;
    font-size: 0.8rem;
}

.active-comment .comment-body {
    display: flex;
    align-items: flex-start;
    gap: 5px;
}

.active-comment .comment-icon {
    font-size: 1.1rem;
}

/* Animations */
@keyframes flyToBasket {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(0.5);
        opacity: 0.8;
    }
    100% {
        transform: scale(0.1) translate(var(--tx), var(--ty));
        opacity: 0;
    }
}

.flying-item {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    animation: flyToBasket 0.8s ease-in-out forwards;
}

.basket-pulse {
    animation: pulse 0.3s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}