.message-icon {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: all 0.3s;
}
.message-icon:hover {
    background: rgba(78, 205, 196, 0.2);
    transform: scale(1.05);
}
.message-icon .envelope-icon {
    font-size: 1.2rem;
}
.message-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #1a1a2e;
    z-index: 10;
}
.message-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    width: 400px;
    max-width: 90vw;
    max-height: 500px;
    background: #1a1a2e;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    border: 1px solid #4ecdc4;
    z-index: 9999;
    overflow: hidden;
}
.message-dropdown::before {
    content: "";
    position: absolute;
    top: -8px;
    right: 15px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #1a1a2e;
}
.message-dropdown.show {
    display: block;
    animation: slideDown 0.2s ease;
}
.message-header {
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.message-header h4 {
    margin: 0;
    font-size: 1rem;
    color: #4ecdc4;
}
.message-header .view-all-link {
    font-size: 0.7rem;
    color: #888;
    cursor: pointer;
    text-decoration: none;
}
.message-header .view-all-link:hover {
    color: #4ecdc4;
}
.message-list {
    max-height: 350px;
    overflow-y: auto;
}
.message-conversation-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.2s;
    gap: 10px;
}
.message-conversation-item:hover {
    background: rgba(78, 205, 196, 0.1);
}
.message-conversation-item.unread {
    background: rgba(78, 205, 196, 0.05);
    border-left: 3px solid #4ecdc4;
}
.message-conversation-item .conv-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.message-conversation-item .conv-info {
    flex: 1;
    min-width: 0;
}
.message-conversation-item .conv-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
}
.message-conversation-item .conv-last-msg {
    font-size: 0.8rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.message-conversation-item .conv-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
}
.message-conversation-item .conv-badge {
    background: #4ecdc4;
    color: #1a1a2e;
    font-size: 0.65rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}
.message-conversation-item .conv-time {
    font-size: 0.6rem;
    color: #666;
    margin-top: 2px;
}
.empty-messages {
    padding: 30px;
    text-align: center;
    color: #888;
}
.message-chat-view {
    display: none;
    flex-direction: column;
    height: 420px;
}
.message-chat-header {
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}
.message-chat-header .back-btn {
    background: none;
    border: none;
    color: #4ecdc4;
    font-size: 1.2rem;
    cursor: pointer;
    display: none;
}
.message-chat-header .back-btn:hover {
    color: #45b7ae;
}
.message-chat-header .chat-title {
    font-weight: 600;
    color: white;
}
.message-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.message-bubble {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 80%;
    animation: slideUp 0.2s ease;
}

.message-bubble .msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    margin-top: 2px;
}

.message-bubble .msg-content {
    padding: 6px 12px;
    max-width: 100%;
    word-wrap: break-word;
    white-space: pre-wrap;
    min-width: 30px;
    line-height: 1.3;
}

.message-bubble .msg-text {
    font-size: 0.85rem;
    line-height: 1.3;
}

.message-bubble .msg-time {
    font-size: 0.55rem;
    margin-top: 1px;
    text-align: right;
    opacity: 0.7;
}

.message-bubble.theirs {
    align-self: flex-start;
    flex-direction: row;
}

.message-bubble.theirs .msg-content {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border-radius: 12px 12px 12px 4px;
}

.message-bubble.theirs .msg-time {
    color: #888;
}

.message-bubble.mine {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-bubble.mine .msg-content {
    background: #4ecdc4;
    color: #1a1a2e;
    border-radius: 12px 12px 4px 12px;
}

.message-bubble.mine .msg-time {
    color: rgba(26, 26, 46, 0.7);
}

.message-chat-input {
    display: flex;
    gap: 10px;
    padding: 10px 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.message-chat-input input {
    flex: 1;
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 0.85rem;
    height: 36px;
}
.message-chat-input input:focus {
    outline: none;
    border-color: #4ecdc4;
}
.message-chat-input input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.message-chat-input .send-btn {
    background: #4ecdc4;
    border: none;
    color: #1a1a2e;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.message-chat-input .send-btn:hover {
    transform: scale(1.05);
    background: #45b7ae;
}
.message-chat-input .send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}
.loading-messages {
    text-align: center;
    color: #888;
    padding: 20px;
}
.msg-avatar-link-profile {
	display: inline-block !important;
	padding: 0 !important;
	margin: 0 !important;
	line-height: 0 !important;
	text-decoration: none !important;
	background: transparent !important;
	border: none !important;
	border-radius: 0 !important;
	font-size: 0 !important;
	width: auto !important;
	height: auto !important;
	min-width: 0 !important;
	min-height: 0 !important;
}
.msg-avatar-link-profile .msg-avatar {
	cursor: pointer;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	display: block;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 768px) {
    .message-dropdown {
        width: 320px;
        right: -20px;
    }
    .message-icon {
        width: 36px;
        height: 36px;
    }
    .message-icon .envelope-icon {
        font-size: 1rem;
    }
    .message-bubble {
        max-width: 90%;
    }
    .message-chat-messages {
        padding: 10px 12px;
        gap: 5px;
    }
}
@media (max-width: 480px) {
    .message-dropdown {
        width: 280px;
        right: -40px;
    }
    .message-icon {
        width: 32px;
        height: 32px;
    }
    .message-icon .envelope-icon {
        font-size: 0.9rem;
    }
    .message-chat-view {
        height: 380px;
    }
    .message-bubble {
        max-width: 95%;
    }
    .message-bubble .msg-content {
        padding: 4px 10px;
    }
    .message-bubble .msg-text {
        font-size: 0.8rem;
    }
    .message-bubble .msg-avatar {
        width: 22px;
        height: 22px;
        margin-top: 1px;
    }
    .message-chat-input {
        padding: 8px 12px;
        gap: 8px;
    }
    .message-chat-input input {
        height: 32px;
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    .message-chat-input .send-btn {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
    .message-chat-messages {
        padding: 8px 10px;
        gap: 4px;
    }
}