* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f0f2f5;
    height: 100vh;
    overflow: hidden;
}

.dashboard {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 320px;              /* largura fixa da coluna */
    flex: 0 0 320px;
    background-color: #ffffff;
    border-right: 1px solid #e9edef;
    display: flex;
    flex-direction: column;
    overflow: hidden;          /* nada deve sair pra fora da coluna */
}

.header {
    background-color: #00a884;
    color: white;
    padding: 20px;
    text-align: center;
}

.header h2 {
    font-size: 18px;
    font-weight: 500;
}

.contacts-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;        /* impede scroll horizontal dentro da lista */
}

.contact-item {
    padding: 15px 20px;
    border-bottom: 1px solid #e9edef;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    overflow: hidden;          /* evita conteúdo estourar pros lados */
}

.contact-main-content {
    flex: 1;
    min-width: 0;              /* ESSENCIAL p/ o ellipsis funcionar no flex */
    cursor: pointer;
}

.contact-item:hover {
    background-color: #f5f6f6;
}

.contact-item.active {
    background-color: #e7f3ff;
}

.contact-name {
    font-weight: 500;
    font-size: 16px;
    color: #111b21;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;   /* corta nome muito grande */
}

.contact-last-message {
    font-size: 14px;
    color: #667781;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;   /* corta a última mensagem */
}

.contact-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.contact-time {
    font-size: 12px;
    color: #667781;
    margin-left: auto; /* Empurra para a direita */
}

.unread-badge {
    background-color: #00a884;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
    margin-left: 5px;
}

.contact-menu-button {
    font-size: 18px;
    cursor: pointer;
    color: #667781;
    padding: 0 5px;
    line-height: 1;
    margin-top: 4px;
}

.contact-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: 10px;
    position: relative;
    flex-shrink: 0;            /* não deixa essa coluna encolher */
}

.contact-menu {
    position: absolute;
    right: 0;
    top: 25px; /* fica logo abaixo das três bolinhas */
    background-color: white;
    border: 1px solid #e9edef;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 10;
    max-width: 200px;
}

.contact-menu.active {
    display: block;
}

.contact-menu-item {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}

.contact-menu-item:hover {
    background-color: #f5f6f6;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #efeae2;
}

.chat-header {
    background-color: #f0f2f5;
    padding: 15px 20px;
    border-bottom: 1px solid #e9edef;
}

.chat-header h3 {
    color: #111b21;
    font-size: 16px;
    font-weight: 500;
}

.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><defs><pattern id="pattern" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="%23ffffff" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23pattern  )"/></svg>');
}

.message {
    margin-bottom: 15px;
    display: flex;
}

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

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

.message-bubble {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 8px;
    position: relative;
}

.message.sent .message-bubble {
    background-color: #d9fdd3;
    color: #111b21;
}

.message.received .message-bubble {
    background-color: #ffffff;
    color: #111b21;
}

.message-text {
    font-size: 14px;
    line-height: 1.4;
}

.message-time {
    font-size: 11px;
    color: #667781;
    margin-top: 5px;
    text-align: right;
}

.message-input {
    background-color: #f0f2f5;
    padding: 15px 20px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.message-input input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #e9edef;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
}

.message-input input:focus {
    border-color: #00a884;
}

.message-input button {
    background-color: #00a884;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.message-input button:hover {
    background-color: #008f72;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #667781;
}

.no-chat {
    text-align: center;
    color: #667781;
    margin-top: 50px;
}

.no-chat p {
    font-size: 16px;
}
