:root {
    --bg-main: #1e1e24;
    --bg-panel: #282a36;
    --bg-header: #44475a;
    --text-light: #f8f8f2;
    --text-muted: #6272a4;
    --accent: #bd93f9;
    --border-color: #191a21;
    
    /* Novas Cores para os Botões Modernos */
    --btn-primary: #4dabf7;
    --btn-primary-hover: #74c0fc;
    --btn-success: #51cf66;
    --btn-success-hover: #8ce99a;
    --btn-secondary: #adb5bd;
    --btn-secondary-hover: #ced4da;
    --btn-destruct: #ff6b6b;
    --btn-destruct-hover: #ff8787;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-light);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ================= Navbar e Menus Suspensos ================= */
.navbar {
    background-color: var(--bg-panel);
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    flex-shrink: 0;
    height: 55px; /* Altura reduzida para acompanhar os novos botões */
    z-index: 100;
}

.nav-brand { font-weight: bold; font-size: 1.3rem; color: var(--accent); letter-spacing: 1px;}

.nav-menu { display: flex; list-style: none; height: 100%; align-items: center;}

.nav-menu li { position: relative; height: 100%; display: flex; align-items: center;}

.nav-menu a {
    color: var(--text-light); text-decoration: none; padding: 10px 15px;
    font-size: 0.95rem; transition: background 0.2s;
}

.nav-menu a:hover { background-color: var(--bg-header); border-radius: 6px; }

/* Dropdown */
.dropdown-content {
    display: none; position: absolute; top: 100%; left: 0;
    background-color: var(--bg-panel); min-width: 220px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.5); z-index: 1000;
    border: 1px solid var(--border-color); border-radius: 0 0 6px 6px;
}

.dropdown-content a {
    padding: 12px 16px; display: block; border-bottom: 1px solid #333;
}

.dropdown:hover .dropdown-content { display: block; }

/* Cabeçalhos no Dropdown de Exemplos */
.dropdown-header {
    padding: 10px 16px; font-weight: bold; font-size: 0.8rem;
    color: var(--text-muted); text-transform: uppercase; background: #222;
}

/* ================= NOVOS BOTÕES PROFISSIONAIS (Menores) ================= */
.nav-controls { display: flex; gap: 8px; align-items: center; } /* Gap reduzido */

.btn-control {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px; /* Espaço entre ícone e texto reduzido */
    padding: 7px 14px; /* Padding reduzido para um visual mais compacto */
    border-radius: 6px; /* Arredondamento ajustado à nova proporção */
    border: none;
    font-size: 13px; /* Fonte levemente menor */
    font-weight: 600;
    cursor: pointer;
    color: #fff;
    transition: all 0.2s ease;
    text-transform: capitalize;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15); 
}

/* Interações base para todos os botões */
.btn-control:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-control:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Variações de Cor */
.btn-primary { background-color: var(--btn-primary); }
.btn-primary:hover:not(:disabled) { background-color: var(--btn-primary-hover); }

.btn-success { background-color: var(--btn-success); color: #111; }
.btn-success:hover:not(:disabled) { background-color: var(--btn-success-hover); color: #000; }

.btn-secondary { background-color: var(--btn-secondary); color: #222; }
.btn-secondary:hover:not(:disabled) { background-color: var(--btn-secondary-hover); color: #111; }

.btn-destruct { background-color: var(--btn-destruct); }
.btn-destruct:hover:not(:disabled) { background-color: var(--btn-destruct-hover); }

/* Botão de Ajuda Flutuante */
#btn-help {
    background: transparent; color: var(--accent); padding: 5px; box-shadow: none; font-size: 1.3rem;
}
#btn-help:hover { transform: scale(1.1); color: #d6bdfb; }

/* Estado Desativado Profissional */
.btn-control:disabled {
    background-color: #44475a !important; 
    color: #888 !important;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}


/* ================= Container Principal da IDE ================= */
.ide-container {
    display: flex; flex: 1; gap: 8px; padding: 8px; min-height: 0; background-color: var(--bg-main);
}

.panel {
    background-color: var(--bg-panel); display: flex; flex-direction: column;
    border-radius: 8px; overflow: hidden;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.2); 
    border: 1px solid var(--border-color);
    min-height: 0;
}

.editor-panel { flex: 6; }
.tools-panel { flex: 4; gap: 8px; background-color: transparent; box-shadow: none; border: none;}

.panel-header {
    background-color: var(--bg-header); padding: 8px 15px;
    font-size: 0.85rem; font-weight: bold; letter-spacing: 0.5px;
    color: #e2e2e2; display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #222;
}

/* ================= Sobrescrevendo o CodeMirror ================= */
.CodeMirror { height: 100% !important; font-family: 'Consolas', 'Courier New', monospace; font-size: 15px; }

/* ================= Painéis Direitos ================= */
.sub-panel {
    background-color: var(--bg-panel); border-radius: 8px;
    display: flex; flex-direction: column; overflow: hidden;
    border: 1px solid var(--border-color);
}
.memory-panel { flex: 4; }
.console-panel { flex: 4; } 
.translation-panel { flex: 2; } 

.content-box {
    padding: 12px; overflow-y: auto; flex: 1; font-family: 'Consolas', monospace; font-size: 14px;
}

.terminal { background-color: #121212; color: #50fa7b; font-size: 15px;}
.code-output { background-color: #1e1e1e; color: #d4d4d4; white-space: pre-wrap; }
.lang-selector { background: #333; color: white; border: 1px solid #555; padding: 4px 8px; border-radius: 4px; outline: none;}

/* Blocos de Memória */
.memory-block {
    display: flex; justify-content: space-between; border-bottom: 1px dashed #444; padding: 6px 0;
}
.mem-address { color: #8be9fd; font-weight: bold;}
.mem-var { color: #ffb86c; }
.mem-val { color: #f1fa8c; font-weight: bold; }

/* ================= Destaques no Editor (Debug Visual) ================= */
.active-line { background-color: #2a4a2a !important; }
.error-line { background-color: #5a1a1a !important; }
.CodeMirror-gutter-wrapper { z-index: 2; }


/* ================= Cores Customizadas da Linguagem .alg ================= */
.cm-custom-struct { color: #ff79c6 !important; font-weight: bold; }
.cm-custom-loop { color: #8be9fd !important; font-style: italic; }
.cm-custom-cond { color: #f1fa8c !important; }
.cm-custom-type { color: #50fa7b !important; }
.cm-custom-array { color: #ffb86c !important; font-weight: bold; }
.cm-comment { color: #6272a4 !important; }


/* Terminal Interativo */
.terminal-input-line { display: flex; align-items: center; margin-top: 5px; }
#term-input {
    background: transparent; border: none; color: #fff; font-family: 'Consolas', monospace;
    font-size: 15px; font-weight: bold; outline: none; flex: 1; margin-left: 5px;
}
#term-input:focus { border-bottom: 1px solid #bd93f9; }


/* --- TELA CHEIA E CONTROLES DE PAINEL --- */
.panel-controls i {
    font-size: 1.1rem;
    color: #bd93f9;
    cursor: pointer;
    transition: color 0.2s, background-color 0.2s;
    padding: 6px;
    border-radius: 50%;
}

.panel-controls i:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.btn-expand { cursor: pointer; color: #8be9fd; transition: color 0.2s; padding: 4px; border-radius: 4px;}
.btn-expand:hover { color: #fff; background-color: rgba(255,255,255,0.1);}

.panel-maximized {
    position: fixed !important;
    top: 55px !important; /* Ajustado para a nova altura de 55px da Navbar */
    left: 0 !important;
    width: 100vw !important; 
    height: calc(100vh - 55px) !important; /* Ajustado para a nova altura de 55px da Navbar */
    z-index: 9000 !important; 
    background-color: var(--bg-panel) !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

.panel-maximized .CodeMirror,
.panel-maximized .content-box {
    /* 100vh total - 55px da navbar - ~35px do cabeçalho do painel = 90px */
    height: calc(100vh - 90px) !important; 
    max-height: none !important;
}

/* --- MODAL DE GUIA RÁPIDO (CHEAT SHEET) --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.8); z-index: 100000;
    display: flex; justify-content: center; align-items: center;
}
.modal-content {
    background: var(--bg-main); padding: 30px; border-radius: 12px;
    max-width: 650px; width: 90%; color: var(--text-light);
    border: 1px solid var(--accent); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    max-height: 85vh; overflow-y: auto; position: relative;
}
.close-btn {
    position: absolute; top: 15px; right: 20px;
    font-size: 2rem; cursor: pointer; color: #ff5555; transition: 0.2s; line-height: 1;
}
.close-btn:hover { color: #ff0000; transform: scale(1.1); }
.modal-content h2 { color: var(--accent); margin-bottom: 20px; border-bottom: 1px solid #444; padding-bottom: 10px;}
.modal-content h3 { color: #8be9fd; margin-top: 25px; font-size: 1.1rem; }
.modal-content pre {
    background: #282a36; padding: 15px; border-radius: 8px;
    border: 1px solid #444; margin-top: 10px; font-family: 'Consolas', monospace; color: #f8f8f2;
}
.modal-content code { color: #ff79c6; font-weight: bold;}


/* ================= FOOTER ================= */
.site-footer {
    background-color: var(--bg-panel);
    border-top: 1px solid var(--border-color);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: auto; 
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--accent);
}