/* Popup Audio Player Styles */
.audio-popup-container {
    position: fixed;
    z-index: 10000;
    width: 380px;
    max-width: 90vw;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
    cursor: grab;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    user-select: none;
    animation: popupFadeIn 0.3s ease-out;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.audio-popup-container:active {
    cursor: grabbing;
}

/* Header */
.audio-popup-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
    position: relative;
    overflow: hidden;
}

.audio-popup-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
}

.audio-popup-header:active {
    cursor: grabbing;
}

.audio-popup-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.audio-icon {
    font-size: 18px;
}

.chapter-title {
    font-weight: 600;
    font-size: 14px;
    margin: 0;
}

.current-part-indicator {
    margin-left: 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.audio-popup-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.audio-popup-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.audio-popup-close:active {
    transform: scale(0.95);
}

/* Controls Container */
.audio-controls {
    padding: 20px;
}

/* Main Controls */
.main-controls {
    text-align: center;
    margin-bottom: 20px;
}

.audio-btn-large {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    color: white;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    min-width: 120px;
}

.audio-btn-large:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.4);
}

.audio-btn-large:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.audio-btn-large:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
}

/* Progress Section */
.progress-section {
    margin-bottom: 18px;
}

.progress-bar-container {
    margin-bottom: 8px;
}

.progress-bar-track {
    height: 8px;
    background: linear-gradient(90deg, #e9ecef 0%, #f8f9fa 100%);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-bar-track:hover {
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15), 0 0 0 2px rgba(0, 123, 255, 0.2);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff 0%, #0056b3 100%);
    border-radius: 4px;
    transition: width 0.2s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 4px 4px 0 0;
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
    padding: 0 2px;
}

/* Part Navigation */
.part-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding: 12px 16px;
    background: rgba(0, 123, 255, 0.05);
    border: 1px solid rgba(0, 123, 255, 0.1);
    border-radius: 8px;
}

.nav-btn {
    background: #ffffff;
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.nav-btn:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #007bff;
    color: #007bff;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.nav-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.nav-btn:disabled {
    background: #f8f9fa;
    color: #adb5bd;
    cursor: not-allowed;
    opacity: 0.6;
}

.part-info {
    text-align: center;
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

/* Bottom Controls */
.bottom-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 16px;
}

.speed-control, .volume-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

.speed-control label, .volume-control label {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    margin: 0;
}

.speed-select {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.speed-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

.volume-slider {
    width: 70px;
    height: 4px;
    border-radius: 2px;
    background: #dee2e6;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    background: #0056b3;
    transform: scale(1.2);
}

.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.parts-toggle-btn {
    background: #ffffff;
    border: 1px solid #007bff;
    color: #007bff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.parts-toggle-btn:hover {
    background: #007bff;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.3);
}

/* Parts List */
.parts-list {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 250px;
    }
}

.parts-container {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #ffffff;
}

/* Custom scrollbar */
.parts-container::-webkit-scrollbar {
    width: 6px;
}

.parts-container::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 3px;
}

.parts-container::-webkit-scrollbar-thumb {
    background: #ced4da;
    border-radius: 3px;
}

.parts-container::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

.part-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f8f9fa;
    position: relative;
}

.part-item:last-child {
    border-bottom: none;
}

.part-item:hover {
    background: rgba(0, 123, 255, 0.05);
}

.part-item.current-part {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1) 0%, rgba(32, 201, 151, 0.1) 100%);
    border-left: 3px solid #28a745;
}

.part-item.current-part:hover {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.15) 0%, rgba(32, 201, 151, 0.15) 100%);
}

.part-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.part-label {
    font-weight: 500;
    font-size: 13px;
    color: #495057;
}

.current-part .part-label {
    color: #28a745;
    font-weight: 600;
}

.playing-indicator {
    font-size: 11px;
    color: #28a745;
    font-weight: 600;
    padding: 2px 6px;
    background: rgba(40, 167, 69, 0.1);
    border-radius: 4px;
}

/* Responsive Design */
@media (max-width: 480px) {
    .audio-popup-container {
        width: 90vw;
        max-width: none;
        left: 5vw !important;
        top: 10vh !important;
        transform: none !important;
    }
    
    .audio-popup-header {
        padding: 10px 12px;
    }
    
    .audio-controls {
        padding: 16px;
    }
    
    .bottom-controls {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .speed-control, .volume-control {
        justify-content: center;
    }
    
    .volume-slider {
        width: 100px;
    }
    
    .part-navigation {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .nav-btn {
        width: 100%;
        max-width: 120px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .audio-popup-container {
        background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .progress-bar-track {
        background: linear-gradient(90deg, #4a5568 0%, #2d3748 100%);
    }
    
    .time-display {
        color: #a0aec0;
    }
    
    .part-navigation {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .nav-btn {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .nav-btn:hover:not(:disabled) {
        background: #2d3748;
        border-color: #007bff;
    }
    
    .bottom-controls {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .speed-select {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .parts-container {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .part-item {
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .part-item:hover {
        background: rgba(255, 255, 255, 0.05);
    }
    
    .parts-toggle-btn {
        background: #4a5568;
        border-color: #007bff;
        color: #007bff;
    }
}