/* 🔥 ЧИСТЫЙ CSS для плейлиста — оптимизированная версия */
/* Объединены дубликаты, убраны лишние !important, исправлены комментарии */

.playlist-page { 
    max-width: 900px; 
    margin: 0 auto; 
    padding: 2rem 1rem; 
}

.section-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 2rem; 
}

.section-title { 
    margin: 0; 
    font-size: 1rem; 
    font-weight: 700; 
}

.section-title.playlist-title {
    pointer-events: auto;
    cursor: pointer;
    user-select: none;
    padding: 12px 16px;
    transition: all 0.2s ease;
    border-radius: 8px;
}

.section-title.playlist-title:hover {
    background: rgba(81, 207, 102, 0.1);
    color: #51cf66;
}

.section-title.playlist-title:focus-within {
    background: #f8f9ff;
    outline: 2px solid #51cf66;
}

.section-title input {
    font-size: 1.4rem;
    font-weight: 600;
    min-height: 40px;
    width: 100%;
    box-sizing: border-box;
}

.posts-list { 
    display: flex; 
    flex-direction: column; 
    gap: 0.2rem;
    position: relative;
}

.track-container { 
    background: white; 
    border-radius: 12px;
    padding: 0.4rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    position: relative; 
    border: 1px solid #eee;
    transition: all 0.3s; 
    overflow: visible;
}

.track-container:hover { 
    box-shadow: 0 16px 48px rgba(0,0,0,0.15); 
    transform: translateY(-2px) translateZ(0);
    z-index: 0;
}

.track-left { 
    display: flex; 
    align-items: center; 
    gap: 1rem; 
}

.play-triangle {
    width: 56px; 
    height: 56px; 
    border-radius: 14px; 
    background: linear-gradient(135deg, #51cf66, #40c057);
    border: none; 
    cursor: pointer; 
    position: relative; 
    flex-shrink: 0; 
    transition: all 0.3s;
    box-shadow: 0 4px 16px rgba(81,207,102,0.4);
}

.play-triangle:hover { 
    transform: scale(1.05); 
    box-shadow: 0 8px 24px rgba(81,207,102,0.5); 
}

.play-triangle.playing { 
    background: linear-gradient(135deg, #ff9f43, #ff6b6b); 
}

.play-triangle .triangle {
    position: absolute; 
    top: 50%; 
    left: 55%; 
    width: 0; 
    height: 0;
    border-left: 16px solid white; 
    border-top: 12px solid transparent; 
    border-bottom: 12px solid transparent;
    margin-left: -8px; 
    margin-top: -12px; 
    transition: all 0.3s;
}

.play-triangle.playing .triangle {
    border-left: none; 
    width: 12px; 
    height: 16px; 
    background: white; 
    clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%);
}

.hidden-audio { display: none; }

.audio-name { 
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 14px;
    font-weight: 600; 
    color: #333; 
    flex: 1; 
}

.track-progress-bar { 
    height: 6px; 
    background: #f0f2ff; 
    border-radius: 3px; 
    cursor: pointer; 
    position: relative; 
    margin: 0.5rem 0; 
}

.progress-track { 
    height: 100%; 
    background: linear-gradient(90deg, #51cf66, #667eea); 
    border-radius: 3px; 
    width: 0%; 
    transition: width 0.1s ease; 
}

.progress-head {
    position: absolute; 
    top: -3px; 
    width: 12px; 
    height: 12px; 
    background: white; 
    border: 2px solid #51cf66; 
    border-radius: 50%; 
    box-shadow: 0 2px 8px rgba(81,207,102,0.4); 
    transition: left 0.1s ease; 
    cursor: pointer;
}

.track-menu-toggle {
    position: absolute; 
    top: 16px; 
    right: 16px; 
    background: rgba(255,255,255,0.9); 
    border: 1px solid #eee; 
    border-radius: 20px; 
    width: 40px; 
    height: 40px; 
    font-size: 1.4rem; 
    font-weight: 300; 
    cursor: pointer; 
    transition: all 0.3s; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    z-index: 10;
}

.track-menu-toggle:hover { 
    background: #667eea; 
    color: white; 
    transform: scale(1.1); 
}

.track-menu {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    left: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.3);
    border: 1px solid #eee;
    padding: 12px 16px;
    z-index: 2147483647;
    margin: 0 16px;
    max-height: 60vh;
    overflow-y: auto;
}

.menu-item {
    display: block; 
    width: 100%; 
    padding: 14px 18px; 
    background: white;
    text-align: left; 
    cursor: pointer; 
    font-size: 0.95rem; 
    transition: all 0.2s; 
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

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

.menu-item:hover { 
    background: #f8f9ff; 
}

.delete-btn { 
    color: #ff6b6b; 
}

.delete-btn:hover { 
    background: #fee; 
}

.edit-btn { 
    color: #667eea; 
}

.edit-btn:hover { 
    background: #f0f2ff; 
}

.track-time-static {
    position: absolute; 
    bottom: 12px; 
    right: 16px; 
    font-size: 0.85rem; 
    color: #666; 
    font-weight: 500;
}

.empty-posts { 
    text-align: center; 
    padding: 4rem 2rem; 
    color: #666; 
}

.empty-icon { 
    font-size: 4rem; 
    margin-bottom: 1rem; 
    opacity: 0.7; 
}

.full-width { 
    width: 100%; 
    justify-content: center; 
}

.playlist-controls {
    background: linear-gradient(135deg, #f8f9ff, #e8ecff);
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #e1e5ff;
    box-shadow: 0 8px 32px rgba(102,126,234,0.15);
}

.control-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.control-group:last-child { 
    margin-bottom: 0; 
}

.control-btn {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 2px solid #e1e5ff;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: #667eea;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.control-btn:hover { 
    background: #667eea; 
    color: white; 
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(102,126,234,0.4);
}

.control-btn.active {
    background: linear-gradient(135deg, #51cf66, #40c057);
    color: white;
    border-color: #51cf66;
}

.playlist-slash {
    color: #a0a0a0;
    font-weight: 400;
}

.playlist-name {
    color: #51cf66;
    font-size: 13px;
    background: rgba(81, 207, 102, 0.1);
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 500;
}

/* 🔥 СУПЕР СКОРОСТЬ ВОСПРОИЗВЕДЕНИЯ */
.speed-control {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 6px;
    background: linear-gradient(145deg, #51cf66, #40c057);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(100, 150, 255, 0.2);
    box-shadow: 
        0 8px 32px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.1);
    position: relative;
    overflow: hidden;
}

.speed-control::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(100,150,255,0.2), transparent);
    transition: left 0.6s;
}

.speed-control:hover::before {
    left: 100%;
}

.speed-btn {
    position: relative;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    font-family: -apple-system, 'SF Pro', system-ui, sans-serif;
    border: none;
    background: linear-gradient(145deg, rgba(30,30,45,0.9), rgba(50,50,70,0.7));
    color: #e0e0ff;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 48px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    box-shadow: 
        0 4px 16px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(255,255,255,0.1);
    overflow: hidden;
}

.speed-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
    z-index: 1;
}

.speed-btn:hover::before {
    left: 100%;
}

.speed-btn:hover {
    transform: translateY(-2px) scale(1.05);
    background: linear-gradient(145deg, rgba(60,60,90,0.95), rgba(80,80,110,0.85));
    box-shadow: 
        0 12px 32px rgba(59,130,246,0.3),
        0 0 0 1px rgba(100,150,255,0.3),
        inset 0 1px 0 rgba(255,255,255,0.2);
    color: #ffffff;
}

.speed-btn:active {
    transform: translateY(0) scale(0.98);
    transition: all 0.1s;
}

.speed-btn.active {
    background: linear-gradient(145deg, #ff9f43, #ff6b6b);
    color: white;
    box-shadow: 
        0 0 0 3px rgba(79,122,255,0.3),
        0 8px 32px rgba(79,122,255,0.4),
        0 0 20px rgba(79,122,255,0.2),
        inset 0 1px 0 rgba(255,255,255,0.3);
    animation: pulse-glow 2s infinite;
    position: relative;
    z-index: 2;
}

.speed-btn.active::after {
    content: '♪';
    position: absolute;
    font-size: 10px;
    top: 2px;
    right: 4px;
    animation: bounce 1.5s infinite;
}

@keyframes pulse-glow {
    0%, 100% { 
        box-shadow: 
            0 0 0 3px rgba(79,122,255,0.3),
            0 8px 32px rgba(79,122,255,0.4),
            0 0 20px rgba(79,122,255,0.2);
    }
    50% { 
        box-shadow: 
            0 0 0 6px rgba(79,122,255,0.2),
            0 12px 40px rgba(79,122,255,0.5),
            0 0 30px rgba(79,122,255,0.3);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-3px); }
    60% { transform: translateY(-1px); }
}

/* МЕДИА ЗАПРОСЫ — ОБЪЕДИНЕНЫ */
@media (max-width: 768px) {
    .playlist-controls { 
        padding: 0.8rem; 
    }
    
    .control-btn { 
        padding: 0.7rem 0.5rem; 
        font-size: 0.85rem; 
    }
    
    .track-menu-toggle { 
        top: 12px; 
        right: 12px; 
        width: 36px; 
        height: 36px; 
        font-size: 1.2rem; 
    }
    
    .track-time-static { 
        bottom: 8px; 
        right: 12px; 
        font-size: 0.8rem; 
    }
    
    .speed-control {
        gap: 4px;
        padding: 4px;
    }
    
    .speed-btn {
        padding: 8px 12px;
        font-size: 12px;
        min-width: 42px;
        height: 36px;
    }
}

/* ТРЕКИ В ПОСТАХ */
.post-card .track-container.post-track {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
    padding: 0.4rem;
}

.post-card .post-track .track-left {
    flex: 1;
}

.post-card .post-track .track-progress-bar.post-progress {
    flex: 2;
    margin: 0 1rem 0 0;
    order: 2;
}

.post-card .post-track .track-menu-toggle.post-menu-toggle {
    position: static;
    margin-left: auto;
    order: 3;
}

.post-card .post-track .track-time-static {
    position: static;
    margin-left: 1rem;
    order: 4;
    white-space: nowrap;
}

.post-card .post-track .track-menu.post-track-menu {
    position: fixed;
    bottom: 20px;
    right: 20px;
    left: 20px;
    min-width: 140px;
}

@media (max-width: 768px) {
    .post-card .post-track {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1rem;
    }
    
    .post-card .post-track .track-progress-bar {
        order: 3;
        margin: 0.5rem 0;
    }
}

@media (prefers-color-scheme: dark) {
    .speed-control {
        background: linear-gradient(145deg, rgba(15,15,25,0.95), rgba(35,35,55,0.85));
    }
}

#move-modal {
    animation: modalSlideIn 0.3s ease-out;
}

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

.playlist-move-item:hover {
    border-color: #4f7aff;
    background: rgba(79,122,255,0.2);
    transform: translateX(5px);
}

.playlist-move-item:active {
    transform: scale(0.98);
}


/* 🔥 ПРОГРАММНЫЙ ВИЗУАЛИЗАТОР плеера 

/* ГЛАВНЫЙ КОНТЕЙНЕР — стеклянный эффект + пульсация */
.now-playing-visualizer {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(145deg, rgba(255,255,255,0.25), rgba(248,250,255,0.9));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 20px;
    box-shadow: 
        0 12px 40px rgba(102,126,234,0.2),
        inset 0 1px 0 rgba(255,255,255,0.6);
    width: 100%;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.now-playing-visualizer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.6s;
}

.now-playing-visualizer.playing::before {
    left: 100%;
}

.now-playing-visualizer:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 
        0 20px 60px rgba(102,126,234,0.3),
        inset 0 1px 0 rgba(255,255,255,0.8);
}

/* ФОН С ЧАСТИЦАМИ */
.visualizer-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at 20% 80%, rgba(81,207,102,0.15) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(102,126,234,0.15) 0%, transparent 50%);
    z-index: 0;
}

.particles-container {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 1; /* ← КЛЮЧЕВОЕ! */
}

.particle {
    position: absolute;
    width: 6px; height: 6px; /* чуть больше */
    background: radial-gradient(circle, rgba(81,207,102,0.9), transparent);
    border-radius: 50%;
    animation: particleFloat 5s infinite ease-in-out;
}

.particle:nth-child(1) { top: 20%; left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { top: 60%; left: 80%; animation: particleFloat2 4s infinite ease-in-out reverse; animation-delay: 1s; background: radial-gradient(circle, rgba(102,126,234,0.9), transparent); }
.particle:nth-child(3) { top: 80%; left: 20%; animation: particleGlow 6s infinite ease-in-out; animation-delay: 2s; }
.particle:nth-child(4) { top: 30%; left: 70%; animation-delay: 2.5s; background: radial-gradient(circle, rgba(81,207,102,0.7), transparent); }
.particle:nth-child(5) { top: 10%; left: 50%; animation-delay: 3.5s; }

/* 🔥 KEYFRAMES */
@keyframes particleFloat { 0%,100%{transform:translateY(0px) scale(1);opacity:.6}50%{transform:translateY(-20px) scale(1.4);opacity:1} }
@keyframes particleFloat2 { 0%,100%{transform:translateX(0px) scale(1);opacity:.6}50%{transform:translateX(12px) scale(1.3);opacity:.9} }
@keyframes particleGlow { 0%,100%{box-shadow:0 0 6px rgba(81,207,102,.5);transform:scale(1)}50%{box-shadow:0 0 20px rgba(81,207,102,1);transform:scale(1.5)} }

/* 🔥 ПУЛЬСИРУЮЩАЯ НОТА — заменить весь блок треугольника */
.note-icon {
    position: relative;
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    z-index: 2;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Неоновое свечение */
.note-glow {
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: radial-gradient(circle, #51cf66, #667eea, transparent);
    border-radius: 50%;
    filter: blur(10px);
    opacity: 0;
    transition: all 0.4s ease;
}

/* Основная нота */
.note-core {
    position: relative;
    z-index: 2;
    font-size: 32px;
    color: #51cf66;
    text-shadow: 
        0 0 8px rgba(81, 207, 102, 0.8),
        0 0 16px rgba(81, 207, 102, 0.4);
    font-weight: bold;
    transform: scale(1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ПУЛЬСАЦИЯ при воспроизведении */
.now-playing-visualizer.playing .note-core {
    animation: notePulse 1.4s infinite ease-in-out;
    transform: scale(1.1);
}

.now-playing-visualizer.playing .note-glow {
    opacity: 1;
    animation: noteGlow 2s infinite ease-in-out;
}

/* АНИМАЦИИ */
@keyframes notePulse {
    0%, 100% { 
        transform: scale(1) rotate(0deg); 
        text-shadow: 
            0 0 8px rgba(81,207,102,0.8),
            0 0 16px rgba(81,207,102,0.4);
    }
    33% { 
        transform: scale(1.15) rotate(5deg); 
        text-shadow: 
            0 0 12px rgba(81,207,102,1),
            0 0 24px rgba(81,207,102,0.6);
    }
    66% { 
        transform: scale(1.05) rotate(-3deg); 
        text-shadow: 
            0 0 10px rgba(102,126,234,0.8),
            0 0 20px rgba(102,126,234,0.4);
    }
}

@keyframes noteGlow {
    0%, 100% { 
        opacity: 0.6; 
        transform: scale(1); 
    }
    50% { 
        opacity: 1; 
        transform: scale(1.3); 
    }
}

@keyframes trianglePulse {
    0%, 100% { transform: perspective(500px) rotateX(10deg) scale(1); }
    50% { transform: perspective(500px) rotateX(10deg) scale(1.1); }
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}


/* ИНФОРМАЦИЯ О ТРЕКЕ */

/* 🔥 ВРЕМЯ СПРАВА ВНИЗУ — заменить существующие стили */
.current-track-info {
    flex: 1;
    min-width: 0;
    z-index: 2;
    position: relative;
    display: flex;
    flex-direction: column; /* вертикальное расположение */
    justify-content: space-between; /* растягиваем по высоте */
    height: 100%; /* вся высота контейнера */
}


/* НАЗВАНИЕ ТРЕКА — сверху */
.track-title-container {
    flex: 1; /* занимает основное место */
    display: block;
    position: relative;
    max-width: calc(100% - 80px);
    overflow: hidden;
    margin-bottom: 4px;
}


/* ОСНОВНОЙ ТЕКСТ */
.track-title {
    font-weight: 700;
    font-size: 1rem;
    color: #2d3748;
    white-space: nowrap;
    position: absolute;
    top: 0;
    left: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    
}

/* АНИМАЦИЯ БЕГУЩЕЙ СТРОКИ */
.track-title.marquee {
    animation: marquee 10s linear infinite;
}

.track-title.marquee::before {
    content: attr(data-full-text);
    position: absolute;
    top: 0;
    left: 100%;
    white-space: nowrap;
    padding-left: 40px; /* зазор между копиями */
}

/* Короткие тексты НЕ анимируются */
.track-title:not(.marquee) {
    position: static; /* возвращаем в поток */
}

/* ПАУЗА при hover */
.now-playing-visualizer:hover .track-title.marquee {
    animation-play-state: paused;
}

@keyframes marquee {
    0% { transform: translateX(0%); }
    100% { transform: translateX(-100%); }
}

.track-title.marquee {
    animation: marquee 20s linear infinite;
}

.track-title.marquee::before {
    content: attr(data-full-text);
    position: absolute;
    top: 0;
    left: 100%;
    white-space: nowrap;
    padding-left: 30px;
}

@keyframes marquee {
    0% { transform: translateX(0%); }
    100% { transform: translateX(-100%); }
}

.now-playing-visualizer:hover .track-title.marquee {
    animation-play-state: paused;
}

/* ВРЕМЯ — ПРАВЫЙ НИЖНИЙ УГЛЮ */
.track-time-container {
    position: absolute !important;
    bottom: 0px !important;
    right: 0px !important;
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.8);
    padding: 2px 2px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

/*
.current-time, .total-time {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    min-width: 36px;
    text-align: center;
}
*/

.current-time, .total-time {
    font-size: 0.8rem;
    font-weight: 600;
    color: #2d3748;
    min-width: 32px;
    text-align: center;
}

.time-separator {
    font-size: 0.85rem;
    font-weight: 700;
    color: #667eea;
}

.mini-progress {
    flex: 1;
    height: 3px;
    background: rgba(102,126,234,0.2);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.mini-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #51cf66, #667eea);
    width: 0%;
    transition: width 0.3s ease;
}

/* РЕСПОНСИВ */
@media (max-width: 768px) {
    .now-playing-visualizer {
        padding: 0.8rem 1.2rem;
        gap: 0.8rem;
    }
    
    .visualizer-triangle { width: 42px; height: 42px; }
    .wave-visualizer { height: 36px; min-width: 32px; }
    .track-title { font-size: 0.95rem; }
    .track-time-container { gap: 6px; }
}

/* 🔥 ПАУЗА ПУЛЬСАЦИИ НОТЫ при паузе/стоп */
.now-playing-visualizer:not(.playing) .note-core,
.now-playing-visualizer.paused .note-core,
.now-playing-visualizer:not(.playing) .note-glow,
.now-playing-visualizer.paused .note-glow {
    animation-play-state: paused !important;
}

/* Дополнительно: волны тоже останавливаем */
.now-playing-visualizer:not(.playing) .wave-bar,
.now-playing-visualizer.paused .wave-bar {
    animation-play-state: paused !important;
}
