﻿
/* ===== CHAT CONTAINER ===== */
#chat-container {
    position: fixed;
    top: 130px;
    bottom: 90px;
    right: 20px;
    width: clamp(320px, 90vw, 500px);
    display: none;
    flex-direction: column;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    overflow: hidden;
    z-index: 9999;
    font-size: clamp(1.1rem, 1.2vw + 0.7rem, 1.4rem);
    line-height: 1.5;
}

/* ===== CHAT HEADER ===== */
#chat-header {
    position: relative;
    flex-shrink: 0;
    padding: 1rem 1.25rem;
    background: #28a745;
    color: white;
    font-weight: 700;
    font-size: clamp(1.6rem, 2vw + 0.8rem, 2rem);
    user-select: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* ===== CHAT MAIN ===== */
#chat-main {
    flex: 1;
    overflow-y: auto;
    background: #fafafa;
    border-bottom: 1px solid #eee;
}

#load-more {
    z-index: 10;
    text-align: center;
    padding: 7px 0 0 0;
}

#load-more-button {
    background: none;
    border: none;
    color: #007bff;
    padding: 0;
    margin: 0;
    font: inherit;
    cursor: pointer;
}

#load-more-button:hover {
    color: #0056b3;
}

/* ===== CHAT MESSAGES ===== */
#chat-messages {
    flex: 1;
    padding: 1rem 1.25rem;
    font-size: clamp(1.1rem, 1.2vw + 0.7rem, 1.4rem);
    line-height: 1.5;
}

#chat-messages:after {
    content: "";
    display: table;
    clear: both;
}

/* ===== CHAT INPUT CONTAINER ===== */
#chat-input-container {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    padding: 1rem;
    background: #fff;
    border-top: 1px solid #eee;
    min-height: 52px;
}

/* ===== CHAT INPUT ===== */
#chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    min-height: 36px;
    height: 36px;
    max-height: calc(1.4em * 8 + 1.5rem);
    border: 1.5px solid #ccc;
    border-radius: 18px;
    outline-offset: 2px;
    font-family: inherit;
    font-size: inherit;
    line-height: 1.4;
    resize: none;
    overflow-y: hidden;
    box-sizing: border-box;
}

#chat-input:focus {
    outline: none;
    border-color: #28a745;
    box-shadow: 0 0 8px rgba(40, 167, 69, 0.4);
}

#chat-input.scrollable {
    overflow-y: auto;
}

/* ===== CHAT SEND BUTTON ===== */
#chat-send {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    height: 36px;
    padding: 0 1.5rem;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    font-size: clamp(1.1rem, 1.2vw + 0.7rem, 1.4rem);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

#chat-send:hover:not(.stop-button) {
    background: #218838;
    box-shadow: 0 6px 12px rgba(33, 136, 56, 0.5);
}

#chat-send:active:not(.stop-button) {
    background: #1e7e34;
    box-shadow: none;
}

#chat-send.stop-button {
    background-color: red;
    color: white;
}

#chat-send.stop-button:hover {
    background-color: darkred;
    box-shadow: 0 6px 12px rgba(139, 0, 0, 0.5);
}

#chat-send.stop-button:active {
    background-color: #8b0000;
    box-shadow: none;
}

/* ===== CHAT SHOW BUTTON ===== */
#chat-show-btn {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 48px;
    height: 48px;
    display: none;
    align-items: center;
    justify-content: center;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
    transition: background-color 0.3s ease;
    user-select: none;
    z-index: 1000;
    padding: 0;
}

#chat-show-btn:hover {
    background: #218838;
    box-shadow: 0 6px 12px rgba(33, 136, 56, 0.5);
}

#chat-show-btn svg {
    display: block;
    width: 24px;
    height: 24px;
    margin: auto;
}

/* ===== CHAT HIDE BUTTON ===== */
#chat-hide-btn {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0;
    margin: 0;
}

#chat-hide-btn:hover {
    color: #ddd;
}

/* ===== MESSAGES ===== */
.message {
    margin: 10px 0;
    padding: 0.875rem 1.25rem;
    display: block;
    clear: both;
    word-break: break-word;
    line-height: 1.5;
    border-radius: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.user-message {
    float: right;
    max-width: 75%;
    background: #d1e7dd;
    color: #0f5132;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.api-message {
    float: none !important;
    max-width: 100% !important;
    text-align: left;
    background: transparent !important;
    color: #333;
    box-shadow: none !important;
}

.system-message {
    text-align: center;
    color: #777;
    margin: 10px auto;
    border: none;
    clear: both;
    user-select: none;
}

.typing-message {
    float: none !important;
    max-width: 100% !important;
    text-align: left;
    background: transparent !important;
    color: #666;
    margin: 10px 0;
    padding: 0.875rem 1.25rem;
    display: block;
    word-break: break-word;
    border-radius: 18px;
    box-shadow: none !important;
}

/* Container da animação */
.waiting-message {
    margin: 10px 0;
    padding: 0.875rem 1.25rem;
    display: block;
    clear: both;
    word-break: break-word;
    line-height: 1.5;
}

.typing-dots {
    display: flex; 
    align-items: flex-start; 
    font-size: 32px; 
    gap: 4px; 
}

/* Estilo base dos pontos */
.typing-dots .dot {
    animation: blink 1.4s infinite;
    opacity: 0.3;
    font-weight: bold;
    line-height: 1;
}

/* Animação com delay para cada ponto */
.typing-dots .dot-1 {
    animation-delay: 0s;
}

.typing-dots .dot-2 {
    animation-delay: 0.2s;
}

.typing-dots .dot-3 {
    animation-delay: 0.4s;
}

/* Keyframes da animação */
@keyframes blink {
    0%, 80%, 100% {
        opacity: 0.3;
    }

    40% {
        opacity: 1;
    }
}
