.message-widget {
    display: flex;
    flex-direction: column;
    height: 460px;
    overflow: hidden;
}

.message-feed {
    flex: 1;
    overflow-y: auto;
    padding-right: 6px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.msg-bubble {
    max-width: 80%;
    padding: 0.75rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.3;
    word-wrap: break-word;
    position: relative;
    animation: fadeIn 0.3s ease;
}

.msg-bubble.sent {
    align-self: flex-end;
    background: #74b72e;
    color: white;
}

.msg-bubble.received {
    align-self: flex-start;
    background: #f1f1f1;
    color: #222;
}

.message-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.message-form input,
.message-form textarea {
    font-family: inherit;
    font-size: 0.85rem;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    resize: none;
}

.message-form textarea {
    min-height: 60px;
    max-height: 100px;
}

.message-form button {
    align-self: flex-end;
    padding: 0.5rem 1rem;
    font-weight: 600;
    background-color: #74b72e;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.message-form button:hover {
    background-color: #74b72e;
}

.message-button {
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    padding: 0.5rem;
}

.message-button:hover .icon-envelope {
    background-color: #74b72e;
    border-radius: 50%;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 0 0 3px rgba(116, 183, 46, 0.2);
    transition: all 0.25s ease;
}

.message-button.spinning .icon-envelope {
    animation: spin 1s linear infinite;
}

.message-notifier {
    position: relative;
    display: inline-block;
}

.message-dropdown {
    display: none;
    position: absolute;
    top: 110%;
    right: 0;
    width: 360px;
    max-height: 500px;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #ccc;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
    z-index: 999;
    transition: opacity 0.2s ease;
    max-inline-size: min(360px, 100vw - 1rem);
    overflow-wrap: break-word;
}


.message-dropdown.show {
    display: block;
    opacity: 1;
}


.badge {
    position: absolute;
    top: 0;
    right: 0;
    transform: translate(50%, -50%);
    background: crimson;
    color: white;
    font-size: 0.7rem;
    padding: 2px 5px;
    border-radius: 50%;
    font-weight: 600;
}

.icon-envelope {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-right: 0.25rem;
    color: white;
    position: relative;
}

#unread-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background: crimson;
    color: white;
    font-size: 0.65rem;
    border-radius: 50%;
    padding: 2px 5px;
    min-width: 16px;
    text-align: center;
    display: none;
}
