:root {
    --blurple: #6366f1;
    --blurple-hover: #4f46e5;
    --bg-main: #09090b;
    --bg-sidebar: rgba(9, 9, 11, 0.85);
    --bg-tertiary: rgba(24, 24, 27, 0.8);
    --bg-secondary: rgba(24, 24, 27, 0.9);
    --text-normal: #e4e4e7;
    --text-muted: #a1a1aa;
    --text-header: #ffffff;
    --header-primary: #ffffff;
    --border: rgba(63, 63, 70, 0.4);
    --green: #10b981;
    --red: #ef4444;
    --yellow: #f59e0b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', 'Whitney', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-normal);
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-tertiary); }
::-webkit-scrollbar-thumb { background: #1a1b1e; border-radius: 10px; }

/* Navbar / Titlebar */
.navbar {
    height: 48px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.2);
    z-index: 100;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    color: var(--blurple);
    font-size: 24px;
}

.project-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--header-primary);
}

.nav-right {
    display: flex;
    gap: 8px;
}

.btn {
    height: 36px;
    padding: 0 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.3px;
}

.btn-primary { 
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); 
    color: white; 
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}
.btn-primary:hover { 
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
}

.btn-secondary { 
    background: rgba(255, 255, 255, 0.04); 
    color: var(--text-normal); 
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.btn-secondary:hover { 
    background: rgba(255, 255, 255, 0.08); 
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

/* Sub Nav / Tabs */
.sub-nav {
    height: 48px;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 8px;
}

.tab {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
}

.tab:hover { background: rgba(255,255,255,0.05); color: var(--text-normal); }
.tab.active { background: rgba(255,255,255,0.1); color: var(--header-primary); }

main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-title {
    padding: 16px 16px 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.file-list { padding: 0 8px; }

.file-item {
    height: 34px;
    padding: 0 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    cursor: pointer;
}

.file-item:hover { background: rgba(255,255,255,0.05); color: var(--text-normal); }
.file-item.active { background: rgba(255,255,255,0.1); color: white; }

.file-icon { color: var(--text-muted); }

/* Workspace */
.workspace-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at 10% 20%, rgba(88, 101, 242, 0.15) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(240, 178, 50, 0.1) 0%, transparent 40%),
                var(--bg-main);
}

#blocklyDiv { flex: 1; }

/* Multi-Panel Right Area */
.right-panel {
    width: 450px;
    background: var(--bg-sidebar);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.panel-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
}

.panel-header {
    height: 36px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Align and prevent icon squishing inside node headers */
.title-box {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}
.title-box svg, .title-box i {
    width: 16px !important;
    height: 16px !important;
    flex-shrink: 0 !important;
    display: inline-block !important;
}

.drag-drawflow svg, .drag-drawflow i {
    width: 14px !important;
    height: 14px !important;
    flex-shrink: 0 !important;
    display: inline-block !important;
}

/* Mock Chat Styles */
.mock-chat {
    flex: 1;
    background: var(--bg-main);
    display: flex;
    flex-direction: column;
    padding: 16px;
    overflow-y: auto;
}

.chat-message {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--blurple);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.msg-content { flex: 1; }
.msg-header { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.msg-user { font-weight: 600; color: white; }
.msg-time { font-size: 12px; color: var(--text-muted); }
.msg-body { font-size: 15px; color: var(--text-normal); }

.chat-input-wrapper {
    padding: 0 16px 16px;
    background: var(--bg-main);
}

.chat-input {
    width: 100%;
    background: #383A40;
    border-radius: 8px;
    padding: 10px 16px;
    border: none;
    color: var(--text-normal);
    outline: none;
}

/* --- Drawflow Tabs --- */
.tabs-bar {
    display: flex;
    background: #1E1F22;
    padding: 5px 10px 0;
    border-bottom: 1px solid #3F4147;
    height: 35px;
    align-items: center;
}
.tab {
    padding: 8px 16px;
    background: #2B2D31;
    color: #949BA4;
    border-radius: 8px 8px 0 0;
    margin-right: 5px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.tab:hover {
    color: white;
}
.tab.active {
    background: #313338;
    color: white;
}
.tab-add {
    padding: 8px 12px;
    color: #949BA4;
    cursor: pointer;
    font-weight: bold;
}
.tab-add:hover {
    color: white;
}

/* --- Code File Tabs --- */
.code-tab {
    padding: 10px 16px;
    background: #1E1F22;
    color: #949BA4;
    cursor: pointer;
    font-size: 13px;
    border-right: 1px solid #3F4147;
    transition: all 0.2s;
}
.code-tab:hover {
    color: white;
    background: #2B2D31;
}
.code-tab.active {
    background: #2B2D31;
    color: white;
    border-top: 2px solid #5865F2;
}

/* Embed Preview Styles */
.embed-preview {
    padding: 12px;
    background: #2B2D31;
    border-left: 4px solid var(--blurple);
    border-radius: 4px;
    max-width: 400px;
    margin: 8px;
}

.embed-title { font-weight: 600; color: white; margin-bottom: 8px; }
.embed-desc { font-size: 14px; color: var(--text-normal); }

/* Code Container */
.code-container {
    flex: 1;
    background: var(--bg-tertiary);
    padding: 16px;
    overflow: auto;
}

pre code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    color: #DBDEE1;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-main);
    width: 440px;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.modal-title { font-size: 24px; font-weight: 700; color: white; margin-bottom: 8px; }
.modal-body { color: var(--text-muted); margin-bottom: 24px; }

/* Blockly Customization (Removed) */
/* Drawflow overrides */
#drawflow { width: 100%; height: 100%; position: relative; }
.drawflow .drawflow-node { 
    background: rgba(18, 18, 22, 0.75); 
    border: 1px solid rgba(255, 255, 255, 0.08); 
    border-radius: 12px; 
    color: var(--text-normal); 
    min-width: 260px; 
    padding: 0; 
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4); 
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.drawflow .drawflow-node.selected { 
    border: 1px solid rgba(99, 102, 241, 0.6); 
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.25), 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}
.drawflow .connection .main-path { 
    stroke: rgba(99, 102, 241, 0.5); 
    stroke-width: 3px; 
    transition: all 0.2s ease;
}
.drawflow .connection .main-path:hover { 
    stroke: rgba(99, 102, 241, 0.85); 
    stroke-width: 4px;
}
.drawflow .drawflow-node .input, .drawflow .drawflow-node .output { 
    width: 14px; 
    height: 14px; 
    border: 2px solid rgba(255, 255, 255, 0.2); 
    background: #09090b; 
    border-radius: 50%; 
    transition: all 0.2s ease;
}
.drawflow .drawflow-node .input:hover, .drawflow .drawflow-node .output:hover { 
    background: #6366f1; 
    border-color: #6366f1;
    transform: scale(1.2);
}

.df-input { 
    width: 100%; 
    background: rgba(9, 9, 11, 0.5); 
    border: 1px solid rgba(255, 255, 255, 0.08); 
    border-radius: 6px; 
    padding: 8px; 
    color: var(--text-normal); 
    outline: none; 
    box-sizing: border-box; 
    font-size: 13px;
    transition: all 0.2s ease;
}
.df-input:focus { 
    border-color: rgba(99, 102, 241, 0.6); 
    background: rgba(9, 9, 11, 0.8);
}

.sidebar-title { padding: 16px; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.node-list { display: flex; flex-direction: column; gap: 8px; padding: 0 16px; }
.drag-drawflow { background: rgba(24, 24, 27, 0.4); border: 1px solid var(--border); border-radius: 6px; padding: 12px; font-size: 13px; font-weight: 500; cursor: grab; display: flex; align-items: center; gap: 8px; transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1); color: var(--text-normal); }
.drag-drawflow:hover { transform: translateX(4px); background: rgba(99, 102, 241, 0.05); color: var(--blurple); border-color: rgba(99, 102, 241, 0.3); }

/* Blueprint Preloader Animations */
.bp-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(99, 102, 241, 0.1);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

