/* ========================================== */
/* КРАТКОЕ ОГЛАВЛЕНИЕ                         */
/* ========================================== */
/*
 * ФАЙЛ: add-text-modal.css
 * НАЗНАЧЕНИЕ: Модальное окно для добавления новой текстовой иконки в хранилище
 *
 * СОДЕРЖАНИЕ:
 * 1. .add-text-modal - Модальное окно на весь экран карточки
 * 2. .add-text-modal__content - Контейнер содержимого окна
 * 3. .add-text-modal__close - Кнопка закрытия модального окна
 * 4. .add-text-modal__title - Заголовок модального окна
 * 5. .add-text-form - Форма с полями для ввода данных
 * 6. .add-text-form__input - Поле ввода заголовка текста
 * 7. .add-text-form__textarea - Поле ввода текста
 * 8. .add-text-form__file-upload - Блок загрузки иконки
 * 9. .add-text-form__submit - Кнопка отправки формы
 *
 * ОСОБЕННОСТИ:
 * - Анимации: scale(1.2) на кнопке закрытия, translateY(-2px) на кнопке отправки
 * - Цвета: желтый фон окна (var(--yellow-btn)), зеленая кнопка отправки (#4caf50)
 * - Адаптивность: есть (2 брейкпоинта)
 * - Layout: CSS Grid с 2 колонками для первой строки, поле текста на всю ширину
 */
/* ========================================== */

/* ========== ADD TEXT MODAL STYLES ==========*/
/* Модальное окно добавления текстовой иконки */

/* Модальное окно - открывается поверх карточки хранилища */
.add-text-modal {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ffdd76;
    border-radius: 12px;
    z-index: 1000;
    padding: 20px 30px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Активное состояние - показ модального окна с вертикальным центрированием */
.add-text-modal.active {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* Контейнер содержимого модального окна - центрирован по горизонтали */
.add-text-modal__content {
    position: relative;
    max-width: 900px;
    width: calc(100% - 60px);
    margin: 0 auto;
    padding-top: 0;
}

/* Кнопка закрытия модального окна - крестик в правом верхнем углу */
.add-text-modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    font-size: 32px;
    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;
}

/* Эффект наведения на кнопку закрытия - увеличение */
.add-text-modal__close:hover {
    transform: scale(1.2);
}

/* Заголовок модального окна */
.add-text-modal__title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 20px 0;
    text-align: center;
}

/* Форма добавления текста - CSS Grid layout */
.add-text-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 14px;
    margin-bottom: 0;
}

/* Поле ввода заголовка текста - первая строка, левая колонка */
.add-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 для поля заголовка */
.add-text-form__input::placeholder {
    color: #999;
}

/* Блок загрузки файла иконки - первая строка, правая колонка */
.add-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;
}

/* Кнопка выбора файла иконки */
.add-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;
}

/* Эффект наведения на кнопку выбора файла */
.add-text-form__file-btn:hover {
    background-color: #f5f5f5;
    border-color: #999;
}

/* Отображение имени выбранного файла */
.add-text-form__file-name {
    font-size: 14px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* Превью загруженной иконки */
.add-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;
}

/* Заглушка для превью - показывается когда файл не выбран */
/* Иконка по умолчанию для текста - документ с буквами "Aa" */
.add-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;
}

/* Обёртка поля текста + ручка / копировать — высота = высоте textarea */
.text-note-editor {
    grid-column: 1 / 3;
    grid-row: 2 / 3;
    position: relative;
    display: block;
    width: 100%;
    min-height: 0;
    line-height: normal;
}

/* Поле ввода текста: слева как у обычного padding, справа — зона copy (+ запас под скроллбар) */
.add-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: 160px;
    max-height: none;
    height: 180px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Стиль placeholder для поля текста */
.add-text-form__textarea::placeholder {
    color: #999;
}

/* Копировать — сразу левее типичного скроллбара (~12–15px), без наезда */
.text-note-editor__copy {
    position: absolute;
    top: 6px;
    right: 16px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #5b8a8c;
    cursor: pointer;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.55;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.text-note-editor__copy:hover {
    opacity: 1;
    background: rgba(26, 107, 109, 0.1);
    color: #1a6b6d;
}

/* Ручка: чуть левее и уже слева — полоски по центру hit-area */
.text-note-editor__resize {
    position: absolute;
    left: 1px;
    bottom: 3px;
    width: 18px;
    height: 20px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    cursor: ns-resize;
    z-index: 2;
    touch-action: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Дальняя от угла полоска длиннее, ближняя короче */
.text-note-editor__resize::before {
    content: '';
    width: 11px;
    height: 11px;
    opacity: 0.5;
    color: #5a5a5a;
    transform: translateX(-1px) rotate(45deg);
    background:
        linear-gradient(currentColor, currentColor) center 1px / 10px 1.5px no-repeat,
        linear-gradient(currentColor, currentColor) center 6px / 6px 1.5px no-repeat;
}

.text-note-editor__resize:hover {
    background: rgba(0, 0, 0, 0.06);
}

.text-note-editor__resize:hover::before {
    opacity: 0.8;
}

.text-note-editor__resize:active {
    background: rgba(0, 0, 0, 0.1);
}

/* ~50% ширины поля, по центру; отступ сверху = gap формы (как до textarea) */
.add-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;
}

/* Эффект наведения на кнопку отправки - поднятие с тенью */
.add-text-form__submit:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* ========================================== */
/* RESPONSIVE - МОБИЛЬНАЯ АДАПТАЦИЯ           */
/* ========================================== */

/* Первый диапазон: от 880px до 490px */
@media (max-width: 880px) {
    /* Поля шире: ~10px от краёв хранилища */
    .add-text-modal {
        padding: 16px 10px;
        border-radius: 10px;
    }

    .add-text-modal__content {
        width: 100%;
        max-width: none;
        padding-top: 16px;
    }

    .add-text-modal__close {
        width: 40px;
        height: 40px;
        font-size: 34px;
        top: 8px;
        right: 6px;
    }

    .add-text-modal__title {
        font-size: 19px;
        margin-bottom: 16px;
    }

    .add-text-form {
        gap: 14px;
    }

    .add-text-form__input {
        padding: 13px 12px;
        font-size: 14px;
    }

    /* Текст плотнее к краям поля; grip снизу не мешает */
    .add-text-form__textarea {
        padding: 12px 26px 16px 10px;
        font-size: 14px;
        min-height: 140px;
        height: 160px;
    }

    /* Скроллбар на мобилке узкий — copy правее */
    .text-note-editor__copy {
        right: 4px;
    }

    .add-text-form__file-upload {
        flex-direction: row;
        gap: 10px;
        align-items: center;
    }

    .add-text-form__file-btn {
        padding: 13px 12px;
        font-size: 13px;
        flex: 1;
    }

    .add-text-form__file-name {
        display: none;
    }

    .add-text-form__preview-img,
    .add-text-form__preview-placeholder {
        width: 44px;
        height: 44px;
        font-size: 18px;
        margin: 0;
        flex-shrink: 0;
    }

    /* Кнопки уже поля: отступы ~20px с каждой стороны */
    .add-text-form__submit {
        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) {
    .add-text-modal {
        padding: 14px 10px;
        border-radius: 8px;
    }

    .add-text-modal__content {
        width: 100%;
        padding-top: 12px;
    }

    .add-text-modal__close {
        width: 38px;
        height: 38px;
        font-size: 32px;
        top: 6px;
        right: 4px;
    }

    .add-text-modal__title {
        font-size: 16px;
        margin-bottom: 14px;
    }

    .add-text-form {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        gap: 12px;
    }

    .add-text-form__input {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
        padding: 12px 10px;
        font-size: 14px;
    }

    .add-text-form__file-upload {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }

    .add-text-form__file-btn {
        padding: 12px 10px;
        font-size: 13px;
        flex: 1;
    }

    .add-text-form__file-name {
        display: none;
    }

    .add-text-form__preview-img,
    .add-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;
    }

    .add-text-form__textarea {
        padding: 12px 24px 14px 10px;
        font-size: 14px;
        min-height: 140px;
        height: 160px;
    }

    .text-note-editor__copy {
        right: 3px;
    }

    .add-text-form__submit {
        grid-column: 1 / 2;
        grid-row: 4 / 5;
        width: calc(100% - 40px);
        max-width: calc(100% - 40px);
        justify-self: center;
        margin-top: 0;
        padding: 14px;
        font-size: 15px;
    }
}
