/* --- /static/css/mensageiro.css --- Mensageiro interno (chat) --- */

.msg-bubble-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--teal), var(--cyan-neon));
    color: #fff;
    border: none;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 2000;
    transition: transform 0.15s ease;
}

.msg-bubble-btn:hover {
    transform: scale(1.06);
}

.msg-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: var(--red);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 2px var(--bg-body);
}

.msg-badge.hidden {
    display: none;
}

.msg-panel {
    position: fixed;
    bottom: 94px;
    right: 24px;
    width: 380px;
    height: 600px;
    max-height: 72vh;
    background: var(--bg-sidebar);
    backdrop-filter: blur(14px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1999;
    color: var(--text-primary);
}

.msg-panel.open {
    display: flex;
}

.msg-root.full .msg-panel {
    position: static;
    display: flex;
    width: 100%;
    height: 78vh;
    max-height: none;
    bottom: auto;
    right: auto;
    border-radius: 14px;
}

.msg-root.full {
    display: flex;
    gap: 0;
}

.msg-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.msg-header h3 {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.msg-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.msg-icon-btn:hover {
    background: rgba(0, 210, 211, 0.12);
    color: var(--cyan-neon);
}

.msg-search {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.msg-search input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.msg-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.msg-empty {
    padding: 30px 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.msg-conversa-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.12s;
}

.msg-conversa-item:hover,
.msg-conversa-item.ativa {
    background: rgba(0, 210, 211, 0.08);
}

.msg-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.msg-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
}

.msg-avatar.grupo {
    background: linear-gradient(135deg, var(--orange), var(--red));
}

.msg-online-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--green);
    border: 2px solid var(--bg-sidebar);
    display: none;
}

.msg-online-dot.on {
    display: block;
}

.msg-conversa-info {
    flex: 1;
    min-width: 0;
}

.msg-conversa-nome {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.msg-conversa-hora {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.msg-conversa-preview {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 5px;
}

.msg-conversa-unread {
    background: var(--cyan-neon);
    color: #022;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 7px;
    flex-shrink: 0;
}

.msg-view {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.msg-view.ativa {
    display: flex;
}

.msg-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    cursor: pointer;
}

.msg-chat-header-info {
    flex: 1;
    min-width: 0;
}

.msg-chat-header-nome {
    font-weight: 700;
    font-size: 0.95rem;
}

.msg-chat-header-status {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.msg-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.msg-dia-sep {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.7rem;
    margin: 10px 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.msg-row {
    display: flex;
    margin: 3px 0;
    group: msg;
}

.msg-row.mine {
    justify-content: flex-end;
}

.msg-bubble {
    max-width: 78%;
    padding: 7px 11px 8px;
    border-radius: 14px;
    font-size: 0.86rem;
    line-height: 1.35;
    position: relative;
    word-wrap: break-word;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.msg-row.mine .msg-bubble {
    background: linear-gradient(135deg, var(--teal), rgba(0, 210, 211, 0.55));
    color: #fff;
    border: none;
}

.msg-autor {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--cyan-neon);
    margin-bottom: 2px;
}

.msg-reply-ref {
    font-size: 0.72rem;
    opacity: 0.8;
    border-left: 2px solid currentColor;
    padding-left: 6px;
    margin-bottom: 4px;
    display: block;
}

.msg-meta {
    font-size: 0.65rem;
    opacity: 0.75;
    margin-top: 3px;
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: flex-end;
}

.msg-anexo-img {
    max-width: 220px;
    border-radius: 10px;
    display: block;
    margin-top: 2px;
    cursor: pointer;
}

.msg-anexo-arquivo {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    text-decoration: underline;
}

.msg-apagada {
    opacity: 0.6;
    font-style: italic;
}

.msg-actions {
    position: absolute;
    top: -10px;
    right: 6px;
    display: none;
    gap: 2px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2px;
}

.msg-row:hover .msg-actions {
    display: flex;
}

.msg-actions button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 3px 5px;
}

.msg-actions button:hover {
    color: var(--cyan-neon);
}

.msg-digitando {
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0 14px 4px;
    font-style: italic;
    min-height: 16px;
}

.msg-reply-bar {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(0, 210, 211, 0.08);
    border-top: 1px solid var(--border-color);
    font-size: 0.78rem;
}

.msg-reply-bar.show {
    display: flex;
}

.msg-reply-bar span {
    flex: 1;
    opacity: 0.85;
}

.msg-input-bar {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 10px 12px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.msg-input-bar textarea {
    flex: 1;
    resize: none;
    max-height: 90px;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-primary);
    padding: 9px 14px;
    font-size: 0.86rem;
    font-family: inherit;
}

.msg-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--cyan-neon);
    color: #022;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.msg-send-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.msg-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2100;
}

.msg-modal-overlay.open {
    display: flex;
}

.msg-modal {
    width: 360px;
    max-height: 80vh;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: var(--text-primary);
}

.msg-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.msg-modal-footer {
    padding: 10px 14px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.msg-user-pick {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    cursor: pointer;
}

.msg-user-pick:hover {
    background: rgba(0, 210, 211, 0.08);
}

.msg-user-pick input {
    accent-color: var(--cyan-neon);
}

.msg-group-name-input {
    margin: 10px 14px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-primary);
    width: calc(100% - 28px);
    display: none;
}

.msg-group-name-input.show {
    display: block;
}

.msg-toast {
    position: fixed;
    bottom: 110px;
    right: 24px;
    width: 300px;
    background: var(--bg-card);
    border: 1px solid var(--cyan-neon);
    border-radius: 12px;
    padding: 10px 14px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    z-index: 2050;
    cursor: pointer;
    color: var(--text-primary);
    animation: msgToastIn 0.25s ease;
}

@keyframes msgToastIn {
    from {
        transform: translateY(12px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.msg-toast strong {
    color: var(--cyan-neon);
}

.msg-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.msg-list::-webkit-scrollbar,
.msg-messages::-webkit-scrollbar,
.msg-modal-body::-webkit-scrollbar {
    width: 6px;
}

.msg-list::-webkit-scrollbar-thumb,
.msg-messages::-webkit-scrollbar-thumb,
.msg-modal-body::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

@media (max-width: 480px) {
    .msg-panel {
        right: 10px;
        left: 10px;
        width: auto;
        bottom: 84px;
    }

    .msg-bubble-btn {
        right: 16px;
        bottom: 16px;
    }
}
