/* =================================================================
   10. CHAT
   ================================================================= */
.chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    max-width: 90%;
    z-index: 1050;
    box-shadow: 0 15px 40px rgba(0,0,0,0.1), 0 0 20px rgba(0, 240, 255, 0.05);
    border-radius: 20px;
    border: 1px solid var(--border-highlight);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-container);
    backdrop-filter: blur(15px);
    max-height: 500px;
    transition: all 0.35s ease-in-out;
    color: var(--text-main);
}

:root.dark-mode .chat-container {
    box-shadow: 0 15px 40px rgba(0,0,0,0.4), 0 0 20px rgba(0, 240, 255, 0.05);
}

.chat-container .card-header {
    cursor: pointer;
}

.chat-container .card-body,
.chat-container .card-footer {
    transition: all 0.35s ease-in-out;
}

.chat-container.minimized .card-body,
.chat-container.minimized .card-footer {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
}

.chat-box {
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
}

.chat-message-wrapper {
    display: flex;
    margin-bottom: 12px;
}

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

.chat-message {
    padding: 8px 14px;
    border-radius: 18px;
    max-width: 85%;
    word-wrap: break-word;
}

.chat-message-wrapper.sent .chat-message {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.1) 0%, rgba(0, 150, 255, 0.05) 100%);
    border: 1px solid rgba(0, 240, 255, 0.3);
    color: var(--text-main);
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 2px 10px rgba(0, 240, 255, 0.05);
}

.chat-message-wrapper.received .chat-message {
    background-color: var(--bg-main);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    border-radius: 18px 18px 18px 4px;
}

.chat-message .author {
    font-weight: bold;
    font-size: 0.85em;
    margin-bottom: 3px;
    color: #3498db;
}

.chat-message-wrapper.sent .chat-message .author {
    color: var(--text-muted);
}

/* [ALTERAÇÃO VISUAL] - Regras para o rodapé da mensagem */
.chat-message .timestamp {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px; /* Espaço entre horário e botão */
    font-size: 0.75em;
    color: var(--text-muted);
    margin-top: 4px;
}

/* [ALTERAÇÃO VISUAL] - Remove margens do botão quando ele está no rodapé */
.chat-message .timestamp .like-chat-wrapper {
    margin: 0;
}


.chat-message-wrapper.consecutive-message {
    margin-top: -8px;
}

.chat-container .card-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-subtle);
    background-color: transparent;
}

.chat-input-wrapper {
    position: relative;
    width: 100%;
}

#chat-message-input {
    border-radius: 24px;
    border: 1px solid var(--border-highlight);
    background: var(--bg-main);
    color: var(--text-main);
    height: 48px;
    padding-right: 50px;
    padding-left: 20px;
    transition: all 0.3s ease;
}

#chat-message-input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px rgba(var(--brand-primary-rgb), 0.1);
    background: var(--bg-card);
    outline: none;
}

.btn-send-chat {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    height: 35px;
    width: 35px;
    border-radius: 50%;
    border: none;
    background: #000000;
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color 0.2s ease;
}

.btn-send-chat:hover {
    background: var(--brand-primary);
    color: #fff;
}

#chat-notification-badge {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 0.7em;
    padding: 4px 7px;
    border-radius: 50%;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 0, 77, 0.7); }
    50% { transform: scale(1.2); box-shadow: 0 0 0 5px rgba(255, 0, 77, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 0, 77, 0); }
}

.pulse-animation {
    animation: pulse 1s ease-in-out;
}

@keyframes blink-animation {
    50% { background-color: #5a6abf; }
}

.chat-header.has-new-messages {
    animation: blink-animation 1.5s infinite;
}

/* [NOVO] Estilo para o separador de data */
.chat-date-separator {
    text-align: center;
    margin: 15px 0 10px;
    position: relative;
}

.chat-date-separator span {
    background-color: var(--border-subtle);
    color: var(--text-muted);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}
