﻿/*======================================
    Contenedor principal
======================================*/

.message-viewer {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 165px);
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 5px rgba(0,0,0,.08);
}

    .message-viewer > .row {
        height: 100%;
        flex: 1;
    }

.message-conversations {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.message-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: #f8f9fb;
}

@media(max-width:767.98px) {

    .message-viewer {
        height: calc(100vh - 140px);
        margin: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
    }
}

/*======================================
    Lista de conversaciones
======================================*/

.message-list {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
}

.message-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    padding: 0 1rem;
    border-bottom: 1px solid #e9ecef;
    background: #fff;
    flex-shrink: 0;
}

    .message-list-header strong {
        font-size: 1rem;
        color: #495057;
    }

.message-list-body {
    flex: 1;
    overflow-y: auto;
}

/*======================================
    Contacto
======================================*/

.message-contact {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .9rem 1rem;
    cursor: pointer;
    transition: .18s;
    border-bottom: 1px solid #f3f3f3;
}

    .message-contact:hover {
        background: #f8f9fa;
    }

    .message-contact.active {
        background: rgba(var(--bs-primary-rgb), .10);
    }

/*======================================
    Avatar
======================================*/

.message-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    /* background: linear-gradient( 180deg, #2058b2 0%, var(--bs-primary) 100%); */
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .message-avatar span {
        font-size: 1.35rem;
    }

/*======================================
    Información del contacto
======================================*/

.message-info {
    flex: 1;
    min-width: 0;
}

.message-info-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .5rem;
}

    .message-info-header strong {
        color: #343a40;
        font-size: .92rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

.message-date {
    font-size: .72rem;
    color: #adb5bd;
    white-space: nowrap;
}

.message-last {
    color: #6c757d;
    font-size: .82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
/*======================================
    Scroll
======================================*/

.message-list-body::-webkit-scrollbar {
    width: 7px;
}

.message-list-body::-webkit-scrollbar-thumb {
    background: #d2d2d2;
    border-radius: 20px;
}

    .message-list-body::-webkit-scrollbar-thumb:hover {
        background: #bcbcbc;
    }

/*======================================
    Responsive
======================================*/

@media(max-width:991.98px) {

    .message-list-header {
        min-height: 58px;
    }

    .message-contact {
        padding: .8rem .9rem;
    }

    .message-avatar {
        width: 48px;
        height: 48px;
    }
}

/*======================================
    Panel conversación
======================================*/

.message-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    padding: 0 1.5rem;
    background: white;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.message-back {
    border: none;
    background: none;
    color: var(--bs-primary);
    font-size: 1.35rem;
    padding: 0;
    margin-right: .25rem;
}

.message-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: #f5f7fb;
}

@media(max-width:991.98px) {

    .message-header {
        min-height: 60px;
        padding: 0 1rem;
    }

    .message-body {
        padding: 1rem;
    }
}

/*======================================
    Mensajes
======================================*/

.message-row {
    display: flex;
    margin-bottom: 1rem;
}

    .message-row.received {
        justify-content: flex-start;
    }

    .message-row.sent {
        justify-content: flex-end;
    }

.message-bubble {
    max-width: 70%;
    padding: .8rem 1rem;
    border-radius: 16px;
    position: relative;
    word-break: break-word;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.message-row.received .message-bubble {
    background: white;
    color: #343a40;
}

.message-row.sent .message-bubble {
    background: var(--bs-primary);
    color: white;
}

.message-date-bubble {
    margin-top: .4rem;
    font-size: .70rem;
    opacity: .75;
    text-align: right;
    margin-bottom: -.5rem;
}

.message-body::-webkit-scrollbar {
    width: 8px;
}

.message-body::-webkit-scrollbar-thumb {
    background: #d4d4d4;
    border-radius: 20px;
}

    .message-body::-webkit-scrollbar-thumb:hover {
        background: #bfbfbf;
    }

.message-status {
    display: inline-flex;
    align-items: center;
    margin-left: .25rem;
    font-size: .88rem;
    line-height: 1;
}

    .message-status.status-pending {
        opacity: .75;
    }

    .message-status.status-sent {
        opacity: .85;
    }

    .message-status.status-delivered {
        opacity: .85;
    }

    .message-status.status-read {
        color: #79fd84;
    }

    .message-status.status-error {
        color: #ffb3b3;
    }
