/* ============================================
   chat.css — XStartX
   Чат и виджеты поддержки/«наверх».
   Подключается АСИНХРОННО и только для авторизованных
   (виджеты на публичных страницах создаёт forum.js —
   если они нужны анонимам, подключите chat.css всем).
   ============================================ */

.chat-modal {
    display: flex;
    flex-direction: column;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    border-radius: 10px;
    background: linear-gradient(to bottom, #f9f9f9, #e0e0e0);
    overflow: hidden;
}

.chat-header {
    padding: 10px;
    border-bottom: 1px solid #ccc;
    background: var(--primary);
    color: var(--white);
    text-align: center;
}

.chat-body {
    flex: 1;
    padding: 10px;
    background: var(--white);
    overflow-y: auto;
}

.chat-message {
    max-width: 80%;
    margin: 10px 0;
    padding: 10px;
    border-radius: 10px;
}

.chat-message.sent {
    margin-left: auto;
    background: #dcf8c6;
    align-self: flex-end;
}

.chat-message.received {
    border: 1px solid #ccc;
    background: var(--white);
}

.chat-footer {
    display: flex;
    padding: 10px;
    border-top: 1px solid #ccc;
    background: #f1f1f1;
}

.chat-footer textarea {
    flex: 1;
    margin-right: 10px;
    padding: 5px;
    border-radius: 5px;
    font-size: 14px;
}

.emoji-picker {
    display: flex;
    gap: 5px;
    margin-right: 10px;
}

.emoji {
    font-size: 20px;
    cursor: pointer;
}

.emoji-picker span:hover {
    transform: scale(1.2);
}

/* ---- Виджеты: поддержка и «наверх» ---- */
.support-button {
    position: fixed;
    right: 30px;
    bottom: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgb(0 0 0 / 20%);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
}

.support-button img {
    display: block;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    aspect-ratio: 1 / 1;
    object-fit: contain;
}

.support-button:hover {
    box-shadow: 0 6px 20px rgb(0 0 0 / 30%);
    transform: scale(1.1);
}

.support-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 50%;
    background-color: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: bold;
    z-index: 1001;
}

.scroll-top-btn {
    position: fixed;
    right: 100px;
    bottom: 30px;
    display: none;
    justify-content: center;
    align-items: center;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgb(0 0 0 / 20%);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 999;
}

.scroll-top-btn.show {
    display: flex;
}

@media (width <= 768px) {
    .chat-modal {
        width: 95%;
    }

    .chat-footer textarea {
        font-size: 12px;
    }
}