/* ============================================================
   Mundo phpBB Workspace - Tema Consolidado (IDE Focus)
   Atualização: Layout Global com Barra de Topo + Indentação
   ============================================================ */

:root {
    --wsp-bg-main: #1e1e1e;
    --wsp-bg-sidebar: #252526;
    --wsp-bg-toolbar: #2d2d2d;
    --wsp-border: #333;
    --wsp-blue: #007acc;
    --wsp-blue-hover: #0062a3;
    --wsp-text: #d4d4d4;
    --wsp-text-muted: #888;
    --wsp-accent: #569cd6;
    --wsp-folder: #dcb67a;
    --wsp-danger: #f44336;
    --wsp-success: #28a745;
    --wsp-warning: #e2c08d;
    
    /* Diff GitHub Dark style */
    --wsp-diff-add-bg: rgba(46, 160, 67, 0.25);
    --wsp-diff-add-line: #3fb950;
    --wsp-diff-remove-bg: rgba(248, 81, 73, 0.25);
    --wsp-diff-remove-line: #f85149;
}

/* --- Estrutura de Container Global (Novo) --- */
.workspace-container {
    display: flex;
    flex-direction: column;
    height: 700px;
    background: var(--wsp-bg-main);
    color: var(--wsp-text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif, "Segoe UI Emoji";
    border: 1px solid var(--wsp-border);
    overflow: hidden; /* Garante que o scroll fique apenas no corpo e sidebar */
}

/* --- Barra de Topo Global (Novo Local) --- */
.workspace-header {
    height: 40px;
    background: var(--wsp-bg-toolbar);
    border-bottom: 1px solid var(--wsp-bg-main);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    flex-shrink: 0; /* Não deixa a barra esmagar */
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}

.app-name {
    font-weight: bold;
    color: var(--wsp-accent);
}

.path-divider {
    color: var(--wsp-border);
    margin: 0 5px;
}

#current-file {
    font-family: 'Consolas', monospace;
    color: var(--wsp-text);
}

/* --- Corpo Principal (Sidebar + Editor) --- */
.workspace-main-body {
    display: flex;
    flex: 1;
    min-height: 0; /* Vital para o scroll interno funcionar */
}

/* --- Sidebar --- */
.workspace-sidebar {
    width: 280px;
    background: var(--wsp-bg-sidebar);
    border-right: 1px solid var(--wsp-border);
    overflow-y: auto;
    user-select: none;
    display: flex;
    flex-direction: column;
}

.sidebar-title {
    color: #fff; padding: 10px 15px 5px 15px; margin: 0;
    font-size: 11px; letter-spacing: 1px; text-transform: uppercase; opacity: 0.7;
}

.sidebar-search-container {
    padding: 10px 15px; position: relative; display: flex; align-items: center;
}

.sidebar-search-container i { position: absolute; left: 22px; font-size: 11px; color: var(--wsp-text-muted); }

#wsp-sidebar-filter {
    width: 100%; background: #3c3c3c; border: 1px solid var(--wsp-border);
    color: #ccc; padding: 5px 10px 5px 25px; font-size: 12px; outline: none; border-radius: 2px;
}

.sidebar-actions-container {
    padding: 5px 15px;
    display: flex;
    gap: 8px;
}

.wsp-btn-sidebar {
    flex: 1;
    font-size: 11px !important;
    padding: 5px !important;
    text-align: center;
    background: #333 !important;
    color: #ccc !important;
    border: 1px solid #444 !important;
}

.wsp-btn-sidebar:hover { background: #444 !important; color: #fff !important; }

.sidebar-divider { border: none; border-top: 1px solid var(--wsp-border); margin: 5px 0; }

/* --- Árvore de Projetos & Diretórios --- */
.project-group { margin-bottom: 5px; list-style: none; padding: 0; }

.project-title { 
    display: flex;
    flex-direction: column;
    padding: 8px 15px;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--wsp-border);
    transition: background 0.2s;
}

.project-title.drag-over { background: rgba(0, 122, 204, 0.2); border: 1px dashed var(--wsp-blue); }

.project-name-row {
    font-weight: bold;
    color: var(--wsp-accent);
    font-size: 12px;
    margin-bottom: 5px;
}

.project-actions-toolbar {
    display: flex;
    gap: 12px;
    padding-top: 5px;
    opacity: 0.6;
}

.project-actions-toolbar:hover { opacity: 1; }

.project-actions-toolbar a {
    text-decoration: none;
    font-size: 13px;
    color: var(--wsp-text);
    transition: transform 0.1s, color 0.2s;
}

.project-actions-toolbar a:hover { transform: scale(1.2); }

/* Cores específicas da Toolbar */
.open-search-replace:hover { color: #dcdcaa; }
.trigger-upload:hover { color: #9cdcfe; }
.add-folder-to-project:hover { color: var(--wsp-folder); }
.add-file-to-project:hover { color: var(--wsp-success); }
.delete-project:hover { color: var(--wsp-danger); }

/* --- Estrutura da Árvore (Recursiva) --- */
.folder-item { list-style: none; position: relative; }

.folder-title {
    position: relative;
    display: flex;
    align-items: center;
    padding: 4px 15px;
    color: var(--wsp-folder);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.folder-title:hover { background: #2a2d2e; }

.folder-context-actions {
    display: none; position: absolute; right: 10px;
    background: #2a2d2e; padding-left: 10px; gap: 8px;
    border-radius: 2px;
    box-shadow: -5px 0 10px #2a2d2e;
}

.folder-title:hover .folder-context-actions { display: flex; align-items: center; }

.folder-content { 
    padding-left: 10px; 
    margin-left: 18px; 
    border-left: 1px solid #444; 
    transition: border-color 0.2s;
}

.folder-item:hover > .folder-content { border-left-color: #666; }

/* --- Arquivos --- */
.file-list { list-style: none; padding: 0; }

.file-item {
    padding: 3px 15px 3px 10px; display: flex; align-items: center;
    justify-content: space-between; transition: background 0.2s;
    border-left: 2px solid transparent;
}

.file-item:hover { background: #2a2d2e; }
.active-file { background: #37373d !important; border-left: 2px solid var(--wsp-blue) !important; }

.file-item i { font-size: 12px; color: #9cdcfe; margin-right: 8px; }
.file-item a { color: var(--wsp-text); text-decoration: none; font-size: 12px; flex-grow: 1; display: block; }

.file-actions { display: none; gap: 8px; }
.file-item:hover .file-actions { display: flex; }

/* --- Editor Area --- */
.workspace-editor-area { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    min-width: 0; 
    background: var(--wsp-bg-main);
}

#editor { 
    flex: 1; 
    width: 100%; 
    font-size: 14px; 
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace !important;
}

/* --- Ações do Cabeçalho (Botoes) --- */
.header-actions { display: flex; align-items: center; gap: 8px; }

.btn-tool {
    background: #333;
    color: #ccc;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 2px;
    transition: background 0.2s, color 0.2s;
}

.btn-tool:hover { background: #444; color: #fff; }

.btn-save { background: var(--wsp-blue); color: #fff; border: none; padding: 5px 12px; border-radius: 2px; cursor: pointer; font-size: 11px; }
.btn-save:hover { background: var(--wsp-blue-hover); }
.btn-save:disabled { background: #444; opacity: 0.6; cursor: not-allowed; }

.btn-copy { background: #444; color: #fff; border: none; padding: 5px 12px; border-radius: 2px; cursor: pointer; font-size: 11px; }
.btn-copy:hover { background: #555; }

/* Fullscreen Mode (Aplicado ao container global) */
.workspace-container.fullscreen-mode {
    position: fixed !important;
    top: 0 !important; left: 0 !important;
    width: 100vw !important; height: 100vh !important;
    z-index: 99999 !important;
    margin: 0 !important; border: none !important;
}

/* --- Modais Customizados --- */
#wsp-custom-modal button:hover { filter: brightness(1.2); }
#wsp-custom-modal input:focus { border-color: var(--wsp-blue) !important; }

#refresh-phpbb-cache i.fa-spin { color: var(--wsp-warning); }

/* --- Responsividade --- */
@media (max-width: 768px) {
    .workspace-main-body { flex-direction: column; }
    .workspace-sidebar { width: 100%; height: 250px; border-right: none; border-bottom: 1px solid var(--wsp-border); }
    .workspace-container { height: auto; min-height: 600px; }
}

/* Estilização para visualização de Diff no editor ACE */
.ace_marker-layer .ace_bracket { display: none !important; }

/* Cores para o modo Diff/Changelog */
.ace_content .ace_layer.ace_text-layer .ace_line:has(content: "^+") {
    background-color: rgba(40, 167, 69, 0.2) !important;
    color: #afffbe !important;
}

.ace_content .ace_layer.ace_text-layer .ace_line:has(content: "^-") {
    background-color: rgba(220, 53, 69, 0.2) !important;
    color: #ffdce0 !important;
}

/* Estilo para o cabeçalho do arquivo no changelog */
.ace_content .ace_layer.ace_text-layer .ace_line:has(content: "^==") {
    color: #ce9178 !important;
    font-weight: bold;
}

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

/* Animação para as notificações (Toasts) */
@keyframes wspFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Estilo extra para o botão de limpar (vermelho discreto) */
#clear-changelog:hover {
    color: #f44336 !important;
}