/* Chat Container */
.chat {
    z-index: 8;
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    width: 350px;
    max-width: 100%;
    height: 100%;
    background: var(--chat-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius) 0 0 0;
    box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.3);
    flex-direction: column;
    overflow: hidden;
    transition:
        transform 0.3s ease,
        opacity 0.3s ease;
}

/* Chat Header */
.chat .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--primary-color);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px 0 0 0;
}

.chat .header .title {
    font-weight: bold;
    font-size: 1.2rem;
}

.chat .header .header-buttons {
    display: flex;
    gap: 12px;
}

.chat .header button {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.chat .header button:hover {
    transform: scale(1.2);
    transition: all 0.3s ease-in-out;
}

/* Chat Body */
.chat .body {
    padding: 10px;
    background: var(--chat-bg);
    overflow-y: auto;
    height: 80vh;
    flex-grow: 1;
    transition: max-height 0.3s ease;
}

.chat .body .msg {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
    padding: 10px;
}

.chat .body .msg .from {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: #ccc;
}

.chat .body .msg.sent .from {
    align-self: flex-start;
}

.chat .body .msg.received .from {
    align-self: flex-end;
}

.chat .body .msg .text {
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    padding: 10px;
    border-radius: 12px;
    background: var(--chat-bg);
    color: var(--text-color);
    word-wrap: break-word;
    user-select: text;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: #393939 #000000;
}

.chat .body .msg.sent .text {
    background: #495057;
    color: white;
    border-radius: 12px 12px 12px 0;
}

.chat .body .msg.received .text {
    background: var(--primary-color);
    color: white;
    border-radius: 12px 12px 0 12px;
}

.chat .body .msg .text:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Chat Footer */
.chat .footer {
    position: absolute;
    bottom: 0px;
    width: 100%;
    display: flex;
    align-items: center;
    padding: 5px;
    background: var(--primary-color);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat .footer textarea {
    flex-grow: 1;
    padding: 5px;
    height: 20px;
    border: var(--border);
    border-radius: 5px;
    background: #2b2d36;
    color: var(--text-color);
    resize: none;
    font-size: 1rem;
    transition: height 0.3s ease;
}

.chat .footer textarea:focus {
    border-color: var(--primary-color);
    height: 60px;
    outline: none;
    box-shadow: 0 0 5px #000000;
}

.chat .footer .footer-buttons {
    display: flex;
    gap: 8px;
    margin: 10px;
}

.chat .footer .footer-buttons button {
    width: 2rem;
    height: 2rem;
    padding: 5px;
    border: none;
    border-radius: 50px;
    background: var(--secondary-color);
    color: white;
    text-align: center;
    font-size: 1.1rem;
    -webkit-transition: all 0.3s ease-in-out;
    -moz-transition: all 0.3s ease-in-out;
    -ms-transition: all 0.3s ease-in-out;
    -o-transition: all 0.3s ease-in-out;
    transition: all 0.3s ease-in-out;
}

.chat .footer .footer-buttons button:hover {
    background-color: var(--primary-color);
}

.chatEmojiPicker {
    position: absolute;
    bottom: 70px;
    right: 10px;
    background: var(--chat-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: none;
    padding: 10px;
}

.chatEmojiPicker.show {
    display: block;
}

/* Responsive for mobile */
@media (max-width: 768px) {
    .chat {
        position: fixed;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border-radius: 10px 10px 0 0;
    }

    .chat .header .title {
        font-size: 1rem;
    }

    .chat .footer textarea {
        height: 35px;
        font-size: 0.9rem;
    }

    .chat .footer .footer-buttons button {
        padding: 10px;
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.3rem;
    }
}
