/* Базовые стили */
body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #121212 0%, #1a1a1a 50%, #2d2d2d 100%);
    color: #f8f9fa;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
    gap: 15px;
    padding: 15px;
}

/* Левая часть - дерево папок */
.sidebar {
    width: 320px;
    background: rgba(30, 30, 30, 0.95);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
}

/* Центральная часть - видеоплеер */
.player-section {
    flex: 1;
    background: rgba(20, 20, 20, 0.98);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Правая часть - список файлов */
.playlist-section {
    width: 420px;
    background: rgba(30, 30, 30, 0.95);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
}

.video-player {
    width: 100%;
    height: 100%;
    background: #000;
    border-radius: 0 0 16px 16px;
    object-fit: contain;
}

.video-item {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px;
    margin: 4px 8px;
    position: relative;
}

.video-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.video-item.active {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.3), rgba(0, 188, 212, 0.3));
    border-left: 4px solid #00bcd4;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.2);
}

.video-item.deleting {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.3), rgba(211, 47, 47, 0.3));
    border-left: 4px solid #f44336;
    animation: shake 0.5s ease-in-out;
}

.video-item.audio-problem {
    border-left: 4px solid #ff9800;
}

.video-item.large-file {
    border-right: 4px solid #2196f3;
}

.video-info {
    flex: 1;
    min-width: 0;
}

.now-playing {
    margin: 20px;
    padding: 15px 20px;
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.2), rgba(0, 188, 212, 0.2));
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    border-left: 4px solid #00bcd4;
    animation: glow 2s infinite;
}

.file-count {
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(255, 64, 129, 0.2), rgba(156, 39, 176, 0.2));
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.folder-selector {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Стили для кнопок в одной строке */
.folder-input-group {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    align-items: center;
    flex-wrap: nowrap;
}

.folder-btn {
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.main-btn {
    background: linear-gradient(135deg, #2196f3, #1976d2);
    padding: 12px 20px;
    flex: 1;
    min-width: 140px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
    animation: pulse 2s infinite;
}

.main-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.5);
    animation: none;
}

.collapse-btn {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    padding: 10px 15px;
    min-width: 100px;
}

.collapse-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.4);
}

.delete-all-btn {
    background: linear-gradient(135deg, #ff4081, #f50057);
    padding: 8px 12px;
    font-size: 11px;
    border-radius: 8px;
}

.delete-all-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 64, 129, 0.4);
}

.folder-tree {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
}

.folder-item {
    padding: 10px 12px;
    margin: 3px 8px;
    cursor: pointer;
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.folder-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.folder-item.selected {
    background: linear-gradient(135deg, #2196f3, #1976d2);
    color: white;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.folder-toggle {
    cursor: pointer;
    user-select: none;
    display: inline-block;
    width: 20px;
    text-align: center;
    transition: transform 0.3s ease;
}

.folder-item.expanded .folder-toggle {
    transform: rotate(90deg);
}

.folder-name {
    cursor: pointer;
}

.message {
    padding: 12px 15px;
    margin: 12px 0;
    border-radius: 10px;
    font-size: 12px;
    border: 1px solid;
    backdrop-filter: blur(10px);
}

.message.success {
    background: rgba(76, 175, 80, 0.2);
    color: #a5d6a7;
    border-color: #4caf50;
}

.message.error {
    background: rgba(244, 67, 54, 0.2);
    color: #ef9a9a;
    border-color: #f44336;
}

.message.warning {
    background: rgba(255, 152, 0, 0.2);
    color: #ffcc80;
    border-color: #ff9800;
}

.section-title {
    padding: 15px 20px;
    background: linear-gradient(135deg, #2196f3, #00bcd4);
    color: white;
    border-radius: 16px 16px 0 0;
    font-weight: 700;
    font-size: 16px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-container {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Стили для кнопок */
.delete-btn {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
    border: none;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s ease;
    opacity: 0;
}

.info-btn {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    border: none;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.3s ease;
    opacity: 0;
}

.video-item:hover .delete-btn,
.video-item:hover .info-btn {
    opacity: 1;
}

.delete-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

.info-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

/* Модальные окна */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: rgba(30, 30, 30, 0.95);
    border-radius: 16px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

.modal-buttons {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.modal-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 13px;
    white-space: nowrap;
}

.modal-btn.confirm {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.modal-btn.cancel {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.modal-btn:hover {
    transform: translateY(-2px);
}

/* Анимации */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes glow {
    0% { box-shadow: 0 0 20px rgba(33, 150, 243, 0.5); }
    50% { box-shadow: 0 0 30px rgba(33, 150, 243, 0.8); }
    100% { box-shadow: 0 0 20px rgba(33, 150, 243, 0.5); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Мобильная версия */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        height: auto;
        padding: 10px;
        gap: 10px;
    }

    .sidebar, .player-section, .playlist-section {
        width: 100%;
        height: auto;
    }

    .sidebar {
        max-height: 40vh;
    }

    .player-section {
        max-height: 50vh;
    }

    .playlist-section {
        max-height: 40vh;
    }

    .video-player {
        height: 250px;
    }

    .folder-input-group {
        flex-wrap: wrap;
    }

    .main-btn, .collapse-btn {
        flex: 1;
        min-width: auto;
    }

    .delete-btn, .info-btn {
        opacity: 1;
    }

    .modal-buttons {
        flex-direction: column;
    }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    .container {
        padding: 8px;
        gap: 8px;
    }

    .video-player {
        height: 200px;
    }

    .video-item {
        padding: 10px 12px;
    }

    .section-title {
        font-size: 14px;
        padding: 12px 15px;
    }

    .folder-btn {
        padding: 10px 12px;
        font-size: 12px;
    }
}

/* Скрываем input file */
input[type="file"] {
    display: none;
}

/* Улучшаем скроллбар */
.folder-tree::-webkit-scrollbar,
.playlist-section::-webkit-scrollbar {
    width: 8px;
}

.folder-tree::-webkit-scrollbar-track,
.playlist-section::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.folder-tree::-webkit-scrollbar-thumb,
.playlist-section::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #2196f3, #00bcd4);
    border-radius: 4px;
}

.folder-tree::-webkit-scrollbar-thumb:hover,
.playlist-section::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #1976d2, #00bcd4);
}

/* Индикатор загрузки */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #00bcd4;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.progress-indicator {
    background: linear-gradient(135deg, #4caf50, #45a049);
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-indicator::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(
            -45deg,
            rgba(255, 255, 255, 0.2) 25%,
            transparent 25%,
            transparent 50%,
            rgba(255, 255, 255, 0.2) 50%,
            rgba(255, 255, 255, 0.2) 75%,
            transparent 75%,
            transparent
    );
    background-size: 50px 50px;
    animation: move 2s linear infinite;
}

@keyframes move {
    0% { background-position: 0 0; }
    100% { background-position: 50px 50px; }
}

/* Стили для маленькой тестовой кнопки */
.test-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
    width: 100%;
}

.test-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}