/* WhatsApp Chat - Layout 3 Colunas */
.whatsapp-chat-container {
    display: grid;
    grid-template-columns: 320px 1fr 360px;
    height: calc(100vh - 120px);
    gap: 0;
    background: #f0f2f5;
}

/* Chat Sidebar */
.chat-sidebar {
    background: #fff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.chat-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.chat-sidebar-header h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 600;
    color: #111;
}

.chat-tabs {
    display: flex;
    gap: 8px;
}

.chat-tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: #f0f2f5;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #667781;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-tab.active {
    background: #25d366;
    color: #fff;
}

.chat-tab .badge {
    display: inline-block;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    margin-left: 4px;
}

.chat-search {
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
}

.chat-search svg {
    color: #667781;
}

.chat-search input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    color: #111;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f2f5;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.conversation-item:hover {
    background: #f5f6f6;
}

.conversation-item.active {
    background: #e9edef;
}

.conversation-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 18px;
    flex-shrink: 0;
}

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

.conversation-name {
    font-size: 14px;
    font-weight: 500;
    color: #111;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-last-message {
    font-size: 13px;
    color: #667781;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chat Window */
.chat-window {
    background: #efeae2;
    display: flex;
    flex-direction: column;
    position: relative;
}

.chat-window-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #667781;
}

.chat-window-empty svg {
    color: #d1d7db;
    margin-bottom: 24px;
}

.chat-window-empty h3 {
    font-size: 24px;
    font-weight: 300;
    margin: 0 0 8px 0;
    color: #41525d;
}

.chat-window-empty p {
    font-size: 14px;
    color: #667781;
}

.chat-window-active {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    background: #f0f2f5;
    padding: 12px 16px;
    border-bottom: 1px solid #d1d7db;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.contact-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 16px;
}

.contact-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #111;
}

.contact-info p {
    margin: 2px 0 0 0;
    font-size: 13px;
    color: #667781;
}

.chat-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: none;
    background: #dc3545;
    color: #fff;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #c82333;
}

/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><rect fill="%23efeae2" width="100" height="100"/></svg>');
}

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

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

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

.message-bubble {
    max-width: 65%;
    padding: 8px 12px;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
}

.message.sent .message-bubble {
    background: #d9fdd3;
    border-radius: 8px 8px 0 8px;
}

.message.received .message-bubble {
    background: #fff;
    border-radius: 8px 8px 8px 0;
}

.message-bubble p {
    margin: 0;
    font-size: 14px;
    color: #111;
    word-wrap: break-word;
    white-space: pre-wrap;
}

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

/* Mensagens Interativas */
.interactive-bubble {
    max-width: 75% !important;
}

.interactive-message {
    min-width: 250px;
}

.interactive-header {
    font-size: 14px;
    font-weight: 600;
    color: #111;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.interactive-body {
    font-size: 14px;
    color: #111;
    margin-bottom: 12px;
    line-height: 1.4;
}

.interactive-footer {
    font-size: 12px;
    color: #667781;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* Botões Interativos */
.interactive-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.interactive-button {
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #d1d7db;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: #00a884;
    cursor: default;
    transition: background 0.2s;
}

.message.sent .interactive-button {
    background: rgba(255, 255, 255, 0.9);
}

/* Lista Interativa */
.interactive-list-content {
    margin: 12px 0;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    padding: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.list-section {
    margin-bottom: 12px;
}

.list-section:last-child {
    margin-bottom: 0;
}

.list-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #667781;
    margin-bottom: 6px;
    padding: 4px 8px;
}

.list-row {
    background: #fff;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 4px;
    cursor: default;
}

.list-row:last-child {
    margin-bottom: 0;
}

.list-row-title {
    font-size: 14px;
    font-weight: 500;
    color: #111;
    margin-bottom: 2px;
}

.list-row-desc {
    font-size: 12px;
    color: #667781;
}

.interactive-list-button {
    padding: 10px 16px;
    background: #00a884;
    color: #fff;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    cursor: default;
}

.message.sent .interactive-list-button {
    background: #128c7e;
}

/* Respostas de Botões e Listas */
.reply-message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 4px;
}

.reply-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.reply-content {
    flex: 1;
}

.reply-label {
    font-size: 11px;
    color: #667781;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    font-weight: 600;
}

.reply-text {
    font-size: 15px;
    font-weight: 600;
    color: #111;
    line-height: 1.3;
}

.reply-desc {
    font-size: 13px;
    color: #667781;
    margin-top: 2px;
    line-height: 1.3;
}

.message.received .reply-message {
    background: rgba(0, 168, 132, 0.08);
    border-left: 3px solid #00a884;
    padding: 10px;
    border-radius: 6px;
}

/* Input Rico */
.message-input-container {
    background: #f0f2f5;
    padding: 12px 16px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    position: relative;
}

.btn-input-action {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: #54656f;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-input-action:hover {
    background: #d1d7db;
}

.message-input-wrapper {
    flex: 1;
    background: #fff;
    border-radius: 8px;
    padding: 8px 12px;
    max-height: 120px;
    overflow-y: auto;
}

.message-input-wrapper textarea {
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    font-size: 14px;
    font-family: inherit;
    color: #111;
    line-height: 20px;
    max-height: 100px;
}

.btn-send {
    width: 40px;
    height: 40px;
    border: none;
    background: #25d366;
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-send:hover:not(:disabled) {
    background: #20bd5a;
}

.btn-send:disabled {
    background: #d1d7db;
    cursor: not-allowed;
}

/* Emoji Picker */
.emoji-picker {
    position: absolute;
    bottom: 70px;
    right: 80px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 12px;
    width: 320px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 1000;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}

.emoji-grid span {
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
    text-align: center;
}

.emoji-grid span:hover {
    background: #f0f2f5;
}

/* Templates Picker */
.templates-picker {
    position: absolute;
    bottom: 70px;
    right: 120px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 360px;
    max-height: 400px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.templates-header {
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.templates-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #111;
}

.btn-close-picker {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #54656f;
    font-size: 24px;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
}

.btn-close-picker:hover {
    background: #f0f2f5;
}

.templates-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.template-item {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 4px;
}

.template-item:hover {
    background: #f0f2f5;
}

.template-name {
    font-size: 14px;
    font-weight: 500;
    color: #111;
    margin-bottom: 4px;
}

.template-preview {
    font-size: 13px;
    color: #667781;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Client Profile Panel */
.client-profile-panel {
    background: #fff;
    border-left: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.profile-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    background: #f0f2f5;
}

.profile-tab {
    flex: 1;
    padding: 12px 8px;
    border: none;
    background: transparent;
    font-size: 12px;
    font-weight: 500;
    color: #667781;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.profile-tab.active {
    color: #25d366;
    border-bottom-color: #25d366;
    background: #fff;
}

.profile-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Scrollbar personalizada */
.conversations-list::-webkit-scrollbar,
.messages-container::-webkit-scrollbar,
.emoji-picker::-webkit-scrollbar,
.templates-list::-webkit-scrollbar,
.profile-content::-webkit-scrollbar {
    width: 6px;
}

.conversations-list::-webkit-scrollbar-track,
.messages-container::-webkit-scrollbar-track,
.emoji-picker::-webkit-scrollbar-track,
.templates-list::-webkit-scrollbar-track,
.profile-content::-webkit-scrollbar-track {
    background: transparent;
}

.conversations-list::-webkit-scrollbar-thumb,
.messages-container::-webkit-scrollbar-thumb,
.emoji-picker::-webkit-scrollbar-thumb,
.templates-list::-webkit-scrollbar-thumb,
.profile-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.conversations-list::-webkit-scrollbar-thumb:hover,
.messages-container::-webkit-scrollbar-thumb:hover,
.emoji-picker::-webkit-scrollbar-thumb:hover,
.templates-list::-webkit-scrollbar-thumb:hover,
.profile-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}