/**
 * Audio Player Pro - Estilos CSS
 * Versão: 1.0.0
 */

/* Reset e variáveis CSS */
:root {
    --app-primary-color: #2563eb;
    --app-secondary-color: #64748b;
    --app-accent-color: #f59e0b;
    --app-background-color: #ffffff;
    --app-surface-color: #f8fafc;
    --app-border-color: #e2e8f0;
    --app-text-primary: #1e293b;
    --app-text-secondary: #64748b;
    --app-text-muted: #94a3b8;
    --app-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --app-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --app-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --app-radius-sm: 0.375rem;
    --app-radius-md: 0.5rem;
    --app-radius-lg: 0.75rem;
    --app-transition: all 0.2s ease-in-out;
}

/* Tema escuro */
.app-theme-dark {
    --app-background-color: #0f172a;
    --app-surface-color: #1e293b;
    --app-border-color: #334155;
    --app-text-primary: #f1f5f9;
    --app-text-secondary: #cbd5e1;
    --app-text-muted: #64748b;
}

/* Container principal do player */
.app-player-container {
    background: var(--app-background-color);
    border: 1px solid var(--app-border-color);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-md);
    padding: 1.5rem;
    margin: 1rem 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: var(--app-transition);
    max-width: 100%;
    overflow: hidden;
}

.app-player-container:hover {
    box-shadow: var(--app-shadow-lg);
}

/* Header do player */
.app-player-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

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

.app-track-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--app-text-primary);
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
    word-wrap: break-word;
}

.app-track-artist {
    font-size: 1rem;
    color: var(--app-text-secondary);
    margin: 0 0 0.25rem 0;
    font-weight: 500;
}

.app-track-album {
    font-size: 0.875rem;
    color: var(--app-text-muted);
    margin: 0;
    font-style: italic;
}

/* Seção de download */
.app-download-section {
    flex-shrink: 0;
}

.app-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--app-primary-color);
    color: white;
    border: none;
    border-radius: var(--app-radius-md);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--app-transition);
    text-decoration: none;
}

.app-download-btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

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

.app-download-icon {
    font-size: 1rem;
}

/* Container do waveform */
.app-waveform-container {
    position: relative;
    margin: 1.5rem 0;
    height: 100px;
    background: var(--app-surface-color);
    border-radius: var(--app-radius-md);
    overflow: hidden;
    cursor: pointer;
}

.app-waveform {
    width: 100%;
    height: 100%;
    display: block;
}

.app-waveform-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--app-primary-color), var(--app-accent-color));
    opacity: 0.3;
    width: 0%;
    transition: width 0.1s ease-out;
    pointer-events: none;
}

/* Controles do player */
.app-player-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.app-control-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.app-btn {
    background: var(--app-surface-color);
    border: 1px solid var(--app-border-color);
    border-radius: 50%;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--app-transition);
    color: var(--app-text-primary);
    font-size: 1.25rem;
}

.app-btn:hover {
    background: var(--app-primary-color);
    color: white;
    transform: scale(1.05);
}

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

.app-btn-play-pause {
    width: 4rem;
    height: 4rem;
    background: var(--app-primary-color);
    color: white;
    font-size: 1.5rem;
}

.app-btn-play-pause:hover {
    background: #1d4ed8;
}

/* Container de progresso */
.app-progress-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.app-time {
    font-size: 0.875rem;
    color: var(--app-text-secondary);
    font-weight: 500;
    min-width: 3rem;
    text-align: center;
}

.app-progress-bar {
    flex: 1;
    height: 2.5rem;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.app-progress-track {
    position: relative;
    width: 100%;
    height: 6px;
    background: var(--app-border-color);
    border-radius: 3px;
    overflow: hidden;
}

.app-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--app-primary-color), var(--app-accent-color));
    width: 0%;
    transition: width 0.1s ease-out;
    border-radius: 3px;
}

.app-progress-handle {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 16px;
    height: 16px;
    background: var(--app-primary-color);
    border: 2px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: grab;
    opacity: 0;
    transition: var(--app-transition);
    box-shadow: var(--app-shadow-sm);
}

.app-progress-track:hover .app-progress-handle,
.app-progress-track.dragging .app-progress-handle {
    opacity: 1;
}

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

/* Container de volume */
.app-volume-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-btn-volume {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1rem;
}

.app-volume-slider {
    width: 80px;
    height: 2.5rem;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.app-volume-track {
    position: relative;
    width: 100%;
    height: 4px;
    background: var(--app-border-color);
    border-radius: 2px;
}

.app-volume-fill {
    height: 100%;
    background: var(--app-primary-color);
    width: 100%;
    border-radius: 2px;
    transition: width 0.1s ease-out;
}

.app-volume-handle {
    position: absolute;
    top: 50%;
    right: 0;
    width: 12px;
    height: 12px;
    background: var(--app-primary-color);
    border: 2px solid white;
    border-radius: 50%;
    transform: translate(50%, -50%);
    cursor: grab;
    box-shadow: var(--app-shadow-sm);
}

.app-volume-handle:active {
    cursor: grabbing;
    transform: translate(50%, -50%) scale(1.2);
}

/* Elemento de áudio oculto */
.app-audio-element {
    display: none;
}

/* Loading */
.app-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: var(--app-text-secondary);
    font-size: 0.875rem;
}

.app-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--app-border-color);
    border-top: 2px solid var(--app-primary-color);
    border-radius: 50%;
    animation: app-spin 1s linear infinite;
}

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

/* Mensagens de erro */
.app-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 1rem;
    border-radius: var(--app-radius-md);
    text-align: center;
    font-size: 0.875rem;
}

/* Estilos da playlist */
.app-playlist-container {
    background: var(--app-background-color);
    border: 1px solid var(--app-border-color);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-md);
    margin: 1rem 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
}

.app-playlist-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--app-border-color);
    background: var(--app-surface-color);
}

.app-playlist-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--app-text-primary);
    margin: 0 0 0.5rem 0;
}

.app-playlist-info {
    color: var(--app-text-secondary);
    font-size: 0.875rem;
}

.app-playlist-tracks {
    max-height: 400px;
    overflow-y: auto;
}

.app-playlist-track {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--app-border-color);
    cursor: pointer;
    transition: var(--app-transition);
}

.app-playlist-track:hover {
    background: var(--app-surface-color);
}

.app-playlist-track.active {
    background: var(--app-primary-color);
    color: white;
}

.app-playlist-track.active .app-track-title,
.app-playlist-track.active .app-track-artist {
    color: white;
}

.app-track-number {
    font-size: 0.875rem;
    color: var(--app-text-muted);
    font-weight: 500;
    min-width: 2rem;
    text-align: center;
}

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

.app-playlist-track .app-track-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--app-text-primary);
    margin: 0 0 0.25rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-playlist-track .app-track-artist {
    font-size: 0.875rem;
    color: var(--app-text-secondary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-track-duration {
    font-size: 0.875rem;
    color: var(--app-text-muted);
    font-weight: 500;
}

.app-track-download {
    background: none;
    border: none;
    color: var(--app-text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--app-radius-sm);
    transition: var(--app-transition);
}

.app-track-download:hover {
    background: var(--app-surface-color);
    color: var(--app-primary-color);
}

.app-playlist-player {
    padding: 1.5rem;
    border-top: 1px solid var(--app-border-color);
}

/* Responsividade */
@media (max-width: 768px) {
    .app-player-container,
    .app-playlist-container {
        margin: 0.5rem 0;
        border-radius: var(--app-radius-md);
    }
    
    .app-player-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .app-download-section {
        align-self: flex-start;
    }
    
    .app-progress-container {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .app-progress-bar {
        order: -1;
    }
    
    .app-time {
        min-width: auto;
    }
    
    .app-volume-container {
        justify-content: center;
    }
    
    .app-volume-slider {
        width: 100px;
    }
    
    .app-control-buttons {
        gap: 0.75rem;
    }
    
    .app-btn {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1rem;
    }
    
    .app-btn-play-pause {
        width: 3.5rem;
        height: 3.5rem;
        font-size: 1.25rem;
    }
    
    .app-playlist-track {
        padding: 1rem;
    }
    
    .app-track-number {
        min-width: 1.5rem;
    }
}

@media (max-width: 480px) {
    .app-player-container,
    .app-playlist-container {
        padding: 1rem;
        margin: 0.25rem 0;
    }
    
    .app-track-title {
        font-size: 1.125rem;
    }
    
    .app-waveform-container {
        height: 80px;
        margin: 1rem 0;
    }
    
    .app-control-buttons {
        gap: 0.5rem;
    }
    
    .app-btn {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 0.875rem;
    }
    
    .app-btn-play-pause {
        width: 3rem;
        height: 3rem;
        font-size: 1.125rem;
    }
    
    .app-volume-slider {
        width: 80px;
    }
    
    .app-playlist-tracks {
        max-height: 300px;
    }
    
    .app-playlist-track {
        padding: 0.75rem;
        gap: 0.75rem;
    }
}

/* Animações */
@keyframes app-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.app-playing .app-btn-play-pause {
    animation: app-pulse 2s ease-in-out infinite;
}

/* Estados de foco para acessibilidade */
.app-btn:focus,
.app-download-btn:focus,
.app-track-download:focus {
    outline: 2px solid var(--app-primary-color);
    outline-offset: 2px;
}

.app-progress-track:focus-within,
.app-volume-slider:focus-within {
    outline: 2px solid var(--app-primary-color);
    outline-offset: 2px;
    border-radius: var(--app-radius-sm);
}

/* Tema minimalista */
.app-theme-minimal {
    --app-background-color: #ffffff;
    --app-surface-color: #ffffff;
    --app-border-color: #f1f5f9;
    --app-shadow-md: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.app-theme-minimal .app-player-container {
    border: none;
    box-shadow: none;
    background: transparent;
}

.app-theme-minimal .app-waveform-container {
    background: #f8fafc;
}

/* Tema colorido */
.app-theme-colorful {
    --app-primary-color: #8b5cf6;
    --app-accent-color: #06b6d4;
    --app-background-color: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.app-theme-colorful .app-player-container {
    background: var(--app-background-color);
    color: white;
}

.app-theme-colorful .app-track-title,
.app-theme-colorful .app-track-artist,
.app-theme-colorful .app-track-album {
    color: white;
}

