/* === Highlight8 CSS v2.0 === */
/* === Variáveis Globais === */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --text-color: #c9d1d9;
    --text-muted: #8b949e;
    --text-highlight: #58a6ff;
    --badge-bg: #2e2e2e;
    --scroll-btn-bg: rgba(72, 72, 72, 0.6);
    --scroll-btn-shadow: rgba(0, 0, 0, 0.4);
    --bubble-user-bg: var(--bg-secondary);
    --typing-color: #888;
    --system-bg: #1f1f1f;
    --system-border: #0d6efd;
    --alert-bg: #2a0000;
    --alert-border: #dc3545;
    --user-border: #198754;
}

/* === Reset & Global Styles === */
body {
    background-color: var(--bg-primary);
    color: var(--text-color);
    font-family: "Segoe UI", sans-serif;
}

/* === Code Container & Toolbar === */
.code-container {
    position: relative;
    margin-bottom: 2rem;
    background-color: transparent;
}

.code-toolbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background-color: var(--bg-secondary);
    padding: 0.5rem 0.5rem 0.5rem 0.7rem;
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
}

/* === Badge & Navigation Links === */
.badge-lang {
    background-color: var(--badge-bg);
    color: white;
    font-weight: 600;
    font-size: 0.65rem;
    text-transform: uppercase;
    padding: 0.2em 0.6em;
    border-radius: 0.25rem;
}

.nav-link {
    color: var(--text-color);
    padding: 0.25rem 0.75rem;
    text-decoration: none;
}

.nav-link:hover {
    color: var(--text-highlight);
}

/* === Copy Button === */
.btn-copy {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    margin-left: 0.5rem;
}

.btn-copy:hover {
    color: var(--text-highlight);
}

/* === Highlight.js Styles === */
.hljs {
    color: var(--text-color);
    background: var(--bg-secondary);
    padding: 5px !important;
}

pre {
    background-color: var(--bg-secondary);
    border-bottom-left-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
    padding: 0 0.5rem 0.5rem 0.5rem;
    overflow-x: auto;
    font-family: "Fira Code", monospace;
    scrollbar-color: var(--text-muted) transparent;
}

/* === Prompt Input Container === */
.prompt-container {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 768px;
    border-radius: 0.75rem;
    padding: 0.5rem;
    background: var(--scroll-btn-bg);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    color: #fff;
    z-index: 1000;
}

.prompt-textarea {
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    overflow: hidden;
    background: transparent;
    color: #fff;
    font-size: 1rem;
    line-height: 1.4;
    min-height: 24px;
    max-height: 120px;
    margin: 0.5rem 0 0 0.5rem;
}

.prompt-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0;
}

.prompt-footer .left-icons i,
.prompt-footer .right-icons i {
    font-size: 1.2rem;
    color: #ccc;
    margin-right: 0.5rem;
    cursor: pointer;
}

.prompt-footer .right-icons i:last-child {
    background-color: transparent;
    color: white;
    padding: 0.6rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: right;
    font-size: 1.3rem;
    margin-left: 0.5rem;
}

.prompt-footer .left-icons span {
    color: #ccc;
    font-size: 0.9rem;
    margin-left: 0.25rem;
}

@media (max-width: 576px) {
    .prompt-footer .left-icons span {
        display: none;
    }
}

/* === Render Area === */
#render {
    margin-bottom: 130px; /* Ajustável conforme altura do prompt */
}

/* === Scroll Down Button === */
.scroll-down-btn {
    position: fixed;
    bottom: 7.5rem; /* Acima do prompt */
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--scroll-btn-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.scroll-down-btn.show {
    opacity: 1;
    pointer-events: auto;
}

.scroll-down-btn i {
    line-height: 1;
    font-size: 1.5rem;
    display: block;
}

/* === Tables Customização === */
.custom-table {
    background-color: transparent !important;
}

.custom-table tbody tr.custom-tr:hover {
    background-color: rgba(0, 0, 0, 0.15) !important;
}

.custom-th, .custom-td, .custom-thead {
    background-color: transparent !important;
    color: #ddd !important;
}

/* === Spinner SSE === */
#sseSpinner {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background-color: rgba(0, 0, 0, 0.85);
    padding: 1rem 2rem;
    border-radius: 10px;
    color: white;
}

/* === Status SSE === */
#sseStatus { 
    position: fixed; 
    top: 5px; 
    right: 5px; 
     
    font-size: 0.25rem; 
    color: white; 
    z-index: 9999; }


/* === Chat Messages === */
.chat-message {
    animation: fadeInUp 0.3s ease-out;
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
    background: #f8f9fa;
    border: 1px solid #ddd;
    position: relative;
}

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

.chat-message.system {
    background-color: var(--system-bg);
    border-left: 4px solid var(--system-border);
}

.chat-message.alert {
    background-color: var(--alert-bg);
    border-left: 4px solid var(--alert-border);
}

.chat-message.user {
    background-color: #121212;
    border-left: 4px solid var(--user-border);
}

.chat-message.top-message {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: #fff8dc;
    border: 2px dashed #999;
    z-index: 1000;
}

/* === Typing Indicator === */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 0 8px;
    margin-bottom: 12px;
    font-size: 28px;
    color: var(--typing-color);
    animation: blink 1.5s infinite;
}

.typing-indicator span {
    animation: bounce 1.5s 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 bounce {
    0%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-8px);
    }
}

/* === User Message Bubble === */
.user-message {
    display: flex;
    justify-content: flex-end;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1;
}

.bubble-user {
    display: inline-block;
    background-color: var(--bubble-user-bg);
    color: #fff;
    border-radius: .5rem .5rem 0 .5rem;
    padding: 8px 12px;
    /*font-size: 1.15rem;*/
    white-space: pre-wrap;
    max-width: 90%;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

/* === Botões de ação (copiar etc) dentro do código === */
.code-action-button {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: var(--scroll-btn-bg);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.code-action-button:hover {
    color: var(--text-highlight);
    background-color: var(--badge-bg);
}


pre code.language-TXT {
  white-space: pre-wrap;
  word-break: break-word;
}

pre code.language-TXT::before,
pre code.language-TXT::after {
  content: none; /* remove decorações se houver */
}

pre code.language-TXT {
  overflow: visible !important;
}
