* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 30px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

h1 {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1.1em;
}

.status-bar {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 30px;
}

.status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.label {
    font-size: 0.9em;
    color: #666;
    font-weight: 500;
}

.status-value {
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
}

.status-value.recording {
    color: #22c55e;
}

.status-value.stopped {
    color: #ef4444;
}

.player-section {
    margin-bottom: 40px;
}

h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.timeline-container {
    margin-bottom: 20px;
}

.timeline {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    margin-bottom: 10px;
    transition: height 0.2s ease;
}

.timeline:hover {
    height: 12px;
}

.timeline-inner {
    height: 100%;
    position: relative;
    width: 100%;
    border-radius: 4px;
    overflow: hidden;
}

.timeline-segment {
    position: absolute;
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: opacity 0.2s ease;
}

.timeline-segment:hover {
    opacity: 0.8;
}

/* Scrubber/Playhead */
.timeline-scrubber {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: #667eea;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    cursor: grab;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.timeline:hover .timeline-scrubber,
.timeline.dragging .timeline-scrubber {
    opacity: 1;
    pointer-events: all;
}

.timeline-scrubber:hover {
    transform: translate(-50%, -50%) scale(1.2);
}

.timeline-scrubber:active,
.timeline.dragging .timeline-scrubber {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.3);
}

/* Hover preview line */
.timeline-hover-line {
    position: absolute;
    top: 0;
    width: 2px;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 5;
}

.timeline:hover .timeline-hover-line {
    opacity: 1;
}

.timeline-tooltip {
    position: fixed;
    display: none;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
}

/* Mobile touch improvements */
@media (max-width: 768px) {
    .timeline {
        height: 12px;
        margin: 20px 0;
    }

    .timeline:hover {
        height: 16px;
    }

    .timeline-scrubber {
        width: 20px;
        height: 20px;
        border-width: 4px;
        opacity: 1;
        pointer-events: all;
    }

    .timeline-tooltip {
        font-size: 1.1em;
        padding: 10px 16px;
    }
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
    color: #666;
    padding: 0 5px;
}

.controls {
    margin: 30px 0;
}

#audio-player {
    width: 100%;
    height: 54px;
    border-radius: 8px;
    outline: none;
}

.time-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.time-selector label {
    font-weight: 500;
    color: #333;
}

.time-selector.specific-time {
    background: #e0e7ff;
    border: 2px solid #667eea;
}

.help-text {
    font-size: 0.85em;
    color: #666;
    font-style: italic;
    width: 100%;
    margin-top: 5px;
}

#time-offset,
#specific-time {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    transition: border-color 0.3s;
}

#specific-time {
    min-width: 150px;
    flex: 0 0 auto;
}

#time-offset:hover,
#time-offset:focus,
#specific-time:hover,
#specific-time:focus {
    border-color: #667eea;
    outline: none;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #e5e7eb;
    color: #333;
    border: 2px solid #d1d5db;
}

.btn-secondary:hover {
    background: #d1d5db;
    border-color: #9ca3af;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.btn-secondary:active {
    transform: translateY(0);
}

.current-playback-top {
    padding: 15px 20px;
    background: #dcfce7;
    border-left: 4px solid #22c55e;
    border-radius: 6px;
    margin-bottom: 15px;
    text-align: center;
}

.current-playback-top p {
    margin: 0;
    color: #166534;
    font-size: 1.1em;
}

#current-time-display-top {
    font-weight: bold;
    color: #15803d;
    font-size: 1.2em;
}

/* Hide audio player timeline/progress bar */
audio::-webkit-media-controls-timeline {
    display: none;
}

audio::-webkit-media-controls-current-time-display,
audio::-webkit-media-controls-time-remaining-display {
    display: none;
}

.chunks-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #eee;
}

.chunks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chunks-header h2 {
    margin: 0;
}

.chunks-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    transition: all 0.3s ease;
}

.chunks-list.hidden {
    display: none;
}

.chunk-item {
    padding: 15px;
    background: #f8f9fa;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.chunk-item:hover {
    border-color: #667eea;
    background: #ede9fe;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.chunk-item.playing {
    border-color: #22c55e;
    background: #dcfce7;
}

.chunk-time {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.chunk-id {
    font-size: 0.85em;
    color: #666;
}

.loading {
    text-align: center;
    color: #666;
    padding: 20px;
    font-style: italic;
}

.error {
    padding: 15px;
    background: #fee2e2;
    border-left: 4px solid #ef4444;
    border-radius: 6px;
    color: #991b1b;
    margin: 20px 0;
}

/* Scrollbar styling */
.chunks-list::-webkit-scrollbar {
    width: 8px;
}

.chunks-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.chunks-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.chunks-list::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

/* Footer */
.footer {
    margin-top: 40px;
    padding: 20px;
    background: #f8f9fa;
    border-top: 2px solid #e5e7eb;
    text-align: center;
}

.footer p {
    margin: 5px 0;
    color: #666;
    font-size: 0.9em;
}

.footer-note {
    font-size: 0.85em;
    color: #999;
    font-style: italic;
}

#timezone-display {
    font-weight: bold;
    color: #667eea;
    font-family: monospace;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 2em;
    }

    .status-bar {
        flex-direction: column;
        gap: 15px;
    }

    .time-selector {
        flex-direction: column;
        align-items: stretch;
    }

    #time-offset {
        width: 100%;
    }

    .chunks-list {
        grid-template-columns: 1fr;
    }
}
