:root {
    --bg-body: #343541;
    --bg-sidebar: #202123;
    --bg-message-user: #343541;
    --bg-message-ai: #444654;
    --text-primary: #ececf1;
    --text-secondary: #c5c5d2;
    --input-bg: #40414f;
    --border-color: #4d4d4f;
    --accent-color: #10a37f;
    --font-family: 'Segoe UI', Helvetica, Arial, sans-serif;
    --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* --- Reset Básico --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body,
html {
    height: 100%;
    font-family: var(--font-family);
    background-color: var(--bg-body);
    color: var(--text-primary);
    overflow: hidden;
}

/* --- Layout --- */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* --- Sidebar --- */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    padding: 10px;
    border-right: 1px solid #333;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.new-chat-btn:hover {
    background-color: #2b2c2f;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

.clear-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 5px;
    font-size: 0.9rem;
}

.clear-btn:hover {
    background-color: #2b2c2f;
    color: #ef4444;
}

/* --- Chat Principal --- */
.main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--bg-body);
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 150px;
    scroll-behavior: smooth;
}

.chat-history::-webkit-scrollbar {
    width: 8px;
}

.chat-history::-webkit-scrollbar-thumb {
    background-color: #565869;
    border-radius: 4px;
}

/* --- Mensagens --- */
.message-row {
    padding: 24px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    width: 100%;
}

.message-row.ai {
    background-color: var(--bg-message-ai);
}

.message-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    gap: 20px;
    padding: 0 20px;
    line-height: 1.6;
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: bold;
}

.avatar.user {
    background-color: #5436DA;
}

.avatar.ai {
    background-color: var(--accent-color);
}

.text-content {
    flex: 1;
    overflow-wrap: break-word;
}

/* --- Estilos para o Highlight.js (Adicionados ao V1) --- */
.text-content pre {
    background-color: #282c34 !important;
    /* Cor de fundo do tema */
    border-radius: 8px;
    margin: 15px 0;
    padding: 0;
    overflow-x: auto;
    border: 1px solid #3e4451;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.text-content code {
    font-family: var(--font-mono) !important;
    background-color: transparent !important;
    color: inherit !important;
}

/* Código inline (meio da frase) */
.text-content p code,
.text-content li code {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    color: #ebcb8b;
    font-weight: bold;
}

.text-content pre code {
    display: block;
    padding: 15px;
}

.text-content p {
    margin-bottom: 1em;
}

.text-content p:last-child {
    margin-bottom: 0;
}

/* --- Input Area --- */
.input-area {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-image: linear-gradient(180deg, rgba(53, 53, 65, 0), #353541 50%);
    padding: 40px 20px;
    display: flex;
    justify-content: center;
}

.input-container {
    max-width: 800px;
    width: 100%;
    position: relative;
}

.chat-input {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid rgba(32, 33, 35, 0.5);
    border-radius: 12px;
    padding: 16px 50px 16px 16px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    height: 56px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    outline: none;
    overflow: hidden;
}

.chat-input:focus {
    border-color: rgba(255, 255, 255, 0.2);
}

.send-btn {
    position: absolute;
    right: 12px;
    bottom: 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.send-btn:hover {
    background-color: #202123;
    color: var(--text-primary);
}

.send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 10px 0;
}

.dot {
    width: 8px;
    height: 8px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) {
    animation-delay: -0.32s;
}

.dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .message-content {
        padding: 0 15px;
        gap: 10px;
    }
}

svg {
    fill: currentColor;
    width: 20px;
    height: 20px;
}