body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #8e2de2, #4a00e0); /* Gradient background */
    color: #ffffff;
    position: relative; /* For the fixed audio bar */
    padding-bottom: 80px; /* Space for the fixed audio bar */
    box-sizing: border-box; /* Include padding in width */
}

.player-container {
    background-color: rgba(0, 0, 0, 0.6); /* Semi-transparent background */
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
    text-align: center;
    max-width: 450px;
    width: 90%;
    box-sizing: border-box;
    animation: fadeIn 1s ease-out;
    /* margin-bottom: 80px; Removed because padding-bottom is on body */
    display: flex; /* Use flexbox for layout inside container */
    flex-direction: column; /* Arrange children vertically */
    align-items: center; /* Center items horizontally */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

h1 {
    margin-top: 0; /* Remove default top margin */
    margin-bottom: 20px; /* Adjusted margin */
    color: #e0e0e0; /* Light grey for heading */
    font-size: 2.8em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    direction: rtl; /* For Urdu text */
    font-family: 'Noto Nastaliq Urdu', sans-serif; /* Noto font applied */
    width: 100%; /* Ensure heading takes full width */
}

/* New Track Info Detail Styles */
.track-info-detail {
    margin-bottom: 20px; /* Space below track info */
    color: #ccc; /* Lighter color for info */
    font-size: 1em;
    width: 100%; /* Take full width */
}

.track-info-detail div {
    margin-bottom: 5px; /* Space between info lines */
    /* Optional: styles for specific info types */
    #track-name-detail {
        font-size: 1.2em; /* Slightly larger for track name */
        font-weight: bold;
        color: #fff;
    }
    #track-artist {
         font-size: 1em;
         color: #ccc;
    }
    #track-album {
         font-size: 0.9em;
         color: #bbb;
         font-style: italic;
    }
}


.main-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px; /* Adjusted margin */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 10px; /* Space between buttons */
}

.control-btn {
    background-color: #6a1bb2; /* Purple background for buttons */
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.2em;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0; /* Prevent buttons from shrinking */
}

.control-btn.large {
    width: 80px;
    height: 80px;
    font-size: 2em;
    background-color: #ff4081; /* Accent color for play/pause */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}
.control-btn.small { /* Style for seek buttons */
    width: 40px;
    height: 40px;
    font-size: 1em;
}


.control-btn:hover {
    background-color: #7b2ed0;
    transform: scale(1.05);
}

.control-btn.large:hover {
    background-color: #e00060;
}
.control-btn.small:hover {
     background-color: #5a0f92;
}


.control-btn:active {
    transform: scale(0.95);
}

.control-btn:disabled {
    background-color: #555;
    cursor: not-allowed;
    opacity: 0.7;
}

/* New Additional Controls Container */
.additional-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px; /* Space between seek buttons and speed select */
    margin-bottom: 20px; /* Space below additional controls */
    flex-wrap: wrap;
    width: 100%;
}

/* Style for Speed Select Dropdown */
#speed-select {
    padding: 8px 15px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background-color: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 1em;
    cursor: pointer;
    outline: none;
    -webkit-appearance: none; /* Remove default system styles */
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.362%22%20height%3D%22292.362%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20d%3D%22M287.043%2C100.407l-14.336-14.335c-4.092-4.092-10.744-4.092-14.835%2C0L146.181%2C230.36l-111.71-111.708c-4.091-4.092-10.743-4.092-14.836%2C0l-14.336%2C14.335c-4.092%2C4.092-4.092%2C10.744%2C0%2C14.836l128.846%2C128.844c4.093%2C4.092%2C10.745%2C4.092%2C14.837%2C0l128.841-128.844C291.134%2C111.151%2C291.134%2C104.499%2C287.043%2C100.407z%22%2F%3E%3C%2Fsvg%3E'); /* Custom dropdown arrow */
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: 12px auto;
    padding-right: 30px; /* Space for custom arrow */
}


.progress-section {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    font-size: 0.9em;
    width: 100%; /* Take full width */
}

#current-time, #duration {
    width: 45px; /* Adjusted width */
    text-align: center;
    flex-shrink: 0;
}

.progress-bar-container {
    flex-grow: 1;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    margin: 0 10px;
    cursor: pointer;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background-color: #ff4081; /* Accent color for progress */
    border-radius: 4px;
    transition: width 0.1s linear;
}

/* Volume Control */
.volume-control {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    width: 100%; /* Take full width */
}

#volume-icon {
    font-size: 1.2em;
    margin-right: 10px;
    color: #e0e0e0;
}

#volume-slider {
    width: 150px;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background-color: #ff4081;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background-color: #ff4081;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border: none;
}


/* New Loading Indicator Style */
.loading-indicator {
    color: #ff4081; /* Accent color */
    font-size: 1em;
    margin-top: -20px; /* Adjust margin */
    margin-bottom: 20px; /* Space below */
    visibility: hidden; /* Hidden by default */
    opacity: 0; /* Fully transparent by default */
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-indicator.visible {
    visibility: visible; /* Becomes visible */
    opacity: 1; /* Fully opaque */
}


/* Visualizer Canvas */
#visualizer {
    width: 100%;
    height: 80px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
    display: block; /* Ensure it takes up space */
}

/* Track List */
.track-list-container {
    background-color: rgba(0, 0, 0, 0.4);
    padding: 20px;
    border-radius: 15px;
    margin-top: 20px;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
    width: 100%; /* Take full width */
    box-sizing: border-box;
}

.track-list-container h2 {
    color: #e0e0e0;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.5em;
    text-align: center;
}

#track-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.track-item {
    padding: 10px 15px;
    margin-bottom: 8px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    text-align: left;
    font-size: 1.1em;
    color: #e0e0e0;
}

.track-item:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.track-item.active {
    background-color: #ff4081;
    color: #ffffff;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(255, 64, 129, 0.5);
}

/* Scrollbar Customization (for Webkit browsers like Chrome/Edge) */
.track-list-container::-webkit-scrollbar {
    width: 8px;
}

.track-list-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.track-list-container::-webkit-scrollbar-thumb {
    background: #6a1bb2;
    border-radius: 10px;
}

.track-list-container::-webkit-scrollbar-thumb:hover {
    background: #7b2ed0;
}

/* Fixed Audio Bar at Bottom */
.audio-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #1a1a1a;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.5);
    box-sizing: border-box;
    z-index: 1000;
}

#audio-bar-track-name {
    font-size: 1.1em;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
    margin-right: 15px;
}

.audio-bar-controls {
    display: flex;
    align-items: center;
    flex-shrink: 0; /* Prevent controls from shrinking */
}

.control-btn.small {
    width: 40px;
    height: 40px;
    font-size: 1em;
    margin: 0 5px;
}
.audio-bar-controls .control-btn.small { /* Specific margin for bar controls */
    margin: 0 3px;
}


/* Responsive Design */
@media (max-width: 600px) {
    body {
        padding-bottom: 70px; /* Adjust for slightly smaller bar */
    }
    .player-container {
        padding: 20px;
        border-radius: 10px;
    }

    h1 {
        font-size: 2em;
        margin-bottom: 15px;
    }
     .track-info-detail {
        margin-bottom: 15px;
        font-size: 0.9em;
     }
      .track-info-detail div #track-name-detail {
         font-size: 1.1em;
      }


    .main-controls {
         margin-bottom: 15px;
         gap: 8px;
    }

    .control-btn {
        width: 45px; /* Slightly smaller */
        height: 45px;
        font-size: 1.1em;
    }

    .control-btn.large {
        width: 70px;
        height: 70px;
        font-size: 1.7em;
    }
    .control-btn.small {
         width: 35px;
         height: 35px;
         font-size: 0.9em;
    }


    .additional-controls {
        margin-bottom: 15px;
        gap: 10px;
    }

    #speed-select {
        padding: 6px 10px;
        font-size: 0.9em;
        background-position: right 8px top 50%;
        background-size: 10px auto;
        padding-right: 25px;
    }

    .progress-section {
        margin-bottom: 15px;
        font-size: 0.8em;
    }

    #current-time, #duration {
        width: 40px;
    }

    #volume-slider {
        width: 120px; /* Adjust slider width */
    }


    #visualizer {
        height: 60px;
        margin-bottom: 20px;
    }

    .track-list-container {
        padding: 15px;
        margin-top: 15px;
    }

    .track-list-container h2 {
        font-size: 1.3em;
    }

    .track-item {
        padding: 8px 12px;
        font-size: 1em;
    }

    .audio-bar {
        padding: 8px 15px;
        padding-right: 10px; /* Adjust right padding */
    }

    #audio-bar-track-name {
        font-size: 0.9em;
        margin-right: 10px;
    }

    .audio-bar-controls .control-btn.small { /* Specific margin for bar controls */
       width: 35px;
       height: 35px;
       font-size: 0.9em;
       margin: 0 2px;
    }
}

@media (max-width: 400px) {
     .player-container {
        padding: 15px;
     }
     h1 {
        font-size: 1.8em;
     }
     .main-controls {
         gap: 5px;
     }

     .control-btn {
        width: 40px;
        height: 40px;
        font-size: 1em;
     }
     .control-btn.large {
        width: 60px;
        height: 60px;
        font-size: 1.5em;
     }
      .control-btn.small {
         width: 30px;
         height: 30px;
         font-size: 0.8em;
     }


     .progress-section {
        font-size: 0.7em;
     }
     #current-time, #duration {
         width: 35px;
     }

     #volume-slider {
        width: 100px;
      }
      .volume-control {
        gap: 5px;
        margin-bottom: 20px; /* Adjust margin */
      }
       #volume-icon {
        font-size: 1em;
       }

     #visualizer {
        margin-bottom: 20px;
     }


     .track-item {
        font-size: 0.9em;
        padding: 7px 10px;
     }

     .audio-bar {
        padding: 6px 10px;
     }
     #audio-bar-track-name {
        font-size: 0.8em;
     }
      .audio-bar-controls .control-btn.small {
       width: 30px;
       height: 30px;
       font-size: 0.8em;
       margin: 0 1px; /* Reduce margin */
    }

}
