.chat-header {
    position: sticky;
    top: 60px;
    z-index: 1000;
    background: white;
    padding: 10px 15px;
    font-size: 20px;
    color: #333;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px; /* пространство между ссылкой и именем */
}

.back-to-product {
    position: absolute;
    left: 15px;
    font-size: 14px;
    padding: 4px 10px;
    text-decoration: none;
    color: #2b8a3e;
    border: 1px solid #2b8a3e;
    border-radius: 4px;
    background: transparent;
    transition: background-color 0.3s, color 0.3s;
}

.back-to-product:hover {
    background-color: #2b8a3e;
    color: white;
}

.chat-username {
    /* чтобы имя было по центру */
    flex: 1;
    text-align: center;
}
.chat-container {
    height: 95%; /* учитываем высоту .chat-header (60px) */
}
#chat-box {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
    overflow-y: auto;

}

.message-bubble {
    max-width: 80%;
    padding: 10px 15px;
    padding-top: 1px;
    border-radius: 15px;
    margin: 10px 0;
    position: relative;
    clear: both;
    word-wrap: break-word;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.my-message {
    background: #dcf8c6;
    margin-left: auto;
    text-align: left;

}

.other-message {
    background: #ebebeb;
    margin-right: auto;
    text-align: left;
}

.message-content p {
    margin: 0;
    font-size: 14px;
}

.meta {
    font-size: 14px;
    color: #667;
    margin-top: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.message-bubble .delete-btn {
    opacity: 0;
    transition: opacity 0.1s ease;
    background: none;
    border: none;
    color: grey;
    font-size: 14px;
    cursor: pointer;
    margin-left: 10px;
}

.message-bubble:hover .delete-btn {
    opacity: 1;
    display: inline-block; /* показывается, когда наводишься на сообщение */
}

#chat-form {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    background: #fff;
    border-top: 1px solid #ddd;
    position: sticky;
    bottom: 0;
    margin: 0;
}

#content {
    flex: 1;
    padding: 10px;
    border-radius: 20px;
    border: 1px solid #ccc;
    margin-right: 10px;
    font-size: 14px;
}







.message-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.avatar-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid #ccc;
}

.message-meta {
    display: flex;
    flex-direction: column;
}

.sender {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 3px;
}

.message-text {
    margin: 0;
    font-size: 16px;
}

.time {
    font-size: 12px;
    color: #777;
    text-align: right;
    margin-top: 5px;
}
.message-bubble {
    padding: 8px 15px 6px 15px;
}
.avatar-link,
.sender-link {
    text-decoration: none;
    color: inherit;
}

.sender-link:hover {
    text-decoration: underline;
    color: #2b8a3e;
}
.emoji {
    cursor: pointer;
}
.delete-global-btn {
    margin-bottom: 5px;
}
#send-btn {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: #007bff;
    user-select: none;
}
@media (max-width: 768px) {
    .chat-header {
        top: 0px;
    }
    #chat-form {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 15px;
        background: #fff;
        border-top: 1px solid #ddd;
        position: sticky;
        bottom: 50px;
        margin: 0;
    }
}