.chat-button-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.chat-button {
    width: 100px;
    height: 100px;
    background: linear-gradient(45deg, #4a76a8, #91d926);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    position: relative; /* Чтобы кнопка была поверх круга */
    z-index: 2;
}
.chat-button.has-notifications::before {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    background-color: #ff4757;
    border-radius: 50%;
    border: 3px solid #ffffff;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
    z-index: 3;
}

/* Цифра внутри кружка */
.chat-button.with-count::after {
    content: attr(data-count);
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    color: white;
    z-index: 4; /* Поверх кружка */
}


/* Основное окно чата */
.chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    height: 70vh;
    aspect-ratio: 1/1.5; /* Ширина = Высоте (квадрат) */
    min-width: 300px;
    max-width: 90vw;
    background: white;
    border-radius: 12px;
    display: none;
    flex-direction: column;
    z-index: 1000;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
    overflow: hidden;
    border: none;
}

/* Шапка чата */
.chat-header {
    padding: 12px 15px;
    background: linear-gradient(45deg,  #4a76a8,  #4aa882, #91d926);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-header h3 {
    margin: 0;
    font-size: 26px;
    font-weight: 500;
    color: inherit;
    text-decoration: none;
}

.closeChat {
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    font-size: 30px;
    margin-left: 20px;
    margin-right: 10px;
}

.closeChat:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Область сообщений */
.chat-messages {
    display: flex;
    flex-direction: column-reverse;
    flex-grow: 1;
    overflow-anchor: none;
    min-height: 0;
    padding: 15px;
    overflow-y: auto;
    background-color: #f9f9f9;
}

/* Поле ввода и кнопка */
.chat-input {
    padding: 12px;
    display: flex;
    gap: 8px;
    background: white;
    border-top: 1px solid #eee;
    max-height: 200px;
}

#messageInput {
    flex-grow: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    transition: border 0.3s;
}

#messageInput:focus {
    border-color: #4a76a8;
}

.send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #91d926 0%, #7bc11e 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.send-button:hover {
    background: linear-gradient(135deg, #e52e71 0%, #d41a5d 100%);
    transform: translateY(-2px);
}

.send-button:active {
    transform: translateY(0);
}

/* Анимация кнопки */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-3px); }
    100% { transform: translateY(0px); }
}

.send-button i {
    animation: float 2s infinite;
}

.pulse-circle {
    position: absolute;
    width: 110px;
    height: 110px;
    background: linear-gradient(45deg, #8efd0f, #e52e71, #4a76a8);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    opacity: 0.7;
    animation: pulse 2s infinite;
}

/* Анимация пульсации */
@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.7;
    }
    70% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}


.message {
    max-width: 70%;
    margin: 6px 10px;    /* ↓ уменьшил */
    padding: 4px 12px;   /* ↓ уменьшил */
    border-radius: 12px;

}

.my-msg {
    background: #e3f2fd;
    margin-left: auto;
    border-bottom-right-radius: 0;
}

.alter-msg {
    background: #f5f5f5;
    margin-right: auto;
    border-bottom-left-radius: 0;
}

.alter-msg.unread {
    border-left: 3px solid #007bff;
    background: #f0f8ff; /* Слегка голубоватый фон */
}

.message-sender {
    font-weight: bold;
    margin-bottom: 2px;
}

.message-time {
    font-size: 0.8em;
    color: #666;
    text-align: right;
    margin-top: 2px;     
}

.message-text {
    white-space: pre-wrap;  /* Сохраняет переносы и пробелы */
    word-wrap: break-word;
}