CONSEGUE AUMENTAR O ESPAÇO VERTICAL ENTRE AS MENSAGENS PARA FICAREM SEPARADAS 
E COLOCAR AS MENSAGENS RECEBIDAS À ESQUERDA E AS ENVIADAS À DIREITA E ME DEVOLVER O CSS?

/* ======== RESET E CONFIGURAÇÕES GERAIS ======== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {              
    background: linear-gradient(to bottom, #0099FF 0%, #66C2FF 50%, #FFFFFF 100%);

background:
    linear-gradient(90deg, #00CCFF, WHITE, #9999FF);
    background-size: 400% 400%;
    animation: plasma 8s ease-in-out infinite;

    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}


@keyframes plasma {
  0%   { background-position:   0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position:   0% 50%; }
}

.container {
    width: 100%;
    max-width: 1200px;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    border-radius: 14px;
}

.header {
    border-radius: 20px;
    background: linear-gradient(135deg, #87CEEB 0%, #000080 50%, #008000 75%, #FF0000 100%);
    color: white;
    padding: 25px;
    text-align: center;
    border-radius: 14px;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.main-content {
    display: flex;
    flex-wrap: wrap;
    padding: 30px;
    gap: 30px;
}

.card {
    flex: 1;
    min-width: 300px;
    background-color: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid #eaeaea;
}

.card h2 {
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border 0.3s;
}

.form-group input:focus {
    border-color: #2575fc;
    outline: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(to right, #2575fc, #6a11cb);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 117, 252, 0.4);
}

.btn-secondary {
    background-color: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background-color: #e0e0e0;
}

.btn-danger {
    background-color: #ff4757;
    color: white;
}

.btn-danger:hover {
    background-color: #ff3742;
}

.success-message {
    background-color: #e8f7ef;
    border: 1px solid #a3e9b4;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.success-message h3 {
    color: #2a8c4a;
    margin-bottom: 15px;
}

.success-message p {
    margin-bottom: 10px;
}

.error-message {
    background-color: #ffeaea;
    border: 1px solid #ffb8b8;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    color: #d32f2f;
}

.hidden {
    display: none !important;
}

.footer {
    text-align: center;
    padding: 20px;
    color: #666;
    border-top: 1px solid #eee;
    background-color: #f9f9f9;
}

/* ======== LAYOUT DA SALA ======== */
.room-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 90vw;
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid #007bff;
    box-shadow: 0 4px 8px rgba(000, 0, 0, 0.35) !important;
    MARGIN-TOP: -4px !important;

}

.room-header {
    background: #003366 !important;
    background-COLOR: #003366 !important;
    color: white;
    width: 90vw !important;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    z-index: 100;
    border-radius: 14px;
}

.room-info h2 {
    font-size: 1.4rem;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-code {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    opacity: 0.9;
}

.room-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.room-content {
    flex: 1;
    display: flex;
    overflow: hidden;
    background: TRANSPARENT !important;
}

.chat-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: TRANSPARENT !important;
    transition: all 0.3s ease;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 8px rgba(000, 0, 0, 0.35) !important;
    MAX-WIDTH: 85% !important;

    MARGIN-LEFT: +10px !important;
    MARGIN-RIGHT: +10px !important;
    MARGIN-TOP: 12px !important;
    MARGIN-BOTTOM: 10px !important;
    BORDER-RADIUS: 10px;
    border: 2px solid #007bff;
}

/* ======== MENSAGENS: ALINHAMENTO, LARGURA, EFEITO DE LUZ E ESPAÇAMENTO ======== */
.message-wrapper {
    display: flex;
    margin-bottom: 50px; /* ~0.5 cm adicional de espaçamento vertical */
    animation: messageAppear 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.message-wrapper.received {
    justify-content: flex-start;
}

.message-wrapper.sent {
    justify-content: flex-end;
}

.message {
    padding: 15px 18px;
    word-wrap: break-word;
    position: relative;
    border-radius: 15px;
    max-width: 85%;
    width: fit-content;
    min-width: 60px; /* evita colapso em mensagens mínimas */
}

/* === Mensagem RECEBIDA (esquerda) === */
.message-received {
    background: rgba(234, 234, 234, 0.6);
    color: #333;
    border: 2px solid #ccc;
    border-top-left-radius: 2px;
    border-bottom-left-radius: 2px;
    border-top-right-radius: 15px;
    border-bottom-right-radius: 15px;
    box-shadow: 0 6px 20px rgba(180, 180, 180, 0.25);
}

.message-received::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 20px;
    width: 0;
    height: 0;
    border: 10px solid transparent;
    border-top-color: #ccc;
    border-left-color: #ccc;
    transform: rotate(-45deg);
    margin-left: -2px;
}

/* === Mensagem ENVIADA (direita) === */
.message-sent {
    background: rgba(0, 123, 255, 0.1);
    color: #000;
    border: 2px solid #007bff;
    border-top-right-radius: 2px;
    border-bottom-right-radius: 2px;
    border-top-left-radius: 15px;
    border-bottom-left-radius: 15px;
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.35);
}

.message-sent::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 20px;
    width: 0;
    height: 0;
    border: 10px solid transparent;
    border-top-color: #007bff;
    border-right-color: #007bff;
    transform: rotate(45deg);
    margin-right: -2px;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ======== PREVIEW - ESTILOS UNIFICADOS ======== */
.preview-container {
    display: flex;

    flex-direction: column;
    max-width: 100%;
    min-width: 100% !important;
    max-height: 100%;
    width: 100%  !important;
    height: 100% !important;

    justify-content: center !important;
    align-items: center !important;

    padding: 16px;
    border-radius: 15px !important;
    box-shadow: 0 6px 18px rgba(0, 123, 255, 0.15);
    background: transparent !important;
}

.image-preview img,
.video-preview video,
.file-preview,
.pdf-preview,
#audioWaveform,
#recordedWaveform,
#liveVideoPreview,
.audio-player,
.video-player {

    max-width: 100%;
    max-height: 100%;
    width: 100%  !important;
    height: 100% !important;

    object-fit: contain;

    justify-content: center !important;
    align-items: center !important;

    border-radius: 15px !important;
    box-shadow: 0 6px 18px rgba(0, 123, 255, 0.15);
    background: transparent !important;
    display: block;
}

.image-preview img,
.video-preview video {

    max-width: 90%;
    max-height: 90%;
    width: 90%  !important;
    height: 90% !important;

    object-fit: contain;

    justify-content: center !important;
    align-items: center !important;

    border-radius: 15px !important;
    box-shadow: 0 6px 18px rgba(0, 123, 255, 0.15);
    background: transparent !important;
}

.file-preview {
    max-height: 200px;
    width: 95%  !important;
    height: 100% !important;

    object-fit: contain;

    justify-content: center !important;
    align-items: center !important;

    padding: 0px;
    border-radius: 15px !important;
    background: transparent !important;
    border: 2px solid #007bff !important;
}

.pdf-preview-wrapper {
    width: 100%;
    height: 600px;
    max-width: 90%;
    margin: 0 auto;
}

.pdf-preview {
    width: 100%;
    height: 100%;
}

.audio-preview-wrapper {
    width: 100%;
    max-width: 90%;
    padding: 30px;
    background: rgba(0, 123, 255, 0.05);
    border: 2px solid #007bff;
    border-radius: 15px;
    text-align: center;
    margin: 0 auto;
    box-shadow: 0 6px 18px rgba(0, 123, 255, 0.15);
}

.audio-icon {
    font-size: 3rem;
    color: #007bff;
    margin-bottom: 15px;
}

.recording-info {
    background: rgba(0, 123, 255, 0.05);
    border: 2px solid #007bff;
    padding: 15px;
    border-radius: 15px;
    margin-top: 15px;
    max-width: 90%;
    margin: 15px auto 0;
}

.recording-info p {
    margin: 5px 0;
    color: #333;
}

.file-preview-placeholder {
    text-align: center;
    padding: 40px;
    background: rgba(0, 123, 255, 0.03);
    border: 2px dashed #007bff;
    border-radius: 15px;
    margin: 20px auto;
    max-width: 90%;
    color: #555;
}

/* ======== PRÉ-VISUALIZAÇÕES AO VIVO ======== */
.live-audio-preview,
.live-video-preview,
.mobile-video-preview,
.mobile-audio-preview {
    max-width: 100%;
    margin: 0 auto;
    text-align: center;
}

.live-audio-preview {
    padding: 30px;
    background: rgba(0, 123, 255, 0.08);
    border: 2px solid #007bff;
    border-radius: 15px;
    color: #111;
    box-shadow: 0 6px 18px rgba(0, 123, 255, 0.15);
}

#liveVideoPreview {
    width: 100%;
    max-height: 400px;
    display: block;
    background: #000;
}

.recording-indicator,
.recording-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #007bff;
    color: white;
    padding: 5px 15px;
    border-radius: 15px;
    font-weight: bold;
}

.recording-dot {
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    animation: blink 1s infinite;
}

.recording-text {
    font-weight: bold;
    font-size: 0.9rem;
}

/* ======== GRÁFICOS DE ÁUDIO ======== */
.audio-visualizer,
.mobile-visualizer,
.audio-preview-wave,
.audio-wave-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 100px;
    gap: 5px;
    margin: 20px 0;
    width: 100%;
    max-width: 90%;
}

.audio-bar,
.mobile-bar,
.wave-bar {
    width: 10px;
    background: linear-gradient(to top, #007bff, #4dabf7);
    border-radius: 15px;
    transition: height 0.1s ease;
}

.wave-bar {
    animation: wave 1.5s ease-in-out infinite;
    height: 20px;
}

.wave-bar:nth-child(n) {
    animation-delay: calc(0.1s * (var(--n) - 1));
}

/* ======== CONTAINERS E INPUTS ======== */
.file-preview-container {
    margin: 12px 0;

    max-width: 100%;
    min-width: 100% !important;
    max-height: 100%;
    width: 100%  !important;
    height: 100% !important;

    justify-content: center !important;
    align-items: center !important;

    border-radius: 15px;
    overflow: hidden;
    background: transparent !important;
    border: none;
}

.chat-input {
    padding: 20px;
    background: TRANSPARENT;
    border-top: 1px solid #eaeaea;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.05);
    flex-shrink: 0;
    border-TOP: 1px solid #007bff !important;
}

.input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.input-group input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid RED !important;
    border-radius: 25px;
    font-size: 16px;
    transition: all 0.3s;
    background: TRANSPARENT;
    border-bottom: 2px solid #007bff !important;
}

.input-actions {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;   
    BORDER-RADIUS: 20px !important;  
    border-bottom: 4px solid #007bff !important;

}

.input-group input:focus {
    border: 2px solid #007bff;
    background: WHITE;

    box-shadow: 0 0 0 4px rgba(37, 117, 252, 0.15);
    outline: none;
}

.action-btn {
    padding: 8px 18px;
    border-radius: 25px;   
    background: transparent;     
    border: 2px solid #007bff;   
    color: #333;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px !important;
    font-size: 0.95rem;
    font-weight: 500;
}

.action-btn:hover {
    background: linear-gradient(135deg, #e8e8e8 0%, #ddd 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.action-btn.btn-primary {
    background: linear-gradient(135deg, #2575fc 0%, #6a11cb 100%);
    color: white;
}

.action-btn.btn-primary:hover {
    background: linear-gradient(135deg, #1c6ae4 0%, #5a0fb8 100%);
    box-shadow: 0 4px 15px rgba(37, 117, 252, 0.3);
}

/* ======== MODAL DE VIDEOCHAMADA ======== */
.video-call-modal {
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    padding: 0;
    overflow: hidden;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.video-call-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.video-call-header h3 {
    margin: 0;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.video-call-body {
    display: flex;
    flex-direction: column;
    height: calc(90vh - 80px);
    padding: 20px;
}

.video-container {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    overflow: auto;
    padding: 10px;
    margin-bottom: 20px;
}

.video-box {
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.video-box:hover {
    transform: translateY(-5px);
}

.video-box video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-label {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    backdrop-filter: blur(5px);
}

.local-video {
    border: 3px solid #2575fc;
}

/* ======== ANIMAÇÕES ======== */
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes wave {
    0%, 100% { height: 20px; }
    50% { height: 80px; }
}

/* ======== RESPONSIVIDADE ======== */
@media (max-width: 1024px) {
    .video-container {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .room-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    .room-actions {
        width: 100%;
        justify-content: center;
    }
    .room-content {
        flex-direction: column;
    }
    .messages-container {
        padding: 15px;
    }
    .message {
        max-width: 90%;
        padding: 12px 15px;
    }
    .message-sent::after,
    .message-received::after {
        bottom: -8px;
        border-width: 8px;
    }
    .preview-container,
    .image-preview img,
    .video-preview video,
    .audio-preview-wrapper,
    .pdf-preview-wrapper,
    .live-audio-preview,
    .live-video-preview {
     max-width: 100%;
    }
}

@media (max-width: 480px) {
    .room-info h2 {
        font-size: 1.2rem;
    }
    .messages-container {
        padding: 12px;

    }
    .message {
        padding: 10px 12px;
        max-width: 95%;
    }
    .message-sent::after,
    .message-received::after {
        bottom: -7px;
        border-width: 7px;
    }
    .preview-container,
    .image-preview img,
    .video-preview video,
    .audio-preview-wrapper,
    .pdf-preview-wrapper,
    .live-audio-preview,
    .live-video-preview {
     max-width: 100%;
     padding: 0 8px;
    }
    .audio-bar,
    .mobile-bar,
    .wave-bar {
     border-radius: 10px;
    }
}


/* ======== MENSAGENS: CONTAINER ======== */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    display: flex;
    flex-direction: column;
    gap: 26px; /* ESPAÇAMENTO VERTICAL ENTRE MENSAGENS */
}

/* ======== WRAPPER DAS MENSAGENS ======== */
.message-wrapper {
    display: flex;
    width: 100%;
    animation: messageAppear 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* RECEBIDAS → ESQUERDA */
.message-wrapper.received {
    justify-content: flex-start;
}

/* ENVIADAS → DIREITA */
.message-wrapper.sent {
    justify-content: flex-end;
}

/* ======== MENSAGEM BASE ======== */
.message {
    padding: 15px 18px;
    word-wrap: break-word;
    position: relative;
    border-radius: 15px;
    max-width: 75%;
    min-width: 60px;
    line-height: 1.5;
}

/* ======== MENSAGEM RECEBIDA ======== */
.message-received {
    background: rgba(234, 234, 234, 0.65);
    color: #333;
    border: 2px SOLID #00CC00;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.35);
    background: transparent !important;
}

/* SETA RECEBIDA */
.message-received::after {
    content: '';
    position: absolute;
    left: -8px;
    bottom: 12px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid #00CC00;
    background: transparent !important;
}

/* ======== MENSAGEM ENVIADA ======== */
.message-sent {
    background: rgba(0, 123, 255, 0.12);
    color: #000;
    border: 2px SOLID #007bff;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.35);
    background: transparent !important;
}

/* SETA ENVIADA */
.message-sent::after {
    content: '';
    position: absolute;
    right: -8px;
    bottom: 12px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 8px solid #007bff;
    background: transparent !important;
}

/* ======== ANIMAÇÃO ======== */
@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ======== RESPONSIVO ======== */
@media (max-width: 768px) {
    .message {
        max-width: 85%;
        padding: 12px 15px;
    }
}

@media (max-width: 480px) {
    .message {
        max-width: 92%;
        padding: 10px 12px;
    }
}


/* =====================================================
   MELHORIAS DE CHAT (ADITIVAS / NÃO DESTRUTIVAS)
   NÃO REMOVE NADA DO CSS ORIGINAL
===================================================== */

/* 1 Espaçamento vertical mais consistente entre mensagens */
.messages-container {
    gap: 22px;
}

/* 2 Garantia absoluta de alinhamento */
.message-wrapper {
    width: 100%;
    display: flex;
}

.message-wrapper.received {
    justify-content: flex-start;
}

.message-wrapper.sent {
    justify-content: flex-end;
}

/* 3 Neutraliza visualmente os ::after sem removê-los */
.message-received::after,
.message-sent::after {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* 4 Ajuste estrutural da mensagem para suportar indicador */
.message {
    position: relative;
    padding-left: 28px;
    padding-right: 28px;
}

/* 5 Indicador lateral moderno (barra vertical) */
.message::before {
    content: '';
    position: absolute;
    top: 12px;
    bottom: 12px;
    width: 4px;
    border-radius: 10px;
}

/* 6 RECEBIDAS → indicador à esquerda */
.message-wrapper.received .message::before {
    left: 8px;
    background: linear-gradient(to bottom, #bdbdbd, #8e8e8e);
}

/* 7 ENVIADAS → indicador à direita */
.message-wrapper.sent .message::before {
    right: 8px;
    background: linear-gradient(to bottom, #007bff, #0056b3);
}

/* 8 Responsividade segura */
@media (max-width: 768px) {
    .message {
        padding-left: 24px;
        padding-right: 24px;
    }
}

@media (max-width: 480px) {
    .message {
        padding-left: 22px;
        padding-right: 22px;
    }
}