/* ==========================================
   КРАТКОЕ ОГЛАВЛЕНИЕ
   ==========================================
   ФАЙЛ: add-chat-modal.css
   НАЗНАЧЕНИЕ: Стили модального окна создания чат-комнаты

   СОДЕРЖАНИЕ:
   1. .add-chat-modal        - оверлей поверх .storage__card (position: absolute)
   2. .add-chat-modal__close - кнопка закрытия (крестик, абс. top-right)
   3. .add-chat-modal__content - центрированный контент
   4. .add-chat-modal__title - заголовок
   5. .add-chat-modal__form  - 3-строчный grid (2 колонки)
   6. .add-chat-modal__input - поле ввода (название / описание)
   7. .add-chat-modal__icon-upload - блок загрузки иконки
   8. .add-chat-modal__link-field - поле с публичной ссылкой
   9. .add-chat-modal__toggle - чекбокс "без регистрации"
   10. .add-chat-modal__save  - кнопка "Создать чат"
   ========================================== */

/* ========== ОВЕРЛЕЙ ========== */
.add-chat-modal {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ffdd76;
    border-radius: 12px;
    z-index: 1000;
    padding: 20px 28px;
    overflow-y: auto;
    overflow-x: hidden;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding-top: 20px;
}

.add-chat-modal.active {
    display: flex;
}

/* ========== КНОПКА ЗАКРЫТИЯ ========== */
.add-chat-modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 30px;
    color: var(--text-dark);
    line-height: 1;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    z-index: 1001;
}

.add-chat-modal__close:hover {
    transform: scale(1.2);
}

/* Кнопка "Найти чат-комнату" — верхний левый угол */
.add-chat-modal__find-btn {
    position: absolute;
    top: 18px;
    left: 20px;
    transform: none;
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--green-primary, #1a6b6d);
    border: none;
    border-radius: 20px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(26,107,109,0.35);
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    z-index: 1001;
}

.add-chat-modal__find-btn:hover {
    background: #145456;
    box-shadow: 0 4px 14px rgba(26,107,109,0.45);
    transform: translateY(-1px);
}

/* ========== КОНТЕНТ ========== */
.add-chat-modal__content {
    width: calc(100% - 60px);
    max-width: 760px;
    margin: 0 auto;
}

/* ========== ЗАГОЛОВОК ========== */
.add-chat-modal__title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 20px 0;
    text-align: center;
}

/* ========== ФОРМА: 3 СТРОКИ × 2 КОЛОНКИ ========== */
.add-chat-modal__form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: stretch;
}

/* ========== ПОЛЕ ВВОДА (НАЗВАНИЕ / ОПИСАНИЕ) ========== */
.add-chat-modal__input {
    border: none;
    border-radius: 8px;
    padding: 13px 16px;
    font-size: 14px;
    color: var(--text-dark);
    font-family: inherit;
    background: #fff;
    outline: none;
    transition: box-shadow 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.add-chat-modal__input:focus {
    box-shadow: 0 0 0 2px var(--green-primary);
}

.add-chat-modal__input::placeholder {
    color: #999;
}

/* ========== ЗАГРУЗКА ИКОНКИ ========== */
.add-chat-modal__icon-upload {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border-radius: 8px;
    padding: 8px 12px;
}

.add-chat-modal__icon-preview {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: #e8f5e9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    color: var(--green-primary);
}

.add-chat-modal__icon-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.add-chat-modal__icon-btn {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    background: #f0f0f0;
    border: none;
    border-radius: 6px;
    padding: 9px 10px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
    text-align: center;
    line-height: 1.3;
}

.add-chat-modal__icon-btn:hover {
    background: #e0e0e0;
}

/* ========== ПУБЛИЧНАЯ ССЫЛКА ========== */
.add-chat-modal__link-field {
    background: #fff;
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.add-chat-modal__link-label {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.add-chat-modal__link-copy {
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-chat-modal__link-input {
    flex: 1;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    color: #555;
    background: #f8f8f8;
    outline: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.add-chat-modal__copy-btn {
    background: #1a6b6d;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 7px 9px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.add-chat-modal__copy-btn:hover {
    opacity: 0.85;
}

.add-chat-modal__copy-btn.copied {
    background: #43a047;
}

/* ========== ПЕРЕКЛЮЧАТЕЛЬ "БЕЗ РЕГИСТРАЦИИ" ========== */
.add-chat-modal__toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    background: #fff;
    border-radius: 8px;
    padding: 10px 14px;
}

.add-chat-modal__toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--green-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.add-chat-modal__toggle-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.add-chat-modal__toggle-desc {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

/* ========== ПРЕДУПРЕЖДЕНИЕ ДЛЯ ГОСТЕВОЙ КОМНАТЫ ========== */
.add-chat-modal__guest-notice {
    grid-column: 1 / -1;
    margin-top: 4px;
    padding: 12px 14px;
    border-radius: 8px;
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid rgba(255, 107, 53, 0.35);
    color: #b54a1f;
    font-size: 13px;
    line-height: 1.45;
}

.add-chat-modal__guest-notice strong {
    font-weight: 700;
}

/* ========== КНОПКА "СОЗДАТЬ ЧАТ" ========== */
.add-chat-modal__save {
    padding: 15px 30px;
    background: #4caf50;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.add-chat-modal__save:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.add-chat-modal__save:disabled {
    background: #a5d6a7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ========== АДАПТИВ ========== */
@media (max-width: 600px) {
    .add-chat-modal__form {
        grid-template-columns: 1fr;
    }
    .add-chat-modal__content {
        width: 100%;
    }
    .add-chat-modal {
        padding: 16px;
        padding-top: 16px; /* на мобиле кнопка в потоке, доп. отступ не нужен */
    }
    /* На мобиле кнопка "Найти" — в потоке, не абсолютная, не на всю ширину */
    .add-chat-modal__find-btn {
        position: static;
        transform: none;
        width: auto;
        align-self: center;
        margin-bottom: 14px;
    }
    .add-chat-modal__find-btn:hover {
        transform: translateY(-1px);
    }
    /* Крестик — в потоке, всегда виден сверху */
    .add-chat-modal__close {
        position: static;
        align-self: flex-end;
        margin-bottom: 4px;
        font-size: 24px;
    }
}
