/* Estilos para corrigir o comportamento no mobile */
@media (max-width: 768px) {
    #chat-widget {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-width: 350px;
        max-height: 80vh;
        z-index: 9999;
        margin: 0;
    }

    #chat-messages {
        max-height: calc(80vh - 120px);
        overflow-y: auto;
    }

    .chat-button-container {
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 9998;
    }
}

#chat-button {
    position: static;
    width: 90px;
    height: 90px;
    background-color: var(--bs-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.button-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
}

#chat-button span {
    display: block;
    font-size: 12px;
    margin-top: 4px;
    line-height: 1;
}

#chat-button i {
    display: block;
    line-height: 1;
}

#chat-button:hover {
    transform: scale(1.1);
    background-color: var(--bs-primary-darker);
}

#chat-widget {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 500px;
    height: 600px;
    background: #121212;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: all 0.3s ease;
}

.chat-hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

.chat-header {
    padding: 15px;
    background: var(--bs-primary);
    color: var(--bs-light);
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.chat-header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.chat-header-subtitle {
    font-size: 12px;
    opacity: 0.7;
    font-weight: 400;
}

.close-button {
    background: none;
    border: none;
    color: var(--bs-light);
    font-size: 24px;
    cursor: pointer;
    padding: 0 5px;
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #121212;
}

#chat-messages p {
    margin: 4px 0;
    padding: 10px 15px;
    border-radius: 15px;
    max-width: 90%;
    word-wrap: break-word;
}

/* Mensagem do usuário */
#chat-messages p:nth-child(even) {
    background: var(--bs-primary);
    color: #FFFFFF;
    margin-left: auto;
}

/* Mensagem do bot */
#chat-messages p:nth-child(odd) {
    background: #1E1E1E;
    color: #FFFFFF;
    margin-right: auto;
}

.chat-input {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 10px;
    background: #121212;
    border-radius: 0 0 10px 10px;
}

.chat-input input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    outline: none;
    background: #1E1E1E;
    color: #FFFFFF;
}

.chat-input input::placeholder {
    color: var(--bs-gray-500);
}

.chat-input button {
    background: var(--bs-primary);
    color: var(--bs-light);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.chat-input button:hover {
    background: var(--bs-primary-darker);
}

/* Scrollbar personalizada */
#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: var(--bs-dark);
}

#chat-messages::-webkit-scrollbar-thumb {
    background: var(--bs-gray-600);
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--bs-gray-500);
}

/* Foco no input */
.chat-input input:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), 0.25);
}

.chat-button-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
}

#chat-button {
    position: static;
    width: 90px;
    height: 90px;
    background-color: var(--bs-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.chat-label {
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    white-space: nowrap;
}

.suggestions-list {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.suggestions-list li {
    background: #1E1E1E;
    color: #FFFFFF;
    margin: 8px 0;
    padding: 10px 15px;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestions-list li:hover {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    transform: translateX(5px);
}

.suggestions-list li i {
    margin-right: 8px;
    font-size: 16px;
    color: var(--bs-primary);
}

.suggestions-list li:hover i {
    color: #FFFFFF;
}

.typing-indicator {
    background: #1E1E1E;
    padding: 10px;
    border-radius: 15px;
    display: flex;
    gap: 4px;
    width: fit-content;
    margin: 10px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--bs-primary);
    border-radius: 50%;
    animation: typing 1s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.message {
    margin: 4px 0;
    max-width: 90%;
    position: relative;
}

.message p {
    margin: 0;
    padding: 10px 15px;
    border-radius: 15px;
    display: inline-block;
    word-break: normal;
    overflow-wrap: break-word;
    text-align: left;
    line-height: 1.3;
}

.user-message {
    margin-left: auto;
    text-align: right;
}

.bot-message {
    margin-right: auto;
    text-align: left;
}

.user-message p {
    background: var(--bs-primary);
    color: #FFFFFF;
    border-radius: 15px 15px 0 15px;
}

.bot-message p {
    background: #1E1E1E;
    color: #FFFFFF;
    border-radius: 15px 15px 15px 0;
    max-width: 100%;
}

/* Ajuste para garantir que as mensagens sejam tratadas como uma única unidade */
.message-text {
    display: inline-block;
    white-space: normal;  /* Permite quebra de linha natural */
}

.message-time {
    font-size: 11px;
    color: var(--bs-gray-500);
    margin-top: 4px;
    display: block;
}

/* Ajuste do espaçamento entre parágrafos */
.message p br + br {
    content: "";
    display: block;
    margin: 0.5em 0;  /* Espaço reduzido entre parágrafos */
}
