/* 
    Maggus AI Code Studio - v1.1.2
    Fullscreen Styles & Fixes 
*/

/* Force full viewport in standalone mode */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.maggus-app-container {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1e1e1e;
    color: #cccccc;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2147483647; /* Maximum Z-Index to override all WP/Theme elements */
}

/* --- Form Elements Reset (Requested Fixes) --- */
.maggus-app-container button, 
.maggus-app-container input[type=reset], 
.maggus-app-container input[type=submit] {
    background-image: none;
    font-family: inherit;
    font-size: 1em;
    font-weight: inherit;
    letter-spacing: normal;
    padding: 5px 10px;
    text-transform: none;
    border-radius: 3px;
    border: 1px solid #3e3e3e;
}

.maggus-app-container input:read-only, 
.maggus-app-container input:read-write, 
.maggus-app-container input[type=checkbox], 
.maggus-app-container input[type=radio], 
.maggus-app-container select, 
.maggus-app-container textarea {
    max-width: 100%;
    box-sizing: border-box;
}

/* Fallback for admin context */
.maggus-admin-wrapper .maggus-app-container {
    position: relative;
    height: calc(100vh - 50px);
    width: 100%;
    z-index: 1;
}

/* --- Menubar --- */
#maggus-menubar {
    height: 30px;
    background: #333333;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 12px;
    color: #cccccc;
    user-select: none;
    border-bottom: 1px solid #1e1e1e;
    flex-shrink: 0;
}

.maggus-app-container .logo {
    font-weight: bold;
    color: #007acc;
    margin-right: 20px;
}

.menu-item {
    padding: 0 10px;
    cursor: pointer;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}
.menu-item:hover { background: #505050; }

.dropdown-menu {
    display: none;
    position: absolute;
    top: 30px;
    left: 0;
    background: #252526;
    border: 1px solid #454545;
    min-width: 200px;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);
}

.menu-action {
    padding: 8px 15px;
    color: #ccc;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.menu-action:hover { background: #094771; color: white; }
.menu-action i { width: 20px; text-align: center; margin-right: 8px; color: #aaa; }
.menu-action:hover i { color: white; }

.separator { height: 1px; background: #454545; margin: 4px 0; }

/* --- Project Tabs --- */
.project-tabs-bar {
    height: 32px;
    background: #181818;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #1e1e1e;
    padding-left: 10px;
    overflow-x: auto;
}

.project-tab {
    background: #2d2d2d;
    color: #888;
    padding: 0 15px;
    height: 26px;
    line-height: 26px;
    font-size: 12px;
    margin-right: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    border: 1px solid transparent;
}

.project-tab:hover {
    background: #3e3e3e;
    color: #ccc;
}

.project-tab.active {
    background: #0e639c; /* Blue to distinguish from file tabs */
    color: white;
    font-weight: 600;
}

.project-tab .pj-icon { margin-right: 6px; }
.project-tab .pj-close {
    margin-left: 8px;
    opacity: 0.6;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    line-height: 14px;
    text-align: center;
}
.project-tab .pj-close:hover { opacity: 1; background: rgba(255,255,255,0.2); }

/* --- Tabs --- */
.tab-bar-container {
    height: 35px;
    background: #252526;
    overflow-x: auto;
    overflow-y: hidden;
    border-bottom: 1px solid #1e1e1e;
    flex-shrink: 0;
}

.editor-tabs {
    display: flex;
    height: 100%;
}

.editor-tab {
    padding: 0 10px;
    height: 100%;
    display: flex;
    align-items: center;
    background: #2d2d2d;
    color: #999;
    border-right: 1px solid #1e1e1e;
    cursor: pointer;
    min-width: 120px;
    max-width: 250px;
    font-size: 12px;
}

.editor-tab.active {
    background: #1e1e1e;
    color: #fff;
    border-top: 2px solid #007acc;
}

.editor-tab .tab-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-left: 5px;
}

.editor-tab .tab-close {
    margin-left: 8px;
    width: 16px;
    height: 16px;
    text-align: center;
    line-height: 16px;
    border-radius: 50%;
    font-size: 14px;
}
.editor-tab .tab-close:hover { background: #444; color: white; }

.editor-tab.dirty .tab-name::before {
    content: "● ";
    color: #fff;
    font-size: 10px;
}

/* --- Workspace & Columns --- */
#maggus-workspace { display: flex; flex: 1; overflow: hidden; }
.app-column { display: flex; flex-direction: column; border-right: 1px solid #111; background: #252526; min-width: 200px; }
.app-column.hidden { display: none !important; }
.app-column.flex-grow { flex: 1; min-width: 400px; }

#col-explorer { width: 250px; flex-shrink: 0; }
#col-db { width: 220px; flex-shrink: 0; }
#col-aggregator { width: 300px; flex-shrink: 0; }
#col-ai { width: 300px; flex-shrink: 0; }

.column-header {
    height: 30px;
    background: #252526;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    border-bottom: 1px solid #1e1e1e;
    color: #aaa;
}

/* Sub-panels */
.sub-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.sub-header { background: #333; padding: 4px 10px; font-size: 11px; display: flex; justify-content: space-between; align-items: center; color: #ddd; }
.tree-container { flex: 1; overflow-y: auto; padding: 5px 0; background: #252526; }
.tree-item { padding: 3px 10px; cursor: pointer; display: flex; align-items: center; color: #ccc; font-size: 13px; }
.tree-item:hover { background: #2a2d2e; }
.tree-item.selected { background: #37373d; color: white; }
.tree-item i { margin-right: 8px; width: 16px; text-align: center; }
.fa-folder { color: #dcb67a; }
.fa-file-code { color: #4dc9b0; }
.splitter-horizontal { height: 1px; background: #000; flex-shrink: 0; }

/* Inputs & Buttons */
.maggus-app-container input, 
.maggus-app-container select, 
.maggus-app-container textarea {
    background: #3c3c3c;
    border: 1px solid #3c3c3c;
    color: #eee;
    padding: 5px;
    font-size: 12px;
}
.maggus-app-container input:focus, 
.maggus-app-container textarea:focus { border-color: #007acc; outline: none; }

.maggus-app-container button.button {
    background: #3e3e3e; color: #ccc; border: none; padding: 6px 12px; cursor: pointer; border-radius: 2px;
}
.maggus-app-container button.button:hover { background: #4e4e4e; color: white; }
.maggus-app-container button.button-primary { background: #0e639c; color: white; }
.maggus-app-container button.button-primary:hover { background: #1177bb; }

#monaco-wrapper { flex: 1; }
#aggregator-editor { flex: 1; resize: none; background: #1e1e1e; border: none; padding: 10px; font-family: 'Consolas', monospace; color: #d4d4d4; }
.agg-toolbar { padding: 5px; background: #333; display: flex; gap: 5px; }

/* AI Chat */
.ai-chat-container { flex: 1; display: flex; flex-direction: column; background: #1e1e1e; }
#ai-history { flex: 1; padding: 15px; overflow-y: auto; }
.ai-msg { margin-bottom: 15px; padding: 10px; border-radius: 4px; background: #2d2d2d; line-height: 1.4; }
.ai-msg.user { background: #0e639c; color: white; margin-left: 20px; }
.ai-msg.bot { background: #333; color: #ddd; margin-right: 20px; border: 1px solid #444; }
.ai-input { display: flex; border-top: 1px solid #333; height: 80px; padding: 5px; background: #252526; }
#ai-prompt { flex: 1; border: none; resize: none; background: transparent; color: white; font-family: inherit; }
#btn-send-ai { width: 50px; background: #0e639c; border: none; color: white; cursor: pointer; border-radius: 4px; margin-left: 5px; }

/* Footer */
#maggus-footer { height: 22px; background: #007acc; color: white; display: flex; align-items: center; padding: 0 10px; font-size: 11px; flex-shrink: 0; }

/* Modals */
.maggus-modal {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2147483647;
}
.maggus-modal.hidden { display: none; }

.modal-dialog {
    background: #252526;
    width: 500px;
    border: 1px solid #454545;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    border-radius: 4px;
}

.modal-header {
    background: #333;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #1e1e1e;
}
.modal-header h3 { margin: 0; font-size: 14px; color: #fff; font-weight: 600; }
.modal-close { background: none; border: none; color: #aaa; font-size: 20px; cursor: pointer; line-height: 1; }
.modal-close:hover { color: #fff; }

.modal-body { padding: 20px; }

.form-grid {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 15px;
    align-items: center;
}
.form-grid label { text-align: right; color: #ccc; font-size: 13px; }

.modal-footer {
    padding: 12px 20px;
    background: #2d2d2d;
    border-top: 1px solid #1e1e1e;
    text-align: right;
}

.input-group { display: flex; gap: 10px; margin-bottom: 15px; }
.input-group input { flex: 1; }

.list-container {
    border: 1px solid #3c3c3c;
    height: 250px;
    overflow-y: auto;
    background: #1e1e1e;
}
#project-list { margin: 0; padding: 0; list-style: none; }
#project-list li { padding: 10px 15px; border-bottom: 1px solid #333; cursor: pointer; display: flex; align-items: center; }
#project-list li i { margin-right: 10px; color: #dcb67a; }
#project-list li:hover { background: #37373d; }

