/* Chat Refactor Styles */

/* Date Separator */
.chat-date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px 0;
    position: relative;
    width: 100%;
}

.chat-date-separator span {
    background-color: rgba(0, 0, 0, 0.2);
    color: #fff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    z-index: 1;
}

/* Base Message Item Structure */
.message-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 2px !important;
    /* Forced minimal margin to override global style.css */
    position: relative;
    max-width: 90% !important;
    clear: both;
}

.chat-popup-container,
.chat-popup-header,
.chat-popup-window {
    border-radius: 5px 5px 0 0 !important;
}

.chat-popup-window {
    border: 1px solid #000 !important;
}

.chat-popup-window .chat-friend-avatar-container .chat-friend-avatar {
    border: 2px solid #fff !important;
    box-sizing: border-box;
}

.chat-popup-header {
    max-height: 46px;
    padding-right: 5px !important;
    padding-left: 5px !important;
    background-color: #77e !important;
}

.control-btn {
    border-radius: 50% !important;
    width: 25px !important;
    height: 25px !important;
    padding: 0 !important;
    font-weight: 800 !important;
    margin: 0 !important;
}

/* Removed redundant card styling from .chat-popup-message to eliminate extra white borders */
.chat-popup-message {
    background-color: transparent !important;
    border: none !important;
}

.message-item.sent {
    float: right;
    align-items: flex-end;
}

.message-item.received {
    float: left;
    align-items: flex-start;
}

/* Message Content Bubble */
.message-content {
    padding: 8px 12px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    max-width: 100%;
    font-size: 14px;
    line-height: 1.4;
}

.message-item.sent .message-content {
    background-color: #7799ff;
    color: white;
    border-bottom-right-radius: 4px;
}

.message-item.received .message-content {
    background-color: #f0f0f0;
    color: #333;
    border-bottom-left-radius: 4px;
}

/* Image Message */
.message-content.image-message {
    padding: 0;
    background: transparent !important;
    overflow: hidden;
}

.chat-image {
    display: block;
    max-width: 200px;
    border-radius: 18px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.chat-image:hover {
    opacity: 0.9;
}

/* Timestamp outside bubble */
.chat-message-time {
    font-size: 10px;
    color: #999;
    margin-top: 2px;
    margin-bottom: 0px !important;
    /* Add space after time */
    opacity: 0.8;
    padding: 0 4px;
    display: none;
    /* Hidden by default, shown via JS */
}

.message-item.sent .chat-message-time {
    text-align: right;
}

.message-item.received .chat-message-time {
    text-align: left;
}

/* Show time when active */
.chat-message-time.visible {
    display: block;
}

/* Reaction positioning */
.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-top: -8px;
    margin-bottom: 4px;
    z-index: 2;
    position: relative;
}

.message-item.sent .message-reactions {
    justify-content: flex-end;
    margin-right: 8px;
}

.message-item.received .message-reactions {
    justify-content: flex-start;
    margin-left: 8px;
}

.reaction-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Group Chat Sender Name */
.group-message-sender {
    font-size: 11px;
    color: #666;
    margin-bottom: 2px;
    margin-left: 12px;
    font-weight: 500;
}

/* Message Actions - Forced Light Grey Background */
.message-actions {
    background-color: #f0f2f5 !important;
    border-radius: 20px !important;
    padding: 2px 6px !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) !important;
    display: flex;
    align-items: center;
    gap: 4px;
    border: 1px solid #e4e6eb !important;
    position: absolute;
    top: -36px;
    /* Moved higher per user layout preference */
    right: 0;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}


/* Specific Button Styles for Light Background */
.message-action-btn {
    background: #ffffff !important;
    border: 1px solid #e4e6eb !important;
    color: #050505 !important;
    font-size: 14px !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    cursor: pointer;
    padding: 0;
}

.message-action-btn:hover {
    background-color: #e4e6eb !important;
    transform: scale(1.1);
    color: #000 !important;
}