.terminal-container {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 1000;
    background: #001100;
    border: 1px solid #00ff00;
    border-radius: 0;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
    user-select: none;
    min-width: 500px;
    min-height: 250px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    resize: none;
    overflow: hidden;
}

.terminal-header {
    width: 100%;
    height: 30px;
    background: linear-gradient(to bottom, #002200, #001100);
    color: #00ff00;
    padding: 0 15px;
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #00ff00;
    position: relative;
    flex-shrink: 0;
}

.terminal-title {
    font-size: 12px;
    font-weight: bold;
    text-shadow: 0 0 5px #00ff00;
}

.terminal-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    font-size: 14px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #00ff00;
}

.control-btn:hover {
    background: #00ff00;
    color: #001100;
}

.resize-handle {
    position: absolute;
    right: 4px;
    top: 4px;
    cursor: nwse-resize;
    font-size: 14px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #00ff00;
    opacity: 0.7;
    transition: opacity 0.2s;
    z-index: 1001;
}

.resize-handle:hover {
    opacity: 1;
}

.blocks-wrapper {
    display: flex;
    gap: 8px;
    padding: 8px;
    flex: 1;
    min-height: 0;
    height: calc(100% - 60px);
    background: rgba(0, 20, 0, 0.8);
}

.terminal-block {
    background: rgba(0, 20, 0, 0.9);
    border: 1px solid #00ff00;
    color: #00ff00;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 150px;
    height: 100%;
    position: relative;
}

.terminal-block::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        45deg,
        transparent 95%,
        rgba(0, 255, 0, 0.1) 100%
    );
    pointer-events: none;
}

.player-block {
    width: 280px;
    flex-shrink: 0;
    min-width: 250px;
}

.visualizer-block {
    width: 180px;
    flex-shrink: 0;
    min-width: 150px;
}

.playlist-block {
    flex: 1;
    min-width: 200px;
}

.block-header {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    background: linear-gradient(to bottom, #002200, #001100);
    font-size: 11px;
    font-weight: bold;
    height: 25px;
    flex-shrink: 0;
    min-height: 25px;
    border-bottom: 1px solid #00ff00;
}

.prompt {
    color: #00ff00;
    margin-right: 8px;
    font-weight: bold;
}

.block-content {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    gap: 8px;
}

.now-playing {
    margin-bottom: 8px;
    font-size: 11px;
    text-align: center;
    height: 14px;
    overflow: hidden;
    flex-shrink: 0;
    min-height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.status-label {
    color: #00cc00;
    font-weight: bold;
}

.status-text {
    color: #00ff00;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#current-song {
    color: #00ff88;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.terminal-btn {
    width: auto;
    height: 28px;
    border: 1px solid #00ff00;
    background: rgba(0, 40, 0, 0.8);
    color: #00ff00;
    cursor: pointer;
    font-size: 10px;
    font-family: "Share Tech Mono", monospace;
    padding: 0 8px;
    transition: all 0.2s;
    flex-shrink: 0;
    text-transform: uppercase;
}

.terminal-btn:hover {
    background: #00ff00;
    color: #001100;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.volume {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 4px;
    flex-shrink: 0;
}

.volume-label {
    font-size: 10px;
    color: #00cc00;
    font-weight: bold;
}

.terminal-slider {
    width: 60px;
    height: 3px;
    border-radius: 0;
    background: #003300;
    outline: none;
    -webkit-appearance: none;
    flex-shrink: 0;
    border: 1px solid #00ff00;
}

.terminal-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 0;
    background: #00ff00;
    cursor: pointer;
    border: 1px solid #00cc00;
}

.progress {
    margin-top: 6px;
    flex-shrink: 0;
}

.progress-label {
    font-size: 10px;
    color: #00cc00;
    font-weight: bold;
    margin-bottom: 4px;
}

#progress-bar {
    width: 100%;
    height: 4px;
    border-radius: 0;
    background: #003300;
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 4px;
    border: 1px solid #00ff00;
}

#progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 0;
    background: #00ff00;
    cursor: pointer;
    border: 1px solid #00cc00;
}

.time {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #00cc00;
    flex-shrink: 0;
}

.visualizer-block .block-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.terminal-select {
    padding: 4px 6px;
    border: 1px solid #00ff00;
    border-radius: 0;
    background: #001100;
    color: #00ff00;
    font-size: 10px;
    font-family: "Share Tech Mono", monospace;
    outline: none;
    cursor: pointer;
    width: 100%;
    height: 25px;
    flex-shrink: 0;
}

.terminal-select option {
    background: #001100;
    color: #00ff00;
}

#visualizer-canvas {
    width: 100%;
    height: 100%;
    background: #000800;
    border: 1px solid #00ff00;
    flex: 1;
    min-height: 0;
}

.search-box {
    margin-bottom: 8px;
    flex-shrink: 0;
}

.terminal-input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #00ff00;
    border-radius: 0;
    background: #001100;
    color: #00ff00;
    font-size: 10px;
    font-family: "Share Tech Mono", monospace;
    outline: none;
    height: 25px;
    flex-shrink: 0;
}

.terminal-input::placeholder {
    color: #008800;
}

.tracks-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    border: 1px solid #00ff00;
    background: #000800;
}

.tracks-list ul {
    list-style: none;
    padding: 4px;
    margin: 0;
}

.track-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    margin: 2px 0;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
    min-height: 20px;
}

.track-item:hover {
    background: rgba(0, 255, 0, 0.1);
    border-color: #00ff00;
}

.track-item.playing {
    background: rgba(0, 255, 0, 0.2);
    border-color: #00ff00;
    color: #00ff88;
}

.track-number {
    width: 25px;
    font-size: 10px;
    color: #00cc00;
    text-align: center;
    flex-shrink: 0;
}

.track-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.tracks-list::-webkit-scrollbar {
    width: 4px;
}

.tracks-list::-webkit-scrollbar-track {
    background: #001100;
}

.tracks-list::-webkit-scrollbar-thumb {
    background: #00ff00;
}

.tracks-list::-webkit-scrollbar-thumb:hover {
    background: #00cc00;
}

.terminal-status {
    height: 20px;
    background: linear-gradient(to bottom, #001100, #000800);
    border-top: 1px solid #00ff00;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    font-size: 10px;
    color: #00cc00;
    flex-shrink: 0;
}

.status-time {
    color: #00ff00;
}

/* Анимации */
@keyframes blink {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.blink {
    animation: blink 1s infinite;
}

/* Фикс для маленьких размеров */
.terminal-container.small-mode .player-block,
.terminal-container.small-mode .visualizer-block {
    width: auto;
    flex: 1;
    min-width: 150px;
}

.terminal-container.small-mode .playlist-block {
    min-width: 180px;
}

@media (max-width: 600px) {
    .terminal-container {
        min-width: 350px;
        left: 10px;
        bottom: 10px;
    }

    .blocks-wrapper {
        flex-wrap: wrap;
        height: auto;
    }

    .player-block,
    .visualizer-block {
        width: 160px;
        height: 160px;
    }

    .playlist-block {
        min-width: 320px;
        height: 200px;
    }
}

/* Стиль для текущей играющей песни */
#music-list li.playing {
    background: linear-gradient(90deg, #020 0%, #020 100%);
    border-left: 3px solid #0f0;
}

#music-list li.playing .track-number {
    color: #0f0;
    font-weight: bold;
}

#music-list li.playing .track-name {
    color: #ecf0f1;
    font-weight: bold;
}

#music-list li.playing:hover {
    background: linear-gradient(90deg, #020 0%, #020 100%);
    cursor: pointer;
}

/* Анимация для плавного выделения */
#music-list li {
    transition: all 0.3s ease;
}

/* Стиль для плейлиста с прокруткой */
.tracks-list {
    max-height: 300px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* Скрываем стандартный скроллбар и делаем красивый */
.tracks-list::-webkit-scrollbar {
    width: 6px;
}

.tracks-list::-webkit-scrollbar-track {
    background: #020;
    border-radius: 3px;
}

.tracks-list::-webkit-scrollbar-thumb {
    background: #0f0;
    border-radius: 3px;
}

.tracks-list::-webkit-scrollbar-thumb:hover {
    background: #0f0;
}

/* Контейнер плеера */
.terminal-container {
    display: flex;
    flex-direction: column;
    height: 100%; /* Важно для растягивания */
}

/* Обертка блоков */
.blocks-wrapper {
    display: flex;
    flex: 1; /* Растягиваем на все доступное пространство */
    overflow: hidden; /* Чтобы внутренний контент не выходил за границы */
}

/* Блок плейлиста */
.terminal-block.playlist-block {
    display: flex;
    flex-direction: column;
    height: 100%; /* Занимает всю высоту родителя */
}

/* Контент блока плейлиста */
.playlist-block .block-content {
    display: flex;
    flex-direction: column;
    flex: 1; /* Растягиваем на все доступное пространство */
    overflow: hidden; /* Важно для скролла */
}

/* Контейнер списка треков */
.tracks-list {
    flex: 1; /* Занимает все оставшееся пространство */
    overflow-y: auto;
    max-height: none !important; /* Убираем фиксированную высоту */
    scroll-behavior: smooth;
}

/* Список песен */
#music-list {
    display: flex;
    flex-direction: column;
    min-height: 100%; /* Минимальная высота - вся доступная */
}

/* Элементы списка */
#music-list li {
    flex-shrink: 0; /* Не сжимаются */
}

/* Поисковая строка */
.search-box {
    flex-shrink: 0; /* Не сжимается */
    margin-bottom: 10px;
}

/* Если у вас есть другие блоки (плеер и визуализатор),
   тоже сделаем их растягивающимися */
.terminal-block.player-block,
.terminal-block.visualizer-block {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.player-block .block-content,
.visualizer-block .block-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Для визуализатора */
#visualizer-canvas {
    flex: 1;
    width: 100%;
    height: 100%;
}

/* Для прогресс бара и контролов */
.progress {
    margin-top: auto; /* Прижимаем к низу */
    flex-shrink: 0;
}

.controls {
    flex-shrink: 0;
}

/* Адаптация для маленького режима */
.small-mode .blocks-wrapper {
    flex-direction: column;
}

.small-mode .terminal-block {
    height: auto; /* В маленьком режиме высота автоматическая */
    min-height: 200px; /* Минимальная высота */
}

.small-mode .tracks-list {
    max-height: 200px; /* Ограничиваем высоту в маленьком режиме */
}
