/* Основные стили */
body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(177.63deg, #353A40 -84.18%, #181A1D 267.9%);
}

#chat-container {
    width: 100%;
    max-width: 944px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 80vh;
    background: #F7F7F7 url(../img/chat.jpg) 50% 100% repeat;
}

/* Стили для сообщений */
#messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column-reverse;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
}

.message .message-bubble {
    background-color: #dcf8c6;
    padding: 10px 15px;
    border-radius: 20px;
    max-width: 80%;
    position: relative;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    color: #000000;
}

.message-bubble img {
	width: 100px;
}

.message.outgoing .message-bubble {
    background-color: #e4e6eb;
    margin-left: auto;
}

.message strong {
    font-weight: bold;
    color: #0078ff;
}

/* Контейнер для кнопок удаления и редактирования */
.message .actions {
    position: absolute;
    top: 10px;
    right: -75px;
    cursor: pointer;
    font-size: 14px;
    color: #e3d4bd;
}

.message .actions span {
    margin-left: 10px;
}

/* Поле ввода сообщения */
#message-form {
    padding: 10px 20px;
    display: flex;
    align-items: center;
    border-top: 1px solid #131415;
    background: linear-gradient(356.43deg, #131415 19.32%, #202020 88.64%);
}

#user_name, #message {
    padding: 10px;
    border: 1px solid #131415;
    border-radius: 30px;
    font-size: 14px;
    margin-right: 10px;
    flex-grow: 1;
    color: #ffffff;
    height: 40px;
    background: linear-gradient(177.63deg, #353A40 -84.18%, #181A1D 267.9%);
}

::placeholder {
    color: #ffffff;
}

#message-form button {
    background-color: #e3d4bd;
    color: #000000;
    border: none;
    padding: 10px 15px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    margin-right: 7px;
}

#message-form button:hover {
    background-color: #bfb09a;
}

/* Модальные окна для удаления и редактирования */
.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    padding-top: 60px;
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 10px;
}

.modal-header, .modal-footer {
    margin-bottom: 10px;
}

.modal-header h2 {
    margin: 0;
}

.modal-footer {
    text-align: right;
}

.modal-body textarea {
    width: 100%;
    height: 120px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

/* Модальное окно удаления */
#deleteModal .modal-content {
    width: 300px;
}

#deleteModal .modal-body {
    font-size: 14px;
}

/* Стиль для кастомного скроллбара */
#messages::-webkit-scrollbar {
    width: 8px;
}

#messages::-webkit-scrollbar-thumb {
    background-color: #e3d4bd;
    border-radius: 10px;
}

#messages::-webkit-scrollbar-track {
    background-color: #131415;
    border-radius: 10px;
}

#emoji-sticker-panel {
    position: absolute;
    bottom: 139px;
    right: 821px;
    background: linear-gradient(356.43deg, #131415 19.32%, #202020 88.64%);
    border-radius: 10px;
    padding: 10px;
    width: 280px;
    box-shadow: 0 0.125rem 0.5rem 0 rgb(0 0 0 / 3%), 0 0.125rem 2rem -0.5rem rgb(23 43 61 / 20%);
}

#emoji-sticker-tabs {
    display: flex;
    justify-content: space-around;
    margin-bottom: 10px;
}

#emoji-sticker-tabs button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 5px 10px;
    border-radius: 5px;
    color: #fff;
    background: #414141;
    width: 47%;
}

#emoji-sticker-tabs button.active {
    background-color: #e3d4bd;
    color: #131415;
}

#emoji-container, #sticker-container {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.emoji, .sticker {
    cursor: pointer;
    font-size: 20px;
}

.sticker {
    width: 64px;
    height: 64px;
}

.chat-sticker {
    width: 100px;
    height: auto;
    vertical-align: middle;
    margin: 5px 0;
}

/* Медиа-запросы для адаптации под различные разрешения экранов */

/* Для экранов меньше 768px (планшеты и мобильные устройства) */
@media (max-width: 768px) {
    #chat-container {
        height: 90vh;
        max-width: 100%;
        border-radius: 0;
    }

    #messages {
        padding: 10px;
    }

    .message .message-bubble {
        max-width: 90%;
    }

    #emoji-sticker-panel {
        right: 10px;
        bottom: 100px;
        width: 250px;
    }

    #message-form {
        padding: 10px;
    }

    #user_name, #message {
        font-size: 12px;
    }

    #message-form button {
        font-size: 12px;
        padding: 8px 12px;
    }
}

/* Для экранов меньше 480px (мобильные устройства) */
@media (max-width: 480px) {
    #chat-container {
        height: 100vh;
    }

    #messages {
        padding: 5px;
    }

    .message .message-bubble {
        max-width: 95%;
        font-size: 12px;
    }

    #emoji-sticker-panel {
        width: 200px;
        bottom: 80px;
    }

    #emoji-sticker-tabs button {
        font-size: 12px;
        padding: 4px 8px;
    }

    .emoji, .sticker {
        font-size: 16px;
    }

    .sticker {
        width: 48px;
        height: 48px;
    }

    .chat-sticker {
        width: 80px;
    }

    #message-form {
        flex-direction: column;
        gap: 10px;
    }

    #user_name, #message {
        width: 100%;
        margin-right: 0;
    }

    #message-form button {
        width: 100%;
        margin-right: 0;
    }
}