:root {
  --bg-color: #020604;
  --pane-bg: rgba(10, 18, 14, 0.25);
  --strip-bg: rgba(6, 12, 9, 0.35);
  --text-main: #e0e0e0;
  --accent-color: #2ecc71; 
  --btn-hover: rgba(255, 255, 255, 0.1);
  --border-color: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Base Body with Flowing Dark Metallic Waves */
body, html {
  margin: 0; padding: 0; height: 100vh;
  background-color: var(--bg-color); 
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 900' preserveAspectRatio='xMidYMid slice'%3E%3Cdefs%3E%3ClinearGradient id='bg' x1='0%25' y1='0%25' x2='100%25' y2='100%25'%3E%3Cstop offset='0%25' stop-color='%230a1c12'/%3E%3Cstop offset='100%25' stop-color='%23020804'/%3E%3C/linearGradient%3E%3ClinearGradient id='wave1' x1='0%25' y1='0%25' x2='100%25' y2='0%25'%3E%3Cstop offset='0%25' stop-color='%2307150c'/%3E%3Cstop offset='50%25' stop-color='%230d2417'/%3E%3Cstop offset='100%25' stop-color='%23050f09'/%3E%3C/linearGradient%3E%3ClinearGradient id='wave2' x1='100%25' y1='0%25' x2='0%25' y2='100%25'%3E%3Cstop offset='0%25' stop-color='%23030a06'/%3E%3Cstop offset='50%25' stop-color='%230a1f13'/%3E%3Cstop offset='100%25' stop-color='%23020503'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='100%25' height='100%25' fill='url(%23bg)'/%3E%3Cpath d='M-100,300 C400,600 800,-100 1540,400 L1540,950 L-100,950 Z' fill='url(%23wave1)' stroke='rgba(255,255,255,0.1)' stroke-width='1'/%3E%3Cpath d='M-100,550 C400,850 900,200 1540,650 L1540,950 L-100,950 Z' fill='url(%23wave2)' stroke='rgba(255,255,255,0.15)' stroke-width='1.5'/%3E%3Cpath d='M-100,700 C450,950 1000,450 1540,750 L1540,950 L-100,950 Z' fill='%23020804' stroke='rgba(255,255,255,0.08)' stroke-width='2'/%3E%3Cpath d='M-100,150 C500,-100 900,500 1540,150' fill='none' stroke='rgba(255,255,255,0.08)' stroke-width='2'/%3E%3Cpath d='M-100,165 C480,-80 880,510 1540,165' fill='none' stroke='rgba(255,255,255,0.03)' stroke-width='1'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 
  overflow: hidden;
}

/* Enforce monospace only on code areas */
.cm-editor, code, pre, #chat-input {
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', Courier, monospace !important;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.1); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

#app-container { display: flex; height: 100vh; width: 100vw; }

.pane { 
  flex: 1; 
  background-color: var(--pane-bg); 
  height: 100%; 
  overflow-y: auto; 
  backdrop-filter: blur(16px); 
  -webkit-backdrop-filter: blur(16px);
    transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1), flex-basis 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  }
.flex-col { display: flex; flex-direction: column; }
.editor-container { flex-grow: 1; overflow: hidden; background: transparent; }
.hidden { display: none !important; }

.edge-strip {
  width: 30px; background-color: var(--strip-bg); display: flex; flex-direction: row;
  border-left: 1px solid var(--border-color); border-right: 1px solid var(--border-color); flex-shrink: 0;
  backdrop-filter: blur(16px);
}
.strip-btn {
  flex: 1; background: none; border: none; color: #666; cursor: pointer;
  font-size: 1rem; font-weight: 300; transition: all 0.3s ease;
}
.strip-btn:hover { background-color: var(--btn-hover); color: var(--text-main); }
#center-strip .strip-btn:first-child { border-right: 1px solid rgba(255,255,255,0.05); }

/* --- Sleek Minimalist Tabs --- */
.tab-bar { 
  display: flex; 
  background-color: rgba(5, 5, 8, 0.3); 
  border-bottom: 1px solid var(--border-color); 
  min-height: 34px; 
  height: auto; 
  align-items: flex-start;
  flex-shrink: 0; 
  backdrop-filter: blur(16px);
  padding: 4px 8px;
}
#left-tabs, #right-tabs { display: flex; flex-wrap: wrap; flex-grow: 1; gap: 4px;}
.slate-tab {
  padding: 6px 12px; color: #777; background-color: transparent; border-radius: 16px;
  cursor: pointer; font-size: 0.75rem; user-select: none; transition: all 0.2s;
  display: flex; align-items: center; gap: 8px; white-space: nowrap; flex-shrink: 0; 
  font-weight: 500; letter-spacing: 0.5px;
}
.slate-tab:hover { background-color: rgba(255, 255, 255, 0.05); color: #ccc; }
.slate-tab.active { 
    background-color: rgba(46, 204, 113, 0.1); color: #fff; 
  border: 1px solid rgba(46, 204, 113, 0.2);
  }

/* Tab Action Buttons */
.tab-edit-btn, .tab-close-btn { 
  font-size: 0.65rem; opacity: 0; transition: 0.2s; text-transform: uppercase; font-weight: 600; padding: 2px 6px; border-radius: 8px; 
}
.slate-tab:hover .tab-edit-btn, .slate-tab:hover .tab-close-btn { opacity: 0.6; }
.tab-edit-btn:hover { opacity: 1 !important; background: rgba(255,255,255,0.1); color: #fff; }
.tab-close-btn:hover { opacity: 1 !important; background: rgba(255,50,50,0.2); color: #ff9999; }
.restore-tab { color: #66cc66 !important; font-size: 0.75rem !important; text-transform: uppercase;}
.restore-tab:hover { background-color: rgba(0, 255, 0, 0.1) !important; color: #99ff99 !important; }

/* --- Glass Panels & Inputs --- */
.glass-panel {
  background: rgba(15,15,18,0.7); 
  border: 1px solid rgba(255,255,255,0.1); 
  box-shadow: 0 10px 40px rgba(0,0,0,0.5); 
  backdrop-filter: blur(24px);
}

.sleek-input {
  background: rgba(0, 0, 0, 0.3); 
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-main); 
  border-radius: 8px; 
  box-sizing: border-box; 
  transition: 0.2s;
  font-family: inherit;
  font-size: 0.85rem;
}
.sleek-input:focus {
  outline: none; 
    border-color: rgba(46, 204, 113, 0.4); 
    background: rgba(0, 0, 0, 0.5);
}

/* --- Sleek Pill Buttons --- */
.action-btn { 
  background: rgba(255,255,255,0.03); color: #aaa; border: 1px solid rgba(255,255,255,0.1); 
  padding: 6px 14px; cursor: pointer; border-radius: 20px; font-family: inherit; transition: 0.2s; 
  font-size: 0.7rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap;
}
.action-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.danger-btn { background: rgba(255,50,50,0.05); color: #ff6666; border-color: rgba(255,50,50,0.2); }
.danger-btn:hover { background: rgba(255,50,50,0.15); color: #ff9999; border-color: rgba(255,50,50,0.4); }
.attach-btn { padding: 12px 18px; font-size: 0.75rem; }

#btn-publish {
  background: rgba(46, 204, 113, 0.1); border: 1px solid rgba(46, 204, 113, 0.2); color: #58d68d; 
  padding: 6px 16px; margin-left: auto; cursor: pointer; font-family: inherit; font-weight: 500; 
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.5px; border-radius: 20px; 
  transition: 0.2s; align-self: center;
}
#btn-publish:hover { background: rgba(46, 204, 113, 0.25); color: #fff; }

.cm-editor { height: 100%; background: transparent !important; }

/* --- Chat Pane --- */
#chat-pane { background-color: transparent; }
#chat-header {
  display: flex; justify-content: space-between; align-items: center; 
  padding: 10px 16px; background: rgba(5, 5, 8, 0.3); border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(16px); z-index: 10;
}
#view-toggles { display: flex; gap: 8px; align-items: center; }
.view-tab {
  background: transparent; border: 1px solid transparent; color: #777; cursor: pointer;
  font-family: inherit; font-size: 0.7rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; 
  padding: 6px 12px; border-radius: 20px; transition: 0.2s;
}
.view-tab:hover { color: #aaa; background: rgba(255,255,255,0.05); }
.view-tab.active-view { color: #fff; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.1); }

.sleek-select {
  background: rgba(0,0,0,0.2); color: #aaa; border: 1px solid rgba(255,255,255,0.1); 
  border-radius: 20px; padding: 6px 12px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.5px;
  outline: none; max-width: 120px; text-overflow: ellipsis; backdrop-filter: blur(10px); cursor: pointer;
}
.alt-select { background: rgba(46,204,113,0.05); color: #58d68d; border-color: rgba(46,204,113,0.2); }

#chat-history, #context-history { flex-grow: 1; padding: 25px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }

/* Glassmorphism Chat Bubbles */
.chat-msg { 
  padding: 14px 18px; border-radius: 12px; max-width: 88%; line-height: 1.5; font-size: 0.85rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.ai-msg { background-color: rgba(20, 22, 30, 0.4); align-self: flex-start; border: 1px solid rgba(255,255,255,0.05); border-left: 2px solid var(--accent-color); }
.user-msg { background-color: rgba(46, 204, 113, 0.08); align-self: flex-end; color: #ffffff; border: 1px solid rgba(46, 204, 113, 0.15); }

#chat-input-container { padding: 15px 20px 20px 20px; background-color: rgba(5, 5, 8, 0.3); border-top: 1px solid var(--border-color); backdrop-filter: blur(16px); }

/* --- File Toggles (Chips) --- */
#file-toggles { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.file-chip {
  background: rgba(255, 255, 255, 0.03); color: #666; border: 1px solid rgba(255, 255, 255, 0.1); padding: 4px 10px;
  border-radius: 12px; cursor: pointer; font-size: 0.7rem; font-family: monospace; user-select: none; transition: all 0.2s;
}
.file-chip:hover { background: rgba(255, 255, 255, 0.1); color: #aaa; }
.file-chip.included { background: rgba(46, 204, 113, 0.1); color: #58d68d; border: 1px solid rgba(46, 204, 113, 0.3); }

#chat-input {
  width: 100%; padding: 14px; background-color: rgba(0, 0, 0, 0.3); border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-main); border-radius: 12px; box-sizing: border-box; resize: none; transition: 0.2s;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.2); font-size: 0.85rem;
}
#chat-input:focus { outline: none; border-color: rgba(46, 204, 113, 0.4); background-color: rgba(0, 0, 0, 0.4); }

/* --- Memory Blocks --- */
.memory-block { background: rgba(20, 20, 25, 0.3); border: 1px solid rgba(255,255,255,0.05); border-radius: 8px; padding: 14px; backdrop-filter: blur(12px); }
.memory-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; color: #666; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 8px; }
.memory-content { font-size: 0.8rem; white-space: pre-wrap; color: #bbb; font-family: monospace; }

/* --- Project Manager Modal --- */
.project-item { display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,0.02); padding: 12px 18px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.03); transition: 0.2s; }
.project-item:hover { background: rgba(255,255,255,0.05); }
.project-item.active-project { border-color: rgba(46, 204, 113, 0.2); background: rgba(46, 204, 113, 0.05); }
.project-info { flex-grow: 1; display: flex; flex-direction: column; cursor: pointer; }
.project-name { font-weight: 500; font-size: 0.9rem; letter-spacing: 0.5px;}
.project-status { font-size: 0.7rem; color: #666; margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.project-actions { display: flex; gap: 8px; }

/* --- Home Dashboard & Idea Agent --- */
.home-project-card {
  background: rgba(255, 255, 255, 0.02); border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 16px; padding: 25px;
  cursor: pointer; width: 180px; transition: 0.3s; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; backdrop-filter: blur(8px);
}
.home-project-card:hover { background: rgba(255, 255, 255, 0.05); border-color: rgba(255,255,255,0.15); transform: translateY(-3px); box-shadow: var(--glass-shadow); }
.home-project-card .proj-name { font-weight: 500; font-size: 0.95rem; color: #ccc; letter-spacing: 0.5px; }

.btn-start-project { margin: 20px 0; display: block; }

/* --- App Grid Icons --- */
.app-icon-wrapper {
  display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer;
  transition: transform 0.2s, filter 0.2s;
}
.app-icon-wrapper:hover {
  transform: scale(1.05);
  filter: brightness(1.2);
}
.app-icon-square {
  width: 72px; height: 72px; border-radius: 18px; 
  background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.02));
  box-shadow: 0 4px 15px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
  display: flex; justify-content: center; align-items: center;
  overflow: hidden; border: 1px solid rgba(255,255,255,0.05);
  backdrop-filter: blur(10px);
}
.app-icon-label {
  font-size: 0.75rem; color: #e0e0e0; text-align: center; font-weight: 500;
  letter-spacing: 0.3px; max-width: 80px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* --- Sandbox Preview Styles --- */
.iframe-desktop { 
  width: 100%; 
  height: 100%; 
  border-radius: 8px; 
}
.iframe-mobile {
  width: 375px; 
  height: 812px;
  border: 12px solid #222 !important;
  border-top-width: 40px !important;
  border-bottom-width: 40px !important;
  border-radius: 30px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
  max-height: 100%;
}


