        /* Спільні стилі для модального вікна коментарів */

/* 1. Загальні налаштування модального вікна */
.modal {
    display: none;
    overflow: hidden;
}

.modal.show {
    display: block !important;
    background: rgba(0, 0, 0, 0.2);
}

/* Виправляємо стрибок при відкритті */
body.modal-open {
    overflow: auto !important;
    padding-right: 0 !important;
}

/* --- Стилі для вікна коментарів Post Show (Modal) --- */
.post-show-modal .modal-dialog-bottom-offset {
    max-width: 600px !important;
    width: 100% !important;
    margin: 0 auto !important;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.post-show-modal.show .modal-dialog-bottom-offset {
    transform: translateY(0);
    }

/* --- Стилі для вікна коментарів Feed (Offcanvas) --- */
.feed-comments-offcanvas {
    max-width: 600px !important;
    margin: 0 auto !important;
    border-radius: 20px 20px 0 0 !important;
    border: none;
    box-shadow: 0 -5px 25px rgba(0,0,0,0.2);
}

/* 3. Контейнер введення коментаря */
.comment-input-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    background: #fff;
    padding: 8px;
    border: 1px solid #dee2e6;
    border-radius: 25px;
    gap: 8px;
    width: 100%;
}

.comment-input-wrapper .btn-gradient-animated {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 4. Мобільна адаптація */
@media (max-width: 768px) {
    .modal-dialog-bottom-offset {
        margin: 0 !important;
        border-radius: 20px 20px 0 0 !important;
}

    .comment-input-wrapper {
        padding: 0.25rem 0.5rem;
}
}

/* 5. Допоміжні елементи */
#comment-textarea {
    border: none;
    box-shadow: none;
    flex: 1;
    font-size: 1rem;
    padding: 10px;
    background: transparent;
    min-height: 40px;
    max-height: 150px;
    overflow-y: auto;
    resize: none;
    outline: none;
}

/* Робимо кути прямими для злиття з екраном */
.modal-content.custom-border {
    border-radius: 20px 20px 0 0 !important;
}

@media (max-width: 768px) {
    .modal-dialog-bottom-offset {
        margin: 0 !important;
        border-radius: 20px 20px 0 0 !important;
    }

    .modal-content.custom-border {
        border-radius: 20px 20px 0 0 !important;
    }
}

/* --- Елементи, що залишилися --- */

/* Переконаємося, що контейнер коментарів має прозорий фон */
#comments-container {
    background: #fff;
    height: 100%;
    overflow-y: auto;
    padding: 15px; /* Загальний відступ від країв вікна */
}

/* Додаємо стиль для кожного окремого блоку коментаря */
#comments-container > div {
    padding-left: 5px;
    padding-right: 5px;
    margin-bottom: 20px;
}

/* Блок відображення контексту відповіді */
#reply-context {
    display: none;
    margin-bottom: 1rem;
    padding: 0 0.5rem;
}

#reply-user-avatar {
    width: 35px;
    height: 35px;
    object-fit: cover;
}

.reply-context-card {
    margin-left: 8px;
}

/* Примусово задаємо мінімальну ширину для кнопок, щоб вони не стискалися */
.comment-input-wrapper > .btn {
    flex: 0 0 40px;
}

.file-upload-label {
    cursor: pointer;
    color: #6c757d;
    font-size: 1.1rem;
    margin-right: 10px;
    margin-bottom: 0;
}

.emoji-trigger {
    cursor: pointer;
    color: #6c757d;
    font-size: 1.1rem;
    margin-right: 10px;
    margin-bottom: 0;
    background: none;
    border: none;
    padding: 0;
}

/* --- 3. Поле тексту (авто-розтягування) --- */
#comment-textarea-feed {
    border: none;
    box-shadow: none;
    flex: 1;
    font-size: 1rem;
    padding: 10px;
    background: transparent;
    min-height: 40px;
    max-height: 150px;
    overflow-y: auto;
    resize: none; /* Вимикаємо стандартне ручне розтягування */
    outline: none;
}

/* Переконаємося, що загальний клас не має примусово круглих розмірів поза коментарями */
/* Ми використовуємо селектор, який не зачіпає кнопки в коментарях */
.btn-gradient-animated:not(.comment-input-wrapper .btn-gradient-animated) {
    width: auto !important;
    height: auto !important;
    border-radius: 50px !important; /* Повертаємо овальну форму для всіх інших */
}

/* --- 5. Пікер емодзі --- */
#emoji-picker-container {
    margin-top: 10px;
    width: 100%;
    display: none;
}

#emoji-picker-container.active {
    display: block;
}

/* Примусово задаємо ширину для пікера всередині контейнера */
#emoji-picker-container em-emoji-picker {
    width: 100%;
}

/* Блок прев'ю зображення */
#image-preview-container {
    display: none;
    margin-top: 1rem;
}

.image-preview-wrapper {
    position: relative;
    display: inline-block;
}

#image-preview {
    max-width: 100px;
    max-height: 100px;
    border-radius: 8px;
    display: block;
}

.clear-image-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

