/**
 * VentiStudio Music - Enhanced Features CSS
 * Styles pour Playlists, Queue, EQ, Mini Player
 * @version 2026.05.07
 */

/* ==========================================
   SKIP LINK (ACCESSIBILITY)
   ========================================== */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    z-index: 10000;
    padding: 0.75rem 1.5rem;
    background: var(--accent, #6366f1);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 8px 0;
    opacity: 0;
    pointer-events: none;
    transition: top 0.2s, opacity 0.2s;
}

.skip-link:focus {
    top: 0;
    opacity: 1;
    pointer-events: auto;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ==========================================
   VIEW TRANSITIONS
   ========================================== */
#viewContainer {
    transition: opacity 0.15s ease;
}

#viewContainer.view-enter {
    animation: viewFadeIn 0.2s ease forwards;
}

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

/* ==========================================
   QUEUE PANEL
   ========================================== */
.queue-panel {
    animation: slideUp 0.3s ease;
}

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

.queue-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent, #6366f1);
    color: white;
    font-size: 0.65rem;
    padding: 0.1rem 0.3rem;
    border-radius: 10px;
    font-weight: 600;
    min-width: 16px;
    text-align: center;
}

.queue-item {
    transition: background 0.2s;
}

.queue-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.queue-item.active {
    background: rgba(99, 102, 241, 0.2);
    border-left: 3px solid var(--accent, #6366f1);
}

.queue-item.dragging {
    opacity: 0.5;
}

/* ==========================================
   PLAYLISTS
   ========================================== */
.playlists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.playlist-card {
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.playlist-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.playlist-card:hover button[onclick*="deletePlaylist"] {
    display: block !important;
}

.playlist-card .delete-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    font-size: 0.8rem;
}

/* ==========================================
   EQ PANEL
   ========================================== */
.eq-panel {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.eq-panel input[type="range"] {
    writing-mode: vertical-lr;
    direction: rtl;
    width: 30px;
    height: 100px;
    background: transparent;
}

.eq-panel input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent, #6366f1);
    border-radius: 50%;
    cursor: pointer;
    margin-left: -6px;
}

.eq-panel input[type="range"]::-webkit-slider-runnable-track {
    background: var(--surface-hover, #2a2a3e);
    border-radius: 4px;
    width: 6px;
}

/* Firefox styles for vertical range */
.eq-panel input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--accent, #6366f1);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.eq-panel input[type="range"]::-moz-range-track {
    background: var(--surface-hover, #2a2a3e);
    border-radius: 4px;
    width: 6px;
}

/* ==========================================
   MINI PLAYER
   ========================================== */
.mini-player {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: opacity 0.3s, transform 0.3s;
}

.mini-player.dragging {
    opacity: 0.8;
    cursor: grabbing !important;
}

.mini-player .ctrl-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-player .ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.mini-player .ctrl-play {
    background: var(--accent, #6366f1) !important;
    color: white !important;
}

/* ==========================================
   FAVORITES
   ========================================== */
.favorite-btn {
    transition: transform 0.2s;
}

.favorite-btn:hover {
    transform: scale(1.2);
}

.favorite-btn.active {
    color: #ef4444;
}

/* ==========================================
   RECOMMENDATIONS
   ========================================== */
.recommendations-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border, #2a2a3e);
}

.recommendations-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

/* ==========================================
   TRACK CARDS
   ========================================== */
.tracks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.track-card {
    transition: transform 0.2s;
}

.track-card:hover {
    transform: translateY(-4px);
}

.track-card img {
    transition: box-shadow 0.2s;
}

.track-card:hover img {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */
#music-toast {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border, #2a2a3e);
}

/* ==========================================
   BUTTONS & CONTROLS
   ========================================== */
.ctrl-btn {
    position: relative;
}

.ctrl-btn.active {
    color: var(--accent, #6366f1);
}

.ctrl-btn.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--accent, #6366f1);
    border-radius: 50%;
}

/* ==========================================
   DARK THEME ADJUSTMENTS
   ========================================== */
[data-theme="dark"] .queue-panel,
[data-theme="dark"] .eq-panel,
[data-theme="dark"] .mini-player {
    background: rgba(26, 26, 46, 0.95);
}

[data-theme="light"] .queue-panel,
[data-theme="light"] .eq-panel,
[data-theme="light"] .mini-player {
    background: rgba(255, 255, 255, 0.95);
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
    .queue-panel {
        width: calc(100vw - 40px);
        right: 20px;
        left: 20px;
    }
    
    .mini-player {
        width: calc(100vw - 40px);
        left: 20px !important;
        right: 20px !important;
    }
    
    .playlists-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .eq-panel {
        width: calc(100vw - 40px);
        left: 20px;
        right: 20px;
    }
}

@media (max-width: 480px) {
    .playlists-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================
   ANIMATIONS
   ========================================== */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.queue-badge.pulse {
    animation: pulse 0.3s ease;
}

/* ==========================================
   SCROLLBAR STYLING
   ========================================== */
.queue-list::-webkit-scrollbar {
    width: 6px;
}

.queue-list::-webkit-scrollbar-track {
    background: transparent;
}

.queue-list::-webkit-scrollbar-thumb {
    background: var(--border, #2a2a3e);
    border-radius: 3px;
}

.queue-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary, #6b7280);
}

/* ==========================================
   ADD TO PLAYLIST DROPDOWN
   ========================================== */
.add-to-playlist-menu {
    position: absolute;
    background: var(--surface, #1a1a2e);
    border: 1px solid var(--border, #2a2a3e);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 1001;
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
}

.add-to-playlist-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.add-to-playlist-item:hover {
    background: rgba(99, 102, 241, 0.1);
}

.add-to-playlist-item:first-child {
    border-radius: 8px 8px 0 0;
}

.add-to-playlist-item:last-child {
    border-radius: 0 0 8px 8px;
}

/* ==========================================
   PLAYBACK RATE BUTTON
   ========================================== */
#playbackRateBtn span {
    font-variant-numeric: tabular-nums;
}

/* ==========================================
   KEYBOARD SHORTCUTS HELP
   ========================================== */
.shortcuts-help {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--surface, #1a1a2e);
    border: 1px solid var(--border, #2a2a3e);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    min-width: 300px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
}

.shortcuts-help h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.2rem;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border, #2a2a3e);
}

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

.shortcut-key {
    background: var(--surface-hover, #2a2a3e);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
}
