/**
 * Enhanced WowPlatter Audio Player Styles
 * 
 * Features:
 * - Modern, responsive design
 * - Queue system with visual feedback
 * - Track listing panels
 * - Smooth animations and transitions
 * - Mobile-friendly layout
 *
 * @since 1.0.0
 */

/* Main Audio Player Container */
.wowplatter-audio-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 80px; /* Leave space for chatbot */
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: white;
    z-index: 9998;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    border-top: 1px solid #444;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    transition: all 0.3s ease;
}

/* Main Player Bar */
.player-main-bar {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    height: 60px;
    box-sizing: border-box;
    gap: 20px;
    background: inherit;
}

/* Current Track Section */
.player-current-track {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.track-thumbnail {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.track-thumbnail:hover {
    transform: scale(1.05);
}

.track-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.track-icon {
    font-size: 18px;
    opacity: 0.8;
}

.track-info {
    flex: 1;
    min-width: 0;
}

.track-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
    line-height: 1.2;
}

.track-artist {
    font-size: 12px;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.9;
}

/* Player Controls */
.player-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    position: relative;
    background-size: 20px 20px;
    background-repeat: no-repeat;
    background-position: center;
}

/* Control Button Icons */
.control-btn.prev-btn {
    background-image: url('../images/left.png');
}

.control-btn.next-btn {
    background-image: url('../images/right.png');
}

.control-btn.tracks-btn {
    background-image: url('../images/list.png');
}

.control-btn.queue-btn {
    background-image: url('../images/queue.png');
}

.control-btn.expand-btn {
    background-image: url('../images/up.png');
}

.control-btn.collapse-btn {
    background-image: url('../images/down.png');
}

/* Additional button styles */
.add-to-queue-btn, .remove-from-queue-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.add-to-queue-btn:hover {
    background: #4caf50;
    color: white;
}

.remove-from-queue-btn:hover {
    background: #f44336;
    color: white;
}

.clear-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: #ff5252;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.control-btn:active {
    transform: scale(0.95);
}

.play-btn {
    background: linear-gradient(135deg, #ff6b35 0%, #ff5722 100%);
    width: 44px;
    height: 44px;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
    background-size: 24px 24px;
}

.play-btn.playing {
    background-image: url('../images/pause.png');
}

.play-btn.paused {
    background-image: url('../images/play.png');
}

.play-btn:hover {
    background: linear-gradient(135deg, #ff5722 0%, #e64a19 100%);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

/* Progress Section */
.player-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    max-width: 300px;
}

.time-display {
    font-size: 12px;
    color: #ccc;
    min-width: 35px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.progress-bar {
    flex: 1;
    height: 4px;
    background: #444;
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    transition: height 0.2s ease;
}

.progress-bar:hover {
    height: 6px;
}

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

.progress-fill::after {
    content: '';
    position: absolute;
    right: -2px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.progress-bar:hover .progress-fill::after {
    opacity: 1;
}

/* Right Controls */
.player-right-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.track-count, .queue-count {
    background: linear-gradient(135deg, #ff6b35 0%, #ff5722 100%);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 4px;
    min-width: 16px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(255, 107, 53, 0.3);
}

/* Panel Styles */
.tracks-panel, .queue-panel {
    position: absolute;
    bottom: 100%;
    right: 20px;
    width: 400px;
    max-height: 500px;
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    backdrop-filter: blur(10px);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #444;
    background: linear-gradient(135deg, #333 0%, #3a3a3a 100%);
}

.panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

.queue-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.clear-btn {
    background: none;
    border: 1px solid #666;
    color: #ccc;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: #444;
    border-color: #888;
    color: #fff;
}

.close-btn {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 20px;
    padding: 4px;
    line-height: 1;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.close-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* Track Lists */
.tracks-list, .queue-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px 0;
}

.tracks-list::-webkit-scrollbar, .queue-list::-webkit-scrollbar {
    width: 6px;
}

.tracks-list::-webkit-scrollbar-track, .queue-list::-webkit-scrollbar-track {
    background: #333;
}

.tracks-list::-webkit-scrollbar-thumb, .queue-list::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 3px;
}

.tracks-list::-webkit-scrollbar-thumb:hover, .queue-list::-webkit-scrollbar-thumb:hover {
    background: #888;
}

/* Track Items */
.track-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid #333;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.track-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(2px);
}

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

.track-item.current-track {
    background: rgba(255, 107, 53, 0.1);
    border-left: 3px solid #ff6b35;
}

.track-item.current-track::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #ff6b35 0%, #ff5722 100%);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.track-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.track-item-thumb {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    overflow: hidden;
    background: #444;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.track-item:hover .track-item-thumb {
    transform: scale(1.1);
}

.track-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.track-type-icon {
    font-size: 14px;
    opacity: 0.8;
}

.track-item-details {
    flex: 1;
    min-width: 0;
}

.track-item-title {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
    line-height: 1.2;
}

.track-item-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #999;
}

.track-type {
    text-transform: capitalize;
    font-weight: 500;
}

.track-duration {
    font-variant-numeric: tabular-nums;
}

/* Action Buttons */
.add-to-queue-btn, .remove-from-queue-btn {
    background: none;
    border: 1px solid #666;
    color: #ccc;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.add-to-queue-btn:hover {
    background: linear-gradient(135deg, #ff6b35 0%, #ff5722 100%);
    border-color: #ff6b35;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.remove-from-queue-btn:hover {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border-color: #dc3545;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

/* Track Item Actions Container */
.track-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Release Link Button */
.release-link-btn {
    background: none;
    border: 1px solid #666;
    color: #ccc;
    text-decoration: none;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 12px;
}

.release-link-btn:hover {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border-color: #007bff;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
    text-decoration: none;
}

/* Empty States */
.queue-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.queue-empty p {
    margin: 0 0 8px 0;
    font-size: 14px;
}

.queue-hint {
    font-size: 12px;
    opacity: 0.8;
    line-height: 1.4;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .tracks-panel, .queue-panel {
        width: 350px;
    }
    
    .player-progress {
        max-width: 250px;
    }
}

@media (max-width: 768px) {
    .wowplatter-audio-player {
        right: 70px;
    }
    
    .player-main-bar {
        padding: 8px 16px;
        gap: 12px;
    }
    
    .player-progress {
        max-width: 200px;
    }
    
    .tracks-panel, .queue-panel {
        width: 320px;
        right: 16px;
    }
    
    .track-title {
        font-size: 13px;
    }
    
    .track-artist {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .wowplatter-audio-player {
        right: 60px;
    }
    
    .player-main-bar {
        padding: 6px 12px;
        gap: 8px;
    }
    
    .player-progress {
        max-width: 150px;
    }
    
    .tracks-panel, .queue-panel {
        width: 280px;
        right: 12px;
    }
    
    .track-thumbnail {
        width: 32px;
        height: 32px;
    }
    
    .track-icon {
        font-size: 14px;
    }
    
    .control-btn {
        width: 32px;
        height: 32px;
    }
    
    .play-btn {
        width: 40px;
        height: 40px;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .track-thumbnail img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Dark Mode Enhancements */
@media (prefers-color-scheme: dark) {
    .wowplatter-audio-player {
        background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    }
    
    .panel-header {
        background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    .wowplatter-audio-player,
    .control-btn,
    .track-item,
    .progress-bar,
    .track-thumbnail {
        transition: none;
    }
    
    .tracks-panel, .queue-panel {
        animation: none;
    }
    
    .track-item.current-track::before {
        animation: none;
    }
}

/* Focus States for Accessibility */
.control-btn:focus,
.add-to-queue-btn:focus,
.remove-from-queue-btn:focus,
.clear-btn:focus,
.close-btn:focus {
    outline: 2px solid #ff6b35;
    outline-offset: 2px;
}

.track-item:focus {
    outline: 2px solid #ff6b35;
    outline-offset: -2px;
}

/* Print Styles */
@media print {
    .wowplatter-audio-player {
        display: none;
    }
}