/* ========================================================================= */
/* ===         06_MUSIC.CSS - ИСПРАВЛЕННАЯ ВЕРСИЯ                      === */
/* ========================================================================= */

#music-view {
    display: flex; /* УБРАЛИ !important */
    flex-direction: column; /* УБРАЛИ !important */
    width: 100%;
    height: 100%; 
    gap: 0.8rem;
    overflow: hidden; 
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 1rem;
    padding: 1rem;
}

/* Стили для блока вкладок */
.music-tabs {
    flex-shrink: 0; 
    display: flex;
    gap: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border-color);
}

.music-tab-btn {
    background: none; border: none; color: var(--text-secondary);
    font-weight: 500; padding: 0.25rem 0.5rem; cursor: pointer;
    position: relative; transition: color 0.3s ease;
}

.music-tab-btn::after {
    content: ''; position: absolute; bottom: -14px; left: 0;
    width: 0; height: 2px; background-color: var(--accent-color);
    transition: width 0.3s ease;
}

.music-tab-btn:hover { color: var(--text-primary); }
.music-tab-btn.active { color: var(--accent-color); }
.music-tab-btn.active::after { width: 100%; }

/* Контейнер для треков, который будет скроллиться */
.music-track-list {
    flex-grow: 1; 
    overflow-y: auto; 
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding-right: 8px;
}

.music-track-list::-webkit-scrollbar { width: 8px; }
.music-track-list::-webkit-scrollbar-track { background: transparent; }
.music-track-list::-webkit-scrollbar-thumb { background-color: var(--border-color); border-radius: 4px; }
.music-track-list::-webkit-scrollbar-thumb:hover { background-color: var(--accent-color); }
.music-track-list { scrollbar-width: thin; scrollbar-color: var(--border-color) transparent; }


/* === БЛОК 3: КАРТОЧКА МУЗЫКАЛЬНОГО ТРЕКА === */
.music-track-group { display: flex; flex-direction: column; gap: 0.8rem; transition: max-height 0.5s ease, opacity 0.5s ease; }
.music-track-group.hidden { display: none; }
.music-card-v2 {
    background-color: var(--background-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px; padding: 12px; display: flex; align-items: center;
    gap: 12px; transition: all 0.3s ease; backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); position: relative;
}
.music-card-v2:hover { border-color: #ff9900; }
.music-card-v2.is-new { border-color: #00aaff; box-shadow: 0 0 15px rgba(0, 170, 255, 0.4); }
.card-cover-art { width: 50px; height: 50px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.card-main-content { flex-grow: 1; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.card-title-wrapper { position: relative; display: flex; align-items: center; margin-bottom: 8px; }
.card-title {
    font-weight: 500; font-size: 0.95rem; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; cursor: pointer;
    transition: color 0.2s ease; flex-grow: 1;
}
.card-title:hover { color: #ffc978; }
.new-badge {
    background-color: var(--accent-color); color: #000; font-size: 0.65rem;
    font-weight: 700; padding: 2px 6px; border-radius: 4px;
    margin-left: 8px; flex-shrink: 0; animation: fade-in-scale 0.5s ease-out;
}
@keyframes fade-in-scale { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: scale(1); } }
.card-controls { display: flex; align-items: center; gap: 10px; }
.play-pause-btn {
    background: #ff9900; border: none; border-radius: 50%;
    width: 36px; height: 36px; display: flex; align-items: center;
    justify-content: center; color: #000; cursor: pointer;
    transition: transform 0.2s ease; flex-shrink: 0;
}
.play-pause-btn:hover { transform: scale(1.1); }
.play-icon, .pause-icon { display: none; }
.play-pause-btn.playing .pause-icon { display: block; }
.play-pause-btn:not(.playing) .play-icon { display: block; }
.progress-container { flex-grow: 1; background-color: #444; height: 5px; border-radius: 3px; cursor: pointer; overflow: hidden; }
.progress-bar { background-color: #ff9900; width: 0; height: 100%; border-radius: 3px; transition: width 0.1s linear; }
.time-display { font-size: 0.8rem; color: #aaa; min-width: 80px; text-align: right; }
.card-actions { display: flex; gap: 10px; }
.card-actions a, .card-actions button {
    color: #ccc; text-decoration: none; transition: color 0.2s ease, transform 0.2s ease;
    background: none; border: none; padding: 0; cursor: pointer;
}
.card-actions a:hover, .card-actions button:hover { color: #ff9900; transform: scale(1.1); }
.card-info-toggle.is-open { color: #ff9900; }
.title-edit-input {
    width: 100%; background-color: rgba(0,0,0,0.5); border: 1px solid var(--accent-color);
    border-radius: 4px; color: var(--text-primary); font-weight: 500; font-size: 0.95rem;
    padding: 2px 5px; margin-bottom: 8px; outline: none; box-shadow: 0 0 8px var(--accent-glow);
}


/* === БЛОК 4: ДОПОЛНИТЕЛЬНЫЕ КОМПОНЕНТЫ КАРТОЧКИ ТРЕКА === */
.card-info-drawer {
    max-height: 0; overflow: hidden; transition: max-height 0.4s ease-out, padding 0.4s ease-out;
    background-color: rgba(16, 16, 16, 0.7); border-radius: 0 0 12px 12px; padding: 0 15px;
}
.card-info-drawer.is-open {
    max-height: 300px; overflow-y: auto; padding: 15px;
    border: 1px solid #333; border-top: none;
}
.info-drawer-content h6 {
    font-size: 0.8rem; color: #888; text-transform: uppercase;
    margin-bottom: 5px; margin-top: 10px;
}
.info-drawer-content pre, .info-drawer-content p {
    font-family: 'Manrope', sans-serif; font-size: 0.9rem; color: #ccc;
    background: none; padding: 0; white-space: pre-wrap;
    word-break: break-word; margin-bottom: 0;
}
.card-info-drawer::-webkit-scrollbar { width: 8px; }
.card-info-drawer::-webkit-scrollbar-track { background: #222; border-radius: 4px; }
.card-info-drawer::-webkit-scrollbar-thumb { background-color: #555; border-radius: 4px; border: 2px solid #222; }
.card-info-drawer::-webkit-scrollbar-thumb:hover { background-color: #ff9900; }

.music-delete-btn {
    position: absolute; top: 8px; right: 8px; z-index: 5;
    width: 28px; height: 28px; background-color: rgba(0, 0, 0, 0.5); color: white;
    border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 22px;
    line-height: 1; cursor: pointer; opacity: 0; transition: all 0.2s ease-in-out;
    transform: scale(0.8);
}
.music-card-v2:hover .music-delete-btn { opacity: 1; transform: scale(1); }
.music-delete-btn:hover { background-color: #dc3545; transform: scale(1.1) rotate(90deg); }

.music-card-v2.is-favorite {
    border-color: #ff9900;
    box-shadow: 0 0 15px rgba(255, 153, 0, 0.4);
}
.music-card-v2.is-new.is-favorite {
    border-color: #00aaff;
    box-shadow: 0 0 15px rgba(0, 170, 255, 0.5);
}
.favorite-btn .star-filled, .favorite-btn.is-active .star-outline { display: none; }
.favorite-btn .star-outline, .favorite-btn.is-active .star-filled { display: block; }
.favorite-btn.is-active { color: var(--accent-color); transform: scale(1.1); }


/* === БЛОК 5: АНИМИРОВАННЫЙ ПЛЕЙСХОЛДЕР ЗАГРУЗКИ ТРЕКА === */
.music-track-card.is-loading {
    background-color: rgba(42, 42, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 12px; padding: 12px; display: flex; align-items: center;
    gap: 15px; transition: all 0.3s ease; backdrop-filter: blur(5px);
}
.loading-visualizer {
    display: flex; align-items: flex-end; gap: 4px;
    width: 50px; height: 50px; flex-shrink: 0;
}
.visualizer-bar {
    width: 8px; background-color: var(--accent-color); border-radius: 4px;
    animation: sound-wave 1.2s infinite ease-in-out;
}
.visualizer-bar:nth-child(2) { animation-delay: -1.0s; }
.visualizer-bar:nth-child(3) { animation-delay: -0.8s; }
.visualizer-bar:nth-child(4) { animation-delay: -0.6s; }

@keyframes sound-wave {
    0%, 40%, 100% { height: 10%; }
    20% { height: 100%; }
}

.is-loading .track-info { flex-grow: 1; overflow: hidden; white-space: nowrap; }
.is-loading .track-title { font-weight: 500; font-size: 0.95rem; text-overflow: ellipsis; overflow: hidden; }
.is-loading .track-status { font-size: 0.8rem; color: var(--text-secondary); }

.music-mode-tabs {
    display: flex;
    border-bottom: 1px solid var(--panel-border-color);
    margin-bottom: 1rem;
    flex-shrink: 0;
}
.music-mode-tab-btn {
    background: none;
    border: none;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}
.music-mode-tab-btn.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}
.music-mode-pane {
    display: none; /* Скрываем все панели по умолчанию */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.music-mode-pane.active {
    display: flex; /* Показываем только активную */
}
.music-form-content {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 10px;
}