body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f9;
    color: #333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 1em 0;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    margin: 0;
    font-size: 1.8em;
}

main {
    flex: 1;
    padding: 20px;
    max-width: 900px;
    margin: 20px auto;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0,0,0,0.05);
}

section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}
section:last-child {
    border-bottom: none;
}

h2 {
    color: #3498db;
    margin-top: 0;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
    display: inline-block;
}

#audio-manager .upload-container {
    margin-bottom: 15px;
}

.upload-button {
    background-color: #3498db;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}
.upload-button:hover {
    background-color: #2980b9;
}

#audio-list {
    list-style-type: none;
    padding: 0;
}

#audio-list li {
    padding: 10px;
    background-color: #ecf0f1;
    border: 1px solid #bdc3c7;
    margin-bottom: 8px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
}

#audio-list li:hover {
    background-color: #dfe6e9;
}

#audio-list li.active {
    background-color: #95a5a6;
    color: white;
    font-weight: bold;
}

#audio-list .delete-audio-btn {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8em;
}
#audio-list .delete-audio-btn:hover {
    background-color: #c0392b;
}


#player-section h2 {
    text-align: center;
    font-size: 1.3em;
    margin-bottom: 15px;
    word-break: break-all;
}

#audio-player-container {
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
}

#progress-bar-container {
    position: relative;
    width: 100%;
    margin-bottom: 10px;
    height: 20px; /* Increased height for better visualization */
    background-color: #e0e0e0;
    border-radius: 5px;
}

#seek-bar {
    width: 100%;
    cursor: pointer;
    position: relative;
    z-index: 10; /* Ensure seek bar is on top */
    margin: 0; /* Reset margin for better alignment */
    -webkit-appearance: none;
    appearance: none;
    height: 100%; /* Fill container height */
    background: transparent; /* Make default track transparent */
}
/* Custom track for WebKit/Blink */
#seek-bar::-webkit-slider-runnable-track {
    height: 100%;
    background: transparent; /* Handled by visualization layer */
    border-radius: 5px;
}
/* Custom thumb for WebKit/Blink */
#seek-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
    margin-top: 2px; /* Adjust to center if needed */
    box-shadow: 0 0 2px rgba(0,0,0,0.5);
}
/* Custom track for Firefox */
#seek-bar::-moz-range-track {
    height: 100%;
    background: transparent;
    border-radius: 5px;
}
/* Custom thumb for Firefox */
#seek-bar::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 2px rgba(0,0,0,0.5);
}


#seek-bar-tooltip {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 0.8em;
    pointer-events: none;
    display: none; /* Hidden by default */
    transform: translateX(-50%);
    z-index: 20;
    bottom: 25px; /* Position above the bar */
}

#bookmark-visualization-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allow clicks to pass through to seek bar */
    z-index: 5; /* Below seek bar thumb, above base progress bar */
    border-radius: 5px; /* Match container */
    overflow: hidden; /* Clip segments */
}

.bookmark-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #2c3e50;
    border-radius: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 6; /* Above segments, below seek bar thumb */
}

.listened-segment {
    position: absolute;
    height: 100%;
    background-color: #76c7c0; /* A pleasant teal color for listened segments */
    opacity: 0.7;
    z-index: 1; /* Behind bookmarks */
}


#time-display {
    text-align: center;
    margin-bottom: 15px;
    font-size: 0.9em;
    color: #555;
}

#controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

#controls button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

#controls button:hover {
    background-color: #2980b9;
}
#controls button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.volume-control-container {
    display: flex;
    align-items: center;
}

.volume-control-container span {
    margin-right: 5px;
    font-size: 1.2em;
}

#volume-control {
    width: 80px;
    cursor: pointer;
}

#completion-message {
    margin-top: 20px;
    padding: 15px;
    background-color: #2ecc71;
    color: white;
    text-align: center;
    border-radius: 5px;
    font-size: 1.1em;
}

#instructions {
    background-color: #fdfdea;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #f1c40f;
}
#instructions p {
    margin-bottom: 0.5em;
}

footer {
    text-align: center;
    padding: 15px 0;
    background-color: #34495e;
    color: #ecf0f1;
    font-size: 0.9em;
}