/* ========================================== */
/* КРАТКОЕ ОГЛАВЛЕНИЕ                         */
/* ========================================== */
/*
 * ФАЙЛ: add-files-modal.css
 * НАЗНАЧЕНИЕ: Стили модального окна загрузки файлов
 *
 * СОДЕРЖАНИЕ:
 * 1. .add-files-modal - Модальное окно загрузки файлов
 * 2. .add-files-modal__content - Контент модального окна
 * 3. .add-files-form__drop-zone - Область для перетаскивания файлов
 * 4. .add-files-form__limits - Информация о лимитах
 * 5. .add-files-form__storage-info - Индикатор использования места
 * 6. .add-files-form__files-list - Список выбранных файлов
 * 7. .add-files-form__submit - Кнопка загрузки
 *
 * ОСОБЕННОСТИ:
 * - Анимации: hover эффекты для кнопок
 * - Цвета: голубой акцент (#4fc3f7)
 * - Адаптивность: мобильная версия
 */
/* ========================================== */

/* ========== МОДАЛЬНОЕ ОКНО ЗАГРУЗКИ ФАЙЛОВ ========== */
/* Заливает всё хранилище — как add-link-modal, без тёмного оверлея */
.add-files-modal {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: #ffdd76;
    border-radius: 12px;
    padding: 20px 28px;
    overflow-y: auto;
    flex-direction: column;
    justify-content: flex-start;
}


/* Контент — прозрачный, на всю ширину, без своего фона */
.add-files-modal__content {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

/* Кнопка закрытия (крестик) — позиционируется относительно модала */
.add-files-modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 32px;
    color: var(--text-dark);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    line-height: 1;
    z-index: 1001;
}

.add-files-modal__close:hover {
    transform: scale(1.2);
}

/* Заголовок модального окна */
.add-files-modal__title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 20px 0;
    text-align: center;
}

/* ========== ФОРМА ЗАГРУЗКИ — горизонтальный двухколоночный layout ========== */
.add-files-form {
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: stretch;
    min-height: 0;
}

/* Левая колонка: зона загрузки + лимиты */
.add-files-form__left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Правая колонка: индикатор + список + кнопка */
.add-files-form__right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ========== ОБЛАСТЬ ДЛЯ ПЕРЕТАСКИВАНИЯ ========== */
.add-files-form__drop-zone {
    border: 2px dashed #ccc;
    border-radius: 12px;
    padding: 20px 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.add-files-form__drop-zone:hover,
.add-files-form__drop-zone.drag-over {
    border-color: #4fc3f7;
    background: #e3f2fd;
}

.add-files-form__icon {
    width: 36px;
    height: 36px;
    color: #4fc3f7;
    margin: 0 auto 10px;
}

.add-files-form__drop-text {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 5px 0;
}

.add-files-form__drop-subtext {
    font-size: 14px;
    color: #666;
    margin: 0;
}

/* ========== ИНФОРМАЦИЯ О ЛИМИТАХ ========== */
.add-files-form__limits {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 12px 15px;
}

.add-files-form__limits-text {
    font-size: 13px;
    color: #555;
    margin: 5px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-files-form__limits-icon {
    font-size: 16px;
}

/* ========== ИНДИКАТОР ИСПОЛЬЗОВАНИЯ МЕСТА ========== */
.add-files-form__storage-info {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
}

.add-files-form__storage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.add-files-form__storage-label {
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

.add-files-form__storage-value {
    font-size: 14px;
    color: #333;
    font-weight: 600;
}

.add-files-form__storage-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.add-files-form__storage-progress {
    height: 100%;
    background: linear-gradient(90deg, #4fc3f7, #039be5);
    transition: width 0.3s ease, background 0.3s ease;
    border-radius: 4px;
}

.add-files-form__storage-progress.warning {
    background: linear-gradient(90deg, #ffc107, #ff9800);
}

.add-files-form__storage-progress.error {
    background: linear-gradient(90deg, #f44336, #d32f2f);
}

/* ========== СПИСОК ФАЙЛОВ ========== */
.add-files-form__files-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    max-height: 180px;
    overflow-y: auto;
    min-height: 40px;
}

.add-files-form__file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 8px;
}

.add-files-form__file-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
}

.add-files-form__file-info {
    flex: 1;
    min-width: 0;
}

.add-files-form__file-name {
    font-size: 14px;
    color: #333;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.add-files-form__file-size {
    font-size: 12px;
    color: #666;
}

.add-files-form__file-remove {
    background: none;
    border: none;
    color: #f44336;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    font-size: 20px;
}

.add-files-form__file-remove:hover {
    background: #ffebee;
}

/* ========== КНОПКА ЗАГРУЗКИ ========== */
.add-files-form__submit {
    background: linear-gradient(135deg, #4fc3f7, #039be5);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    position: relative;
}

.add-files-form__submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 195, 247, 0.4);
}

.add-files-form__submit:disabled:not(.add-files-form__submit--loading) {
    background: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ========== АНИМАЦИЯ ЗАГРУЗКИ ========== */

@keyframes upload-spin {
    to { transform: rotate(360deg); }
}

@keyframes upload-glow {
    0%, 100% { box-shadow: 0 0 8px rgba(26, 107, 109, 0.4), 0 4px 12px rgba(26, 107, 109, 0.2); }
    50%       { box-shadow: 0 0 22px rgba(26, 107, 109, 0.8), 0 4px 24px rgba(79, 195, 247, 0.4); }
}

@keyframes upload-pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.03); }
}

/* Состояние загрузки кнопки */
.add-files-form__submit--loading {
    background: linear-gradient(135deg, #1a6b6d, #2d9596) !important;
    color: white !important;
    cursor: not-allowed;
    pointer-events: none;
    transform: none !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 10px;
    animation: upload-pulse 0.9s ease-in-out infinite, upload-glow 1.4s ease-in-out infinite;
}

/* Спиннер внутри кнопки */
.add-files-form__spinner {
    width: 17px;
    height: 17px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: upload-spin 0.7s linear infinite;
    flex-shrink: 0;
    display: block;
}

/* ========================================== */
/* RESPONSIVE - МОБИЛЬНАЯ АДАПТАЦИЯ           */
/* ========================================== */

/* Первый диапазон: от 880px до 490px */
@media (max-width: 880px) {
    .add-files-modal {
        padding: 20px 18px;
        border-radius: 10px;
    }

    .audio-player {
        border-radius: 10px; /* Синхронизировано с .storage__card на мобильном */
    }

    .add-files-modal__close {
        width: 40px;
        height: 40px;
        font-size: 34px;
        top: 10px;
        right: 10px;
    }

    .add-files-modal__title {
        font-size: 18px;
        margin-bottom: 16px;
    }

    .add-files-form {
        gap: 14px;
    }

    .add-files-form__drop-zone {
        padding: 16px 12px;
    }

    .add-files-form__drop-text {
        font-size: 14px;
    }

    .add-files-form__drop-subtext {
        font-size: 13px;
    }

    .add-files-form__limits {
        padding: 10px 12px;
    }

    .add-files-form__limits-text {
        font-size: 12px;
    }

    .add-files-form__files-list {
        max-height: 150px;
    }

    .add-files-form__submit {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* Второй диапазон: от 490px и меньше — одна колонка */
@media (max-width: 490px) {
    .add-files-modal {
        padding: 16px 12px;
        border-radius: 8px;
    }

    .add-files-modal__close {
        width: 38px;
        height: 38px;
        font-size: 32px;
        top: 8px;
        right: 8px;
    }

    .add-files-modal__title {
        font-size: 16px;
        margin-bottom: 14px;
    }

    /* Вертикальный layout на узких экранах */
    .add-files-form {
        flex-direction: column;
        gap: 12px;
    }

    .add-files-form__drop-zone {
        padding: 20px 12px;
        flex: none;
    }

    .add-files-form__icon {
        width: 30px;
        height: 30px;
    }

    .add-files-form__drop-text {
        font-size: 14px;
    }

    .add-files-form__drop-subtext {
        font-size: 12px;
    }

    .add-files-form__limits {
        padding: 10px 12px;
    }

    .add-files-form__limits-text {
        font-size: 12px;
        margin: 3px 0;
    }

    .add-files-form__storage-info {
        padding: 12px;
    }

    .add-files-form__files-list {
        max-height: 120px;
    }

    .add-files-form__file-icon {
        width: 32px;
        height: 32px;
    }

    .add-files-form__submit {
        padding: 14px;
        font-size: 15px;
    }
}

/* ========================================== */
/* AUDIO PLAYER (FULL OVERLAY)                */
/* ========================================== */

.audio-player {
    position: absolute;
    inset: 0;
    background: rgba(15, 68, 70, 0.98);
    color: white;
    z-index: 1000;
    border-radius: 16px; /* Синхронизировано с .storage__card */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Заголовок: слева название, по центру «Загрузить», справа Свернуть+✕ */
.audio-player__header {
    display: flex;
    align-items: center;
    position: relative;
    gap: 8px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.audio-player__title {
    flex: 1 1 0;
    min-width: 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.2px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    /* не заезжать под центрированную кнопку */
    padding-right: 72px;
}

.audio-player__title-icon {
    flex-shrink: 0;
    color: #ffffff;
    fill: #ffffff;
}

.audio-player__header-actions {
    flex: 1 1 0;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    min-width: 0;
    /* симметрия с title: место под центрированную кнопку */
    padding-left: 72px;
}

.audio-player__header-actions .audio-player__btn {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
}

/* Пустое состояние */
.audio-player__empty {
    flex: 1;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    opacity: 0.6;
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

/* Список треков */
.audio-player__playlist {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    max-height: calc(100% - 110px); /* не уйти за пределы плеера */
}

.audio-player__playlist-list {
    padding: 6px 0;
}

.audio-player__playlist-item {
    padding: 11px 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.audio-player__playlist-item:hover {
    background: rgba(255,255,255,0.07);
}

.audio-player__playlist-item.is-active {
    background: rgba(255,193,7,0.15);
    color: #ffc107;
}

.audio-player__playlist-item.is-active .audio-player__playlist-item-num {
    color: #ffc107;
}

.audio-player__playlist-item-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audio-player__playlist-item-num {
    font-size: 12px;
    opacity: 0.45;
    width: 22px;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* Панель управления */
.audio-player__controls-bar {
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding: 12px 16px 14px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.audio-player__now-playing {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.audio-player__note {
    font-size: 16px;
    flex-shrink: 0;
    opacity: 0.95;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.audio-player__note svg {
    display: block;
    fill: #ffffff;
    color: #ffffff;
}

.audio-player__name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.9;
}

.audio-player__controls-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Кнопки */
.audio-player__btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 15px;
    padding: 5px 8px;
    border-radius: 6px;
    transition: background 0.15s;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.audio-player__btn:hover {
    background: rgba(255,255,255,0.15);
}

/* «Загрузить» — строго по центру шапки (absolute), бордер после .audio-player__btn */
.audio-player__btn.audio-player__btn--upload {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    padding: 6px 14px;
    border-radius: 8px;
    border: 1.5px solid rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.audio-player__btn.audio-player__btn--upload:hover {
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.85);
}

@media (max-width: 480px) {
    .audio-player__header {
        padding: 12px 10px 10px;
        gap: 4px;
    }

    .audio-player__title {
        font-size: 13px;
        gap: 4px;
        padding-right: 56px;
    }

    .audio-player__title-icon {
        width: 16px;
        height: 16px;
    }

    .audio-player__header-actions {
        padding-left: 56px;
    }

    /* На узком экране — только иконка «Свернуть», чтобы ✕ не переносился */
    .audio-player__minimize-label {
        display: none;
    }

    .audio-player__btn.audio-player__btn--upload {
        padding: 5px 10px;
        font-size: 12px;
    }
}

.audio-player__btn--play {
    font-size: 22px;
    padding: 4px 10px;
}

.audio-player__btn--close {
    font-size: 18px;
    padding: 4px 7px;
    opacity: 0.7;
}

.audio-player__btn--close:hover {
    opacity: 1;
}

/* Ползунок прогресса */
.audio-player__seek {
    flex: 1;
    height: 4px;
    accent-color: #ffc107;
    cursor: pointer;
    min-width: 0;
}

.audio-player__time {
    font-size: 11px;
    opacity: 0.65;
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* ========================================== */
/* VIDEO PLAYER MODAL                         */
/* ========================================== */

.video-player-modal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.88);
    z-index: 1001;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px 20px;
}

.video-player-modal__close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: rgba(255,255,255,0.12);
    border: none;
    font-size: 26px;
    color: white;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    line-height: 1;
}

.video-player-modal__close:hover {
    background: rgba(255,255,255,0.25);
}

.video-player-modal video {
    max-width: 100%;
    max-height: calc(100% - 60px);
    border-radius: 8px;
    display: block;
}

.video-player-modal__filename {
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    margin-top: 10px;
    text-align: center;
    word-break: break-all;
}

/* ========== ГОСТЕВОЕ ПРЕДУПРЕЖДЕНИЕ 24ч ========== */
.add-files-form__guest-notice {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 10px;
    background: linear-gradient(135deg, #fff3cd 0%, #ffe08a 100%);
    border: 2px solid #f0ad4e;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    box-shadow: 0 0 0 3px rgba(240, 173, 78, 0.25);
}

.add-files-form__guest-notice[hidden] {
    display: none !important;
}

.add-files-form__guest-notice-text {
    flex: 1;
    min-width: 200px;
    font-size: 14px;
    line-height: 1.4;
    color: #5c3d00;
}

.add-files-form__guest-register-btn {
    flex-shrink: 0;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: #1a6b6d;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.add-files-form__guest-register-btn:hover {
    background: #155557;
    transform: translateY(-1px);
}

@media (max-width: 600px) {
    .add-files-form__guest-notice {
        padding: 12px;
        gap: 10px;
    }
    .add-files-form__guest-notice-text {
        font-size: 13px;
    }
    .add-files-form__guest-register-btn {
        width: 100%;
    }
}
