* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-dark: #192338;
    --color-medium: #1E2E4F;
    --color-accent: #31487A;
    --color-light: #8FB3E2;
    --color-lighter: #D9E1F1;
}

body {
    font-family: 'Poppins', Arial, sans-serif;
    background: linear-gradient(135deg, #192338 0%, #1E2E4F 50%, #31487A 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Chat Toggle Button */
.chat-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--color-accent);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(49, 72, 122, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(49, 72, 122, 0.6);
}

.chat-toggle.hidden {
    display: none;
}

/* Chat Wrapper */
.chat-wrapper {
    width: 100%;
    max-width: 720px;
    background: var(--color-medium);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-wrapper.hidden {
    display: none;
}

/* Chat Header */
.chat-header {
    background: var(--color-accent);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}

.header-avatar {
    position: relative;
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    overflow: hidden;
    flex-shrink: 0;
}

.header-avatar img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
}

.status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #4ade80;
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.header-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.header-info p {
    font-size: 0.75rem;
    opacity: 0.9;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-pill {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    flex-shrink: 0;
}

.header-actions {
    margin-left: auto;
}

.icon-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Estilo para a imagem do cabeçalho */
.header-image {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: 10px;
}

/* Estilo para os avatares das mensagens do chatbot */
.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    vertical-align: middle;
}

/* Chat Box */
.chat-box::-webkit-scrollbar {
    width: 6px;
}

.chat-box::-webkit-scrollbar-track {
    background: var(--color-medium);
    border-radius: 3px;
}

.chat-box::-webkit-scrollbar-thumb {
    background: var(--color-light);
    border-radius: 3px;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 20px;
    color: var(--color-lighter);
}

.bot-avatar {
    width: 80px;
    height: 80px;
    background: var(--color-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
    color: white;
    overflow: hidden;
    animation: bounce 2s infinite;
}

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

.welcome-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #fff;
}

.welcome-message .sub-text {
    font-size: 0.82rem;
    color: var(--color-light);
    line-height: 1.6;
    max-width: 420px;
    margin: 0 auto 16px;
}

.welcome-message .sub-text strong {
    color: var(--color-lighter);
}

/* Avatar Image */
.avatar-image {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
}

.bot-avatar img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

/* Messages */
.msg {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.9rem;
    word-break: break-word;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.msg.user {
    align-self: flex-end;
    background: var(--color-light);
    color: var(--color-dark);
    border-bottom-right-radius: 4px;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    border-bottom-left-radius: 18px;
}

.msg.bot {
    align-self: flex-start;
    background: var(--color-lighter);
    color: var(--color-dark);
    border-bottom-left-radius: 4px;
    border-top-left-radius: 18px;
    border-top-right-radius: 18px;
    border-bottom-right-radius: 18px;
}

.msg .sender {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
    opacity: 0.7;
}

.msg.bot .sender {
    color: var(--color-accent);
}

.msg.user .sender {
    color: var(--color-dark);
}

.msg-time {
    display: block;
    font-size: 0.68rem;
    opacity: 0.5;
    margin-top: 5px;
    text-align: right;
}

/* Markdown dentro das mensagens do bot */
.msg.bot ul, .msg.bot ol { padding-left: 18px; margin: 4px 0; }
.msg.bot li { margin-bottom: 2px; }
.msg.bot strong { font-weight: 600; }
.msg.bot code {
    background: rgba(0,0,0,.08);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.85em;
    font-family: monospace;
}
.msg.bot p { margin: 0 0 6px; }
.msg.bot p:last-child { margin-bottom: 0; }

/* Contador de caracteres */
.char-counter {
    text-align: right;
    font-size: 0.72rem;
    color: var(--color-light);
    padding: 2px 20px 6px;
    background: var(--color-medium);
    opacity: 0.7;
    transition: color .2s;
}
.char-counter.warn { color: #f87171; opacity: 1; }

/* Chat Form */
.chat-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    background: var(--color-medium);
    border-top: 1px solid var(--color-accent);
}

.emoji-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--color-light);
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s;
}

.emoji-btn:hover {
    color: var(--color-lighter);
}

#user-input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid var(--color-accent);
    border-radius: 20px;
    outline: none;
    font-size: 0.9rem;
    font-family: 'Poppins', sans-serif;
    background: var(--color-dark);
    color: white;
    transition: border-color 0.2s;
    resize: none;
    min-height: 42px;
    max-height: 120px;
    overflow-y: auto;
    line-height: 1.45;
    display: block;
}

#user-input:focus {
    border-color: var(--color-light);
}

#user-input::placeholder {
    color: var(--color-light);
}

.send-btn {
    width: 45px;
    height: 45px;
    border: none;
    background: var(--color-light);
    color: var(--color-dark);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(143, 179, 226, 0.4);
}

/* Chat Footer */
.chat-footer {
    padding: 8px 16px;
    background: var(--color-dark);
    text-align: center;
    border-top: 1px solid var(--color-accent);
}

.chat-footer small {
    color: var(--color-light);
    font-size: 0.7rem;
}

.chat-footer i {
    color: var(--color-light);
    margin-right: 4px;
}

.footer-social-row {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 5px;
}

.footer-insta {
    color: var(--color-light);
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.2s;
}

.footer-insta:hover { color: #e1306c; }
.footer-insta.footer-yt:hover { color: #ff0000; }
.footer-insta.footer-tt:hover { color: #ffffff; }
.footer-insta.footer-li:hover { color: #0a66c2; }
.footer-insta.footer-decigi:hover { color: #6ea8d6; }

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
    background: var(--color-lighter);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    align-self: flex-start;
    animation: fadeIn 0.3s ease;
}

.typing-indicator span {
    display: block;
    width: 8px;
    height: 8px;
    background: var(--color-accent);
    border-radius: 50%;
    animation: typingBounce 1.2s ease-in-out infinite;
}

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

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Quick suggestion chips */
.quick-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 4px;
}

.suggestion-chip {
    background: transparent;
    border: 1px solid var(--color-accent);
    color: var(--color-lighter);
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.suggestion-chip:hover {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(49, 72, 122, 0.4);
}

.suggestion-chip i {
    font-size: 0.75rem;
    opacity: 0.85;
}

/* ── Chat box wrapper (para posicionar o scroll-btn) ── */
.chat-box-wrap {
    position: relative;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--color-dark);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── Scroll-to-bottom button ── */
.scroll-btn {
    position: absolute;
    bottom: 12px;
    right: 14px;
    width: 34px;
    height: 34px;
    background: var(--color-accent);
    color: var(--color-dark);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.35);
    z-index: 5;
    transition: opacity 0.2s, transform 0.2s;
}

.scroll-btn:hover {
    opacity: 0.85;
    transform: translateY(1px);
}

/* ── Mic button ── */
.mic-btn {
    background: transparent;
    border: none;
    color: var(--color-light);
    font-size: 15px;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.mic-btn:hover {
    color: var(--color-lighter);
    background: rgba(143, 179, 226, 0.12);
}

.mic-btn.listening {
    color: #ef4444;
    animation: micPulse 1s ease-in-out infinite;
}

@keyframes micPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.18); opacity: 0.75; }
}

/* ── Chips inline (pós-resposta) ── */
.inline-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-self: flex-start;
    margin-top: -4px;
    max-width: 90%;
    animation: fadeIn 0.3s ease;
}

.suggestion-chip.small {
    font-size: 0.70rem;
    padding: 5px 10px;
}

/* ── Feedback ── */
.feedback-row {
    display: flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    margin-top: -6px;
    animation: fadeIn 0.3s ease;
}

.feedback-label {
    font-size: 0.68rem;
    color: var(--color-light);
    opacity: 0.75;
}

.feedback-btn {
    background: transparent;
    border: none;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 6px;
    transition: background 0.15s, transform 0.1s;
    line-height: 1;
}

.feedback-btn:hover {
    background: rgba(143, 179, 226, 0.15);
    transform: scale(1.2);
}

.feedback-thanks {
    font-size: 0.70rem;
    color: var(--color-light);
    opacity: 0.85;
}