/* ========== МОДАЛЬНОЕ ОКНО СКАЧИВАНИЯ ========== */

.modal-download {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modalFadeIn 0.3s ease;
}

.modal-download.active {
    display: flex;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-download-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.modal-download-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 2;
    animation: modalSlideIn 0.3s ease;
    border: 1px solid var(--border-light);
    overflow: hidden;
}

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

.modal-download-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--light-bg);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    z-index: 3;
}

.modal-download-close:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.modal-download-content {
    padding: 40px;
    text-align: center;
}

.modal-download-icon {
    width: 64px;
    height: 64px;
    background: var(--primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 28px;
    color: var(--white);
}

.modal-download-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    font-family: 'Playfair Display', serif;
}

.modal-download-text {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 30px;
}

/* ФОРМАТЫ - КАЖДЫЙ НА НОВОЙ СТРОКЕ, РАСТЯНУТЫЙ ПРЯМОУГОЛЬНИК */
.modal-download-formats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
    width: 100%;
}

.modal-download-format {
    width: 100%;
    background: var(--light-bg);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    text-align: left;
    min-height: 80px;
}

.modal-download-format:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.modal-download-format.selected {
    border-color: var(--primary);
    background: var(--primary-lighter);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.modal-download-format-icon {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: var(--radius-full);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 20px;
}

.modal-download-format.audio .modal-download-format-icon {
    background: var(--accent);
}

.modal-download-format.pdf .modal-download-format-icon {
    background: #FF6B6B;
}

.modal-download-format.txt .modal-download-format-icon {
    background: #48BB78;
}

.modal-download-format-info {
    flex: 1;
    min-width: 0;
}

.modal-download-format-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-download-format-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Кнопка скачивания */
.modal-download-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-md);
    color: var(--white);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.modal-download-btn:hover {
    background: var(--primary-dark);
}

.modal-download-btn:disabled {
    background: var(--border);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Адаптивность */
@media (max-width: 768px) {
    .modal-download-container {
        max-width: 90%;
    }

    .modal-download-content {
        padding: 32px 24px;
    }

    .modal-download-title {
        font-size: 22px;
    }

    .modal-download-format {
        padding: 18px 20px;
        min-height: 70px;
        gap: 16px;
    }

    .modal-download-format-icon {
        width: 44px;
        height: 44px;
        min-width: 44px;
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .modal-download {
        padding: 10px;
    }

    .modal-download-container {
        max-width: 100%;
    }

    .modal-download-content {
        padding: 28px 20px;
    }

    .modal-download-title {
        font-size: 20px;
    }

    .modal-download-format {
        padding: 16px;
        min-height: 65px;
        gap: 12px;
    }

    .modal-download-format-icon {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 16px;
    }

    .modal-download-format-name {
        font-size: 15px;
    }

    .modal-download-format-desc {
        font-size: 13px;
    }
}

/* Для темной темы */
.dark-theme .modal-download-overlay {
    background: rgba(0, 0, 0, 0.7);
}

.dark-theme .modal-download-format {
    background: var(--card-hover);
    border-color: var(--border);
}

.dark-theme .modal-download-format:hover {
    border-color: var(--primary);
}

.dark-theme .modal-download-format.selected {
    border-color: var(--primary);
    background: rgba(214, 51, 132, 0.15);
}