/* =====================================================
   LINKEDIN STYLE MESSAGING
===================================================== */

.linkedin-messaging {
    position: fixed;
    right: 20px;
    bottom: 60px;
    width: 300px;
    height: 55px;
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.12);
    z-index: 999997;
    overflow: hidden;
    font-family: Arial, sans-serif;
}

.linkedin-messaging.open {
    height: 350px;
}


/* =====================================================
   TOP BAR
===================================================== */

.messaging-topbar {
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    cursor: pointer;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.messaging-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #222;
}

.messaging-title i {
    font-size: 21px;
    color: #0a66c2;
}

.messaging-title .badge {
    font-size: 10px;
    padding: 3px 6px;
}


/* =====================================================
   TOP ACTIONS
===================================================== */

.messaging-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.messaging-actions i {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    font-size: 19px;
    color: #555;
}

.messaging-actions i:hover {
    background: #f2f2f2;
    color: #0a66c2;
}


/* =====================================================
   BODY
===================================================== */

.messaging-body {
    height: calc(100% - 55px);
    display: flex;
    flex-direction: column;
}


/* =====================================================
   USERS
===================================================== */

.messaging-users {
    display: block;
    height: 100%;
    overflow: hidden;
}

.messaging-search {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.messaging-search input {
    width: 100%;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 18px;
    padding: 0 14px;
    outline: none;
    box-sizing: border-box;
    font-size: 13px;
}

.messaging-search input:focus {
    border-color: #0a66c2;
}


/* =====================================================
   USER LIST
===================================================== */

#messagingUserList {
    height: calc(100% - 57px);
    overflow-y: auto;
}

.messaging-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f2f2f2;
    transition: background .15s ease;
}

.messaging-user:hover {
    background: #f5f8fa;
}

.messaging-user img {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    object-fit: cover;
}

.messaging-user-info {
    min-width: 0;
    flex: 1;
}

.messaging-user-name {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.messaging-user-company {
    color: #777;
    font-size: 12px;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* =====================================================
   EMPTY
===================================================== */

.messaging-empty {
    text-align: center;
    padding: 40px 15px;
    color: #777;
    font-size: 13px;
}


/* =====================================================
   CHAT
===================================================== */

.messaging-chat {
    display: none;

    position: fixed;
    right: calc(320px + 12px);
    bottom: 60px;

    width: 300px;
    height: 350px;

    background: #fff;

    border: 1px solid #d9d9d9;
    border-radius: 12px 12px 0 0;

    box-shadow: 0 -2px 18px rgba(0, 0, 0, .18);

    z-index: 999998;

    flex-direction: column;
    overflow: hidden;
}

.messaging-chat-header {
    height: 58px;
    min-height: 58px;

    display: flex;
    align-items: center;

    gap: 10px;
    padding: 8px 12px;

    background: #fff;
    border-bottom: 1px solid #eee;
}

.messaging-chat-header img {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.messaging-chat-user-info {
    flex: 1;
    min-width: 0;
}

.messaging-chat-name {
    font-weight: 600;
    font-size: 14px;
    color: #222;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.messaging-chat-status {
    font-size: 11px;
    color: #777;
    margin-top: 2px;
}


/* =====================================================
   CHAT ACTIONS
===================================================== */

.messaging-chat-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.messaging-chat-actions button {
    width: 32px;
    height: 32px;

    border: none;
    background: transparent;

    border-radius: 50%;
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;
}

.messaging-chat-actions button:hover {
    background: #f2f2f2;
}

.messaging-chat-actions i {
    font-size: 20px;
    color: #555;
}


/* =====================================================
   MESSAGES
===================================================== */

.messaging-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f8f9fa;
}

.messaging-message {
    display: flex;
    margin-bottom: 8px;
}

.messaging-message.sent {
    justify-content: flex-end;
}

.messaging-message.received {
    justify-content: flex-start;
}

.messaging-bubble {
    max-width: 75%;
    padding: 8px 12px;

    border-radius: 15px;

    font-size: 14px;
    word-break: break-word;
}

.messaging-message.sent .messaging-bubble {
    background: #0a66c2;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.messaging-message.received .messaging-bubble {
    background: #fff;
    color: #222;

    border: 1px solid #eee;

    border-bottom-left-radius: 4px;
}

.messaging-time {
    display: block;
    font-size: 9px;
    opacity: .7;
    margin-top: 3px;
}


/* =====================================================
   MESSAGE ACTIONS
===================================================== */

.messaging-message {
    position: relative;
}

.messaging-bubble {
    position: relative;
}

.messaging-message-actions {
    position: absolute;

    top: -42px;
    right: 0;

    display: none;
    align-items: center;

    gap: 3px;

    background: #ffffff;

    border: 1px solid #ddd;

    border-radius: 8px;

    padding: 4px;

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);

    z-index: 100;
}

/* Message hover par actions show */
.messaging-message:hover .messaging-message-actions {
    display: flex;
}

/* Action button */
.message-action-btn {
    width: 32px;
    height: 32px;

    border: none;

    background: transparent;

    border-radius: 6px;

    cursor: pointer;

    display: flex;

    align-items: center;

    justify-content: center;

    font-size: 17px;

    color: #555;
}

/* Hover */
.message-action-btn:hover {
    background: #f2f2f2;
    color: #0a66c2;
}

/* Delete */
.delete-message-btn:hover {
    color: #d11124;
}


/* =====================================================
   SEND FORM
===================================================== */

.messaging-form {
    display: flex;
    gap: 6px;

    padding: 8px;

    border-top: 1px solid #eee;
    background: #fff;
}

.messaging-form input {
    flex: 1;

    border: 1px solid #ddd;
    border-radius: 20px;

    padding: 8px 12px;

    outline: none;
}

.messaging-form input:focus {
    border-color: #0a66c2;
}

.messaging-form button {
    width: 38px;
    height: 38px;

    border: none;
    border-radius: 50%;

    background: #0a66c2;
    color: #fff;

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;
}

.messaging-form button:hover {
    background: #004182;
}

.messaging-form button:disabled {
    opacity: .6;
    cursor: not-allowed;
}


/* =====================================================
   MINIMIZED CHAT
===================================================== */

.messaging-chat.messaging-chat-minimized {
    height: 58px;
}

.messaging-chat.messaging-chat-minimized
.messaging-messages,
.messaging-chat.messaging-chat-minimized
.messaging-form {
    display: none;
}


/* =====================================================
   SETTINGS MODAL
===================================================== */

.messaging-settings-modal {
    display: none;

    position: fixed;
    inset: 0;

    background: rgba(0, 0, 0, .45);

    z-index: 1000000;

    align-items: center;
    justify-content: center;
}

.messaging-settings-box {
    width: 420px;
    max-width: calc(100% - 30px);

    background: #fff;

    border-radius: 12px;

    box-shadow: 0 10px 40px rgba(0, 0, 0, .25);

    overflow: hidden;
}

.messaging-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 16px 18px;

    border-bottom: 1px solid #eee;
}

.messaging-settings-header strong {
    display: block;
    font-size: 16px;
}

.messaging-settings-header small {
    display: block;
    margin-top: 3px;
    color: #777;
    font-size: 12px;
}

.messaging-settings-header button {
    border: none;
    background: transparent;
    cursor: pointer;

    font-size: 22px;
}

.messaging-settings-body {
    padding: 10px 18px;
}

.messaging-setting-option {
    display: flex;
    gap: 12px;

    padding: 14px 0;

    cursor: pointer;

    border-bottom: 1px solid #f1f1f1;
}

.messaging-setting-option input {
    margin-top: 4px;
}

.messaging-setting-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.messaging-setting-text strong {
    font-size: 14px;
}

.messaging-setting-text span {
    font-size: 12px;
    color: #777;
}

.messaging-settings-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;

    padding: 12px 18px;

    border-top: 1px solid #eee;
}

.messaging-settings-footer button {
    padding: 8px 16px;

    border-radius: 6px;

    cursor: pointer;
}

.messaging-settings-cancel {
    border: 1px solid #ddd;
    background: #fff;
}

.messaging-settings-save {
    border: none;
    background: #0a66c2;
    color: #fff;
}


/* =====================================================
   MOBILE
===================================================== */

@media(max-width: 600px) {

    .linkedin-messaging {
        right: 0;
        width: 100%;
        max-width: 350px;
    }

    .messaging-chat {
        right: 0;
        width: 100%;
        max-width: 380px;
    }

    .messaging-settings-box {
        width: calc(100% - 20px);
    }
}

/* =====================================================
   MESSAGING ONLINE DOT
===================================================== */

.messaging-user-avatar {
    position: relative;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
}

.messaging-user-avatar img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.messaging-online-dot {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 11px;
    height: 11px;
    background: #20c997;
    border: 2px solid #fff;
    border-radius: 50%;
}


/* =====================================================
   MESSAGE EMOJI PICKER
===================================================== */

.messaging-emoji-picker {
    display: flex;

    align-items: center;

    gap: 4px;

    background: #fff;

    border: 1px solid #ddd;

    border-radius: 22px;

    padding: 5px 7px;

    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
}

.messaging-emoji-picker button {
    width: 32px;

    height: 32px;

    border: none;

    background: transparent;

    border-radius: 50%;

    cursor: pointer;

    font-size: 19px;

    display: flex;

    align-items: center;

    justify-content: center;
}

.messaging-emoji-picker button:hover {
    background: #f2f2f2;
}

/* =====================================================
   REPLY BOX
===================================================== */

.messaging-reply-box {
    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 10px;

    padding: 8px 12px;

    background: #f3f6f8;

    border-left: 3px solid #0a66c2;

    border-top: 1px solid #eee;
}

.messaging-reply-content {
    min-width: 0;

    flex: 1;
}

.messaging-reply-title {
    font-size: 12px;

    font-weight: 600;

    color: #0a66c2;

    margin-bottom: 2px;
}

.messaging-reply-text {
    font-size: 12px;

    color: #555;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}

.messaging-reply-box > button {
    width: 28px;

    height: 28px;

    border: none;

    background: transparent;

    cursor: pointer;

    border-radius: 50%;

    display: flex;

    align-items: center;

    justify-content: center;
}

.messaging-reply-box > button:hover {
    background: #e5e5e5;
}

/* =====================================================
   REPLIED MESSAGE
===================================================== */

.messaging-replied-message {
    border-left: 3px solid #0a66c2;
    background: rgba(10, 102, 194, 0.08);
    padding: 6px 9px;
    margin-bottom: 7px;
    border-radius: 4px;
    max-width: 100%;
    cursor: pointer;
}

.messaging-replied-name {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.messaging-replied-text {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}