.message-widget {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 80vh;
    overflow: hidden;
    background: #ffffff;
    border-radius: 12px;
}

.message-feed {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background-color: #fcfcfc;
}


.msg-bubble {
    max-width: 85%;
    padding: 0.85rem 1rem;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    animation: fadeIn 0.2s ease-out;
}

.msg-bubble strong {
    display: block;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    opacity: 0.8;
}

.msg-bubble small {
    display: block;
    font-size: 0.7rem;
    margin-top: 0.4rem;
    text-align: right;
    opacity: 0.7;
}

.msg-bubble.sent {
    align-self: flex-end;
    background: #74b72e;
    color: white;
    border-bottom-right-radius: 4px;
}

.msg-bubble.received {
    align-self: flex-start;
    background: #e9e9eb;
    color: #1c1c1e;
    border-bottom-left-radius: 4px;
}

#unread-count {
    display: none;
    background: #e53935;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    position: absolute;
    top: -5px;
    right: -5px;
    border: 2px solid white;
}

.message-form {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    border-top: 1px solid #eee;
    background: white;
    gap: 0.75rem;
}

.message-form input,
.message-form textarea {
    width: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.75rem;
    transition: border-color 0.2s;
}

.message-form input:focus,
.message-form textarea:focus {
    outline: none;
    border-color: #74b72e;
}

.message-dropdown {
    display: none;
    position: absolute;
    top: 120%;
    right: 0;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 1000;
    flex-direction: column;
}

.message-dropdown.show {
    display: flex;
}

@media (max-width: 600px) {
    .message-dropdown.show {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        z-index: 9999;
    }

    .message-widget::before {
        content: "✕ Close";
        display: block;
        padding: 1rem;
        background: #f8f8f8;
        text-align: right;
        font-weight: bold;
        cursor: pointer;
    }

    .msg-bubble {
        max-width: 90%;
    }

    .message-feed {
        padding: 0.75rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}