/**
 * Custom Audio Player Styles
 * Modern, responsive design with touch-friendly controls
 */

.custom-audio-player {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    color: white;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 600px;
    margin: 20px auto;
    position: relative;
    overflow: hidden;
}

.custom-audio-player::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    pointer-events: none;
}

.player-header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.track-info {
    margin-bottom: 10px;
}

.track-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.player-main {
    position: relative;
    z-index: 1;
}

/* Progress Bar */
.progress-container {
    margin-bottom: 25px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.progress-bar:hover {
    height: 12px;
    transform: translateY(-2px);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #ffa500);
    border-radius: 4px;
    transition: width 0.1s ease;
    position: relative;
}

.progress-handle {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    cursor: grab;
    transition: all 0.2s ease;
}

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

.progress-handle:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.1);
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

/* Main Controls */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

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

.play-btn {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    background: linear-gradient(135deg, #ff6b6b, #ffa500);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.play-btn:hover {
    background: linear-gradient(135deg, #ff5252, #ff9800);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.5);
}

.play-btn.playing {
    background: linear-gradient(135deg, #4caf50, #8bc34a);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.skip-btn {
    width: 45px;
    height: 45px;
    font-size: 1.1rem;
}

/* Secondary Controls */
.secondary-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.volume-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
}

.volume-slider-container {
    width: 80px;
}

.volume-slider {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

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

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

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

.speed-select {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    padding: 8px 12px;
    font-size: 0.9rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    outline: none;
    transition: all 0.3s ease;
}

.speed-select:hover {
    background: rgba(255, 255, 255, 0.3);
}

.speed-select option {
    background: #333;
    color: white;
}

.loop-btn, .download-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
}

.loop-btn.active {
    background: linear-gradient(135deg, #4caf50, #8bc34a);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.download-btn {
    background: linear-gradient(135deg, #2196f3, #21cbf3);
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.4);
}

.download-btn:hover {
    background: linear-gradient(135deg, #1976d2, #1cb5e0);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(33, 150, 243, 0.5);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .custom-audio-player {
        margin: 10px;
        padding: 20px;
        border-radius: 15px;
    }
    
    .track-title {
        font-size: 1.1rem;
    }
    
    .controls {
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .play-btn {
        width: 55px;
        height: 55px;
        font-size: 1.3rem;
    }
    
    .skip-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .secondary-controls {
        gap: 12px;
        justify-content: space-around;
    }
    
    .volume-slider-container {
        width: 70px;
    }
    
    .speed-select {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    
    .loop-btn, .download-btn {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .custom-audio-player {
        padding: 15px;
        margin: 5px;
    }
    
    .track-title {
        font-size: 1rem;
    }
    
    .controls {
        gap: 12px;
    }
    
    .play-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .skip-btn {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    
    .secondary-controls {
        gap: 8px;
    }
    
    .volume-slider-container {
        width: 60px;
    }
    
    .speed-select {
        padding: 5px 8px;
        font-size: 0.8rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .custom-audio-player {
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    }
}

/* Loading state */
.custom-audio-player.loading {
    opacity: 0.7;
    pointer-events: none;
}

.custom-audio-player.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Focus states for accessibility */
.control-btn:focus,
.speed-select:focus,
.volume-slider:focus {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

/* Small player variant for library cards */
.custom-audio-player-small {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    color: white;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: relative;
    overflow: hidden;
}

.custom-audio-player-small::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    pointer-events: none;
}

.custom-audio-player-small .player-header {
    text-align: center;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.custom-audio-player-small .track-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-audio-player-small .player-main {
    position: relative;
    z-index: 1;
}

.custom-audio-player-small .progress-container {
    margin-bottom: 15px;
}

.custom-audio-player-small .progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    margin-bottom: 8px;
}

.custom-audio-player-small .progress-handle {
    width: 12px;
    height: 12px;
}

.custom-audio-player-small .time-display {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
}

.custom-audio-player-small .controls {
    gap: 12px;
    margin-bottom: 15px;
}

.custom-audio-player-small .play-btn {
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
}

.custom-audio-player-small .skip-btn {
    width: 35px;
    height: 35px;
    font-size: 0.9rem;
}

.custom-audio-player-small .secondary-controls {
    gap: 10px;
    justify-content: center;
}

.custom-audio-player-small .volume-control {
    gap: 8px;
}

.custom-audio-player-small .volume-btn {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
}

.custom-audio-player-small .volume-slider-container {
    width: 60px;
}

.custom-audio-player-small .speed-select {
    padding: 4px 8px;
    font-size: 0.8rem;
}

.custom-audio-player-small .loop-btn,
.custom-audio-player-small .download-btn {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .custom-audio-player {
        background: #000;
        border: 2px solid #fff;
    }
    
    .control-btn {
        border: 2px solid #fff;
    }
    
    .progress-bar {
        background: #333;
    }
    
    .progress-fill {
        background: #fff;
    }
}
