/* ========================================== */
/* КРАТКОЕ ОГЛАВЛЕНИЕ                         */
/* ========================================== */
/*
 * ФАЙЛ: edit-text-modal.css
 * НАЗНАЧЕНИЕ: Модальное окно для редактирования текстовой иконки
 *
 * СОДЕРЖАНИЕ:
 * 1. .edit-text-modal - Модальное окно на весь экран карточки
 * 2. .edit-text-modal__content - Контейнер содержимого окна
 * 3. .edit-text-modal__close - Кнопка закрытия модального окна
 * 4. .edit-text-modal__title - Заголовок модального окна
 * 5. .edit-text-form - Форма с полями для редактирования данных
 * 6. .edit-text-form__input - Поле ввода заголовка текста
 * 7. .edit-text-form__textarea - Поле ввода текста
 * 8. .edit-text-form__file-upload - Блок загрузки иконки
 * 9. .edit-text-form__submit - Кнопка сохранения изменений
 * 10. .edit-text-form__delete - Кнопка удаления текстовой иконки
 */
/* ========================================== */

/* ========== EDIT TEXT MODAL STYLES ==========*/
/* Модальное окно редактирования текстовой иконки */

/* Модальное окно - открывается поверх карточки хранилища */
.edit-text-modal {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ffdd76;
    border-radius: 12px;
    z-index: 1000;
    padding: 30px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Активное состояние - показ модального окна */
.edit-text-modal.active {
    display: block;
}

/* Контейнер содержимого модального окна - центрирован */
.edit-text-modal__content {
    position: relative;
    max-width: 900px;
    width: calc(100% - 60px);
    margin: 0 auto;
    padding-top: 40px;
}

/* Кнопка закрытия модального окна - крестик в правом верхнем углу */
.edit-text-modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    font-size: 36px;
    color: var(--text-dark);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    cursor: pointer;
    background: none;
    border: none;
    z-index: 1001;
}

/* Эффект наведения на кнопку закрытия - увеличение */
.edit-text-modal__close:hover {
    transform: scale(1.2);
}

/* Заголовок модального окна */
.edit-text-modal__title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 20px 0;
    text-align: center;
}

/* Форма редактирования текста - CSS Grid layout */
.edit-text-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto auto;
    gap: 14px;
    margin-bottom: 0;
}

/* Поле ввода заголовка текста - первая строка, левая колонка */
.edit-text-form__input {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    padding: 15px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background-color: #f0f0f0;
    color: var(--text-dark);
}

/* Стиль placeholder для поля заголовка */
.edit-text-form__input::placeholder {
    color: #999;
}

/* Блок загрузки файла иконки - первая строка, правая колонка */
.edit-text-form__file-upload {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    display: flex;
    flex-direction: row-reverse;
    gap: 10px;
    align-items: center;
    justify-content: flex-start;
}

/* Кнопка выбора файла иконки */
.edit-text-form__file-btn {
    padding: 15px 20px;
    background-color: #ffffff;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

/* Эффект наведения на кнопку выбора файла */
.edit-text-form__file-btn:hover {
    background-color: #f5f5f5;
    border-color: #999;
}

/* Отображение имени выбранного файла */
.edit-text-form__file-name {
    font-size: 14px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* Превью загруженной иконки */
.edit-text-form__preview-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 8px;
    background-color: #fff;
    padding: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    margin-right: auto;
}

/* Заглушка для превью - показывается когда файл не выбран */
.edit-text-form__preview-placeholder {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    margin-right: auto;
    color: #1a6b6d;
}

/* Обёртка — без своей min-height, иначе grip «выпадает» за поле */
.edit-text-modal .text-note-editor {
    grid-column: 1 / 3;
    grid-row: 2 / 3;
    position: relative;
    display: block;
    width: 100%;
    min-height: 0;
}

/* Как в add: слева обычный padding текста, справа зона copy */
.edit-text-form__textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 15px 40px 20px 15px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.45;
    background-color: #f0f0f0;
    color: var(--text-dark);
    resize: none;
    min-height: 180px;
    max-height: none;
    height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Стиль placeholder для поля текста */
.edit-text-form__textarea::placeholder {
    color: #999;
}

/* ~50% ширины поля, по центру */
.edit-text-form__submit {
    grid-column: 1 / 3;
    grid-row: 3 / 4;
    box-sizing: border-box;
    width: 50%;
    max-width: 50%;
    justify-self: center;
    margin-top: 0;
    padding: 15px 30px;
    background-color: #4caf50;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Эффект наведения на кнопку сохранения - поднятие с тенью */
.edit-text-form__submit:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Кнопка удаления — тот же размер/отступы, что «Сохранить» */
.edit-text-form__delete {
    grid-column: 1 / 3;
    grid-row: 4 / 5;
    box-sizing: border-box;
    width: 50%;
    max-width: 50%;
    justify-self: center;
    padding: 15px 30px;
    background-color: #f44336;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* Эффект наведения на кнопку удаления - поднятие с тенью */
.edit-text-form__delete:hover {
    background-color: #da190b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(244, 67, 54, 0.4);
}

/* ========================================== */
/* RESPONSIVE - МОБИЛЬНАЯ АДАПТАЦИЯ           */
/* ========================================== */

/* Первый диапазон: от 880px до 490px */
@media (max-width: 880px) {
    .edit-text-modal {
        padding: 16px 10px;
        border-radius: 10px;
    }

    .edit-text-modal__content {
        width: 100%;
        max-width: none;
        padding-top: 16px;
    }

    .edit-text-modal__close {
        width: 40px;
        height: 40px;
        font-size: 34px;
        top: 8px;
        right: 6px;
    }

    .edit-text-modal__title {
        font-size: 19px;
        margin-bottom: 16px;
    }

    .edit-text-form {
        gap: 14px;
    }

    .edit-text-form__input {
        padding: 13px 12px;
        font-size: 14px;
    }

    .edit-text-form__textarea {
        padding: 12px 26px 16px 10px;
        font-size: 14px;
        min-height: 160px;
        height: 180px;
    }

    .edit-text-modal .text-note-editor__copy,
    .text-note-editor__copy {
        right: 4px;
    }

    .edit-text-form__file-upload {
        flex-direction: row;
        gap: 10px;
        align-items: center;
    }

    .edit-text-form__file-btn {
        padding: 13px 12px;
        font-size: 13px;
        flex: 1;
    }

    .edit-text-form__file-name {
        display: none;
    }

    .edit-text-form__preview-img,
    .edit-text-form__preview-placeholder {
        width: 44px;
        height: 44px;
        font-size: 18px;
        margin: 0;
        flex-shrink: 0;
    }

    .edit-text-form__submit,
    .edit-text-form__delete {
        width: calc(100% - 40px);
        max-width: calc(100% - 40px);
        justify-self: center;
        margin-top: 0;
        padding: 13px 20px;
        font-size: 15px;
    }
}

/* Второй диапазон: от 490px до 340px */
@media (max-width: 490px) {
    .edit-text-modal {
        padding: 14px 10px;
        border-radius: 8px;
    }

    .edit-text-modal__content {
        width: 100%;
        padding-top: 12px;
    }

    .edit-text-modal__close {
        width: 38px;
        height: 38px;
        font-size: 32px;
        top: 6px;
        right: 4px;
    }

    .edit-text-modal__title {
        font-size: 16px;
        margin-bottom: 14px;
    }

    .edit-text-form {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        gap: 12px;
    }

    .edit-text-form__input {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
        padding: 12px 10px;
        font-size: 14px;
    }

    .edit-text-form__file-upload {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }

    .edit-text-form__file-btn {
        padding: 12px 10px;
        font-size: 13px;
        flex: 1;
    }

    .edit-text-form__file-name {
        display: none;
    }

    .edit-text-form__preview-img,
    .edit-text-form__preview-placeholder {
        width: 44px;
        height: 44px;
        font-size: 18px;
        margin: 0;
        flex-shrink: 0;
    }

    .text-note-editor {
        grid-column: 1 / 2;
        grid-row: 3 / 4;
    }

    .edit-text-form__textarea {
        padding: 12px 24px 14px 10px;
        font-size: 14px;
        min-height: 150px;
        height: 170px;
    }

    .edit-text-modal .text-note-editor__copy,
    .text-note-editor__copy {
        right: 3px;
    }

    .edit-text-form__submit {
        grid-column: 1 / 2;
        grid-row: 4 / 5;
        width: calc(100% - 40px);
        max-width: calc(100% - 40px);
        justify-self: center;
        padding: 14px;
        font-size: 15px;
    }

    .edit-text-form__delete {
        grid-column: 1 / 2;
        grid-row: 5 / 6;
        width: calc(100% - 40px);
        max-width: calc(100% - 40px);
        justify-self: center;
        padding: 14px;
        font-size: 15px;
    }
}
