/**
 * OpenAI Chat Widget CSS
 */

/* Contenedor principal del chat widget */
.openai-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Botão de toggle do chat */
.chat-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    outline: none;
}

.chat-toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.chat-toggle-btn svg {
    width: 28px;
    height: 28px;
}

/* Painel do chat */
.chat-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 340px;
    height: 450px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    /* Garantir que o painel do chat mantém uma altura fixa */
    max-height: 450px;
}

/* Cabeçalho do chat */
.chat-header {
    background: linear-gradient(135deg, #2563eb, #7c3aed) !important;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-weight: 500;
    font-size: 16px;
}

.close-chat-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.close-chat-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Área de mensagens */
.chat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

/* Mensagens */
.message {
    padding: 12px 15px;
    border-radius: 15px;
    max-width: 85%;
    word-wrap: break-word;
}

.message p {
    margin: 0;
    line-height: 1.5;
    font-size: 14px;
}

.assistant-message {
    background-color: #f1f5f9;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}

.user-message {
    background-color: #dbeafe;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.error-message {
    background-color: #fee2e2;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    color: #b91c1c;
}

/* Área de input */
.chat-input-area {
    border-top: 1px solid #e5e7eb;
    padding: 12px;
    display: flex;
}

#chat-input {
    flex-grow: 1;
    border: 1px solid #d1d5db;
    border-right: none;
    border-radius: 8px 0 0 8px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
}

#chat-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 1px #2563eb;
}

.send-button {
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 0 8px 8px 0;
    padding: 0 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.send-button:hover {
    background-color: #1d4ed8;
}

.send-button svg {
    width: 18px;
    height: 18px;
}

/* Efeito de digitação */
.typing-indicator {
    display: flex;
    align-items: center;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    float: left;
    margin: 0 1px;
    background-color: #9ca3af;
    display: block;
    border-radius: 50%;
    opacity: 0.4;
}

.typing-indicator span:nth-of-type(1) {
    animation: 1s blink infinite 0.3333s;
}

.typing-indicator span:nth-of-type(2) {
    animation: 1s blink infinite 0.6666s;
}

.typing-indicator span:nth-of-type(3) {
    animation: 1s blink infinite 0.9999s;
}

@keyframes blink {
    50% {
        opacity: 1;
    }
}

/* Perguntas exemplo */
.chat-example-questions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
    margin-bottom: 5px;
}

.example-question-btn {
    background-color: #e9f0ff;
    border: 1px solid #d1dcf5;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    color: #4a5568;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    max-width: 85%;
    align-self: flex-start;
}

.example-question-btn:hover {
    background-color: #d1e2ff;
}

/* Responsividade para dispositivos móveis */
@media (max-width: 480px) {
    .chat-panel {
        width: calc(100vw - 40px);
        right: 0;
        bottom: 80px;
    }
}

/* Estilos para shortcode */
.openai-chat-widget-shortcode {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Shortcode inline */
.openai-chat-widget-shortcode.inline {
    display: block;
    margin: 20px 0;
}

.openai-chat-widget-shortcode.inline .chat-panel-shortcode {
    width: var(--chat-width, 340px);
    height: var(--chat-height, 450px);
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: var(--chat-height, 450px);
    border: 1px solid #e5e7eb;
}

/* Shortcode posição fixa */
.openai-chat-widget-shortcode.fixed-bottom-right {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.openai-chat-widget-shortcode.fixed-bottom-left {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
}

.openai-chat-widget-shortcode.fixed-bottom-right .chat-panel-shortcode,
.openai-chat-widget-shortcode.fixed-bottom-left .chat-panel-shortcode {
    position: absolute;
    bottom: 80px;
    width: var(--chat-width, 340px);
    height: var(--chat-height, 450px);
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    max-height: var(--chat-height, 450px);
}

.openai-chat-widget-shortcode.fixed-bottom-right .chat-panel-shortcode {
    right: 0;
}

.openai-chat-widget-shortcode.fixed-bottom-left .chat-panel-shortcode {
    left: 0;
}

/* Botão toggle para shortcode */
.openai-chat-widget-shortcode .shortcode-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    outline: none;
}

.openai-chat-widget-shortcode .shortcode-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Input para shortcode */
.chat-input-shortcode {
    flex-grow: 1;
    border: 1px solid #d1d5db;
    border-right: none;
    border-radius: 8px 0 0 8px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
}

.chat-input-shortcode:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 1px #2563eb;
}

/* Botão send para shortcode */
.shortcode-send {
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 0 8px 8px 0;
    padding: 0 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.shortcode-send:hover {
    background-color: #1d4ed8;
}

/* Botão close para shortcode */
.shortcode-close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.shortcode-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Responsividade para shortcode */
@media (max-width: 480px) {
    .openai-chat-widget-shortcode.inline .chat-panel-shortcode {
        width: 100%;
        max-width: calc(100vw - 40px);
    }

    .openai-chat-widget-shortcode.fixed-bottom-right .chat-panel-shortcode,
    .openai-chat-widget-shortcode.fixed-bottom-left .chat-panel-shortcode {
        width: calc(100vw - 40px);
        right: 0;
        left: 0;
        bottom: 80px;
    }
}