/* ============================================
   RAJAMODS7.AI — IDE STYLE DESIGN SYSTEM
   ============================================ */

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

:root {
  --bg-base: #0d0d0f;
  --bg-surface: #111114;
  --bg-elevated: #18181d;
  --bg-hover: #1e1e25;
  --bg-active: #22222a;
  --border: #2a2a35;
  --border-light: #1e1e28;
  --accent: #ccff00;
  --accent-dim: rgba(204,255,0,0.12);
  --accent-glow: rgba(204,255,0,0.25);
  --pink: #ff3cac;
  --pink-dim: rgba(255,60,172,0.12);
  --blue: #4d9fff;
  --blue-dim: rgba(77,159,255,0.12);
  --text-primary: #f0f0f5;
  --text-secondary: #8888a0;
  --text-muted: #55556a;
  --text-code: #e0e0f0;
  --font-ui: 'Space Grotesk', sans-serif;
  --font-display: 'Syne', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --topbar-h: 48px;
  --panel-w: 240px;
  --preview-w: 42%;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============ TOPBAR ============ */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
}

.topbar-left { display: flex; align-items: center; gap: 12px; flex: 1; }
.topbar-center { display: flex; align-items: center; justify-content: center; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex: 1; justify-content: flex-end; }

.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.logo-icon { font-size: 18px; color: var(--accent); line-height: 1; }
.logo-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.logo-ai { color: var(--accent); }

.topbar-divider { width: 1px; height: 20px; background: var(--border); }
.topbar-tagline { color: var(--text-muted); font-size: 12px; white-space: nowrap; }

.project-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 5px 12px;
}
.project-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  flex-shrink: 0;
}
.project-name-input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  width: 160px;
}

.btn-run {
  display: flex; align-items: center; gap: 6px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius-md);
  padding: 7px 14px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-run:hover { background: #d4ff1a; transform: translateY(-1px); box-shadow: 0 4px 12px var(--accent-glow); }
.btn-run:active { transform: translateY(0); }

.btn-deploy {
  display: flex; align-items: center; gap: 6px;
  background: var(--pink);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 7px 14px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-deploy:hover { background: #ff55b8; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(255,60,172,0.4); }

/* ============ WORKSPACE ============ */
.workspace {
  display: flex;
  height: calc(100vh - var(--topbar-h));
  margin-top: var(--topbar-h);
  overflow: hidden;
}

/* ============ AGENT PANEL ============ */
.agent-panel {
  width: var(--panel-w);
  min-width: var(--panel-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border-light);
}
.panel-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}
.agent-count-badge {
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  font-family: var(--font-mono);
}

.panel-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-muted);
}
.panel-search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 12px;
}
.panel-search input::placeholder { color: var(--text-muted); }

.division-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
}
.div-tab {
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-ui);
  white-space: nowrap;
}
.div-tab:hover { border-color: var(--accent); color: var(--accent); }
.div-tab.active { background: var(--accent); border-color: var(--accent); color: #000; font-weight: 700; }

.agents-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.agent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.1s;
  border-left: 2px solid transparent;
}
.agent-item:hover { background: var(--bg-hover); }
.agent-item.active {
  background: var(--accent-dim);
  border-left-color: var(--accent);
}
.agent-emoji { font-size: 16px; flex-shrink: 0; line-height: 1; }
.agent-item-info { flex: 1; min-width: 0; }
.agent-item-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-item-role {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============ EDITOR PANE ============ */
.editor-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
  border-right: 1px solid var(--border);
  min-width: 0;
  overflow: hidden;
}

.editor-tabs {
  display: flex;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
  gap: 2px;
  flex-shrink: 0;
}
.editor-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 10px 12px 8px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.editor-tab:hover { color: var(--text-primary); }
.editor-tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }

.tab-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.html-dot { background: #ff6b35; }
.css-dot { background: #4d9fff; }
.js-dot { background: #f7df1e; }

.editor-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

.line-numbers {
  padding: 16px 8px 16px 12px;
  background: var(--bg-base);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  text-align: right;
  user-select: none;
  min-width: 44px;
  border-right: 1px solid var(--border-light);
  overflow: hidden;
}

.code-editor {
  flex: 1;
  background: var(--bg-base);
  color: var(--text-code);
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
  padding: 16px 16px 16px 12px;
  tab-size: 2;
  overflow-y: auto;
  overflow-x: auto;
  white-space: pre;
}

/* ============ CHAT PANEL ============ */
.chat-panel {
  height: 320px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.chat-agent-info { display: flex; align-items: center; gap: 10px; }
.chat-agent-emoji { font-size: 20px; line-height: 1; }
.chat-agent-name { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); }
.chat-agent-div { display: block; font-size: 10px; color: var(--text-muted); }

.chat-actions { display: flex; gap: 6px; }
.chat-action-btn {
  display: flex; align-items: center; gap: 5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-ui);
}
.chat-action-btn:hover { border-color: var(--accent); color: var(--accent); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  gap: 8px;
  flex: 1;
}
.welcome-icon { font-size: 28px; color: var(--accent); margin-bottom: 4px; }
.chat-welcome h3 { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.chat-welcome p { font-size: 12px; color: var(--text-secondary); max-width: 320px; }

.welcome-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 8px;
}
.welcome-suggestions button {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 11px;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-ui);
}
.welcome-suggestions button:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* Chat messages */
.msg { display: flex; gap: 8px; animation: msgIn 0.2s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.msg-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 2px;
}
.msg.user .msg-avatar { background: var(--accent-dim); }
.msg.agent .msg-avatar { background: var(--pink-dim); }

.msg-content { flex: 1; min-width: 0; }
.msg-sender { font-size: 10px; font-weight: 700; color: var(--text-muted); margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.5px; }
.msg.user .msg-sender { color: var(--accent); }
.msg.agent .msg-sender { color: var(--pink); }

.msg-text {
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.6;
  word-break: break-word;
}
.msg-text code {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
}
.msg-text pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 8px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-code);
  line-height: 1.6;
}

.msg-insert-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.15s;
  font-family: var(--font-ui);
}
.msg-insert-btn:hover { background: var(--accent); color: #000; }

.typing-indicator {
  display: flex; gap: 4px; align-items: center; padding: 4px 0;
}
.typing-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Chat input */
.chat-input-row {
  padding: 10px 14px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}
.chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  transition: border-color 0.15s;
}
.chat-input-wrap:focus-within { border-color: var(--accent); }

.chat-textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.5;
  resize: none;
  max-height: 80px;
  overflow-y: auto;
}
.chat-textarea::placeholder { color: var(--text-muted); }

.chat-send-btn {
  width: 28px; height: 28px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #000;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.chat-send-btn:hover { background: #d4ff1a; transform: scale(1.05); }
.chat-send-btn:disabled { background: var(--bg-active); color: var(--text-muted); cursor: not-allowed; transform: none; }

/* ============ PREVIEW PANE ============ */
.preview-pane {
  width: var(--preview-w);
  min-width: 300px;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
  overflow: hidden;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  height: 40px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 10px;
}

.preview-url-bar {
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  gap: 4px;
  flex: 1;
  max-width: 280px;
  overflow: hidden;
}
.preview-protocol { color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; }
.preview-domain { color: var(--text-primary); font-family: var(--font-mono); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.preview-actions { display: flex; align-items: center; gap: 6px; }
.preview-btn {
  width: 28px; height: 28px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.preview-btn:hover { border-color: var(--accent); color: var(--accent); }

.preview-size-btns { display: flex; gap: 2px; }
.size-btn {
  width: 28px; height: 28px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.size-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.size-btn:hover { border-color: var(--accent); color: var(--accent); }

.preview-frame-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #fff;
  display: none;
}
.preview-frame.visible { display: block; }
.preview-frame.mobile-view {
  width: 375px;
  height: 667px;
  border-radius: 12px;
  box-shadow: 0 0 0 8px var(--bg-elevated), 0 0 0 9px var(--border);
}

.preview-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
}
.placeholder-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 32px;
}
.placeholder-icon { font-size: 40px; color: var(--text-muted); }
.placeholder-content h3 { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.placeholder-content p { font-size: 13px; color: var(--text-secondary); max-width: 260px; }

.btn-start {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.15s;
  font-family: var(--font-ui);
}
.btn-start:hover { background: #d4ff1a; transform: translateY(-1px); }

/* ============ DEPLOY MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-overlay.open { display: flex; }

.deploy-modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 440px;
  max-width: 90vw;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}
.deploy-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.deploy-modal-header h2 { font-size: 16px; font-weight: 700; }
.deploy-modal-header button {
  background: none; border: none; color: var(--text-muted);
  font-size: 16px; cursor: pointer; padding: 4px;
  transition: color 0.15s;
}
.deploy-modal-header button:hover { color: var(--text-primary); }

.deploy-modal-body { padding: 24px 20px; }
.deploy-desc { color: var(--text-secondary); font-size: 13px; margin-bottom: 16px; }

.deploy-url-preview {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  gap: 4px;
  margin-bottom: 20px;
}
.deploy-protocol { color: var(--text-muted); font-family: var(--font-mono); font-size: 13px; }
.deploy-name-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}
.deploy-suffix { color: var(--text-muted); font-family: var(--font-mono); font-size: 13px; }

.btn-deploy-confirm {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  background: var(--pink);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-ui);
}
.btn-deploy-confirm:hover { background: #ff55b8; box-shadow: 0 4px 20px rgba(255,60,172,0.4); }

.deploy-loading {
  display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 20px;
}
.deploy-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--pink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.deploy-loading p { color: var(--text-secondary); font-size: 13px; }

.deploy-success {
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px;
  text-align: center;
}
.deploy-success-icon { font-size: 36px; }
.deploy-success h3 { font-size: 18px; font-weight: 700; }
.deploy-live-link {
  display: block;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px 16px;
  text-decoration: none;
  word-break: break-all;
  transition: all 0.15s;
}
.deploy-live-link:hover { background: var(--accent); color: #000; }
.deploy-note { color: var(--text-muted); font-size: 12px; }
.btn-deploy-close {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 8px 24px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-ui);
}
.btn-deploy-close:hover { border-color: var(--accent); color: var(--accent); }

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-size: 13px;
  color: var(--text-primary);
  z-index: 9999;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--accent); color: var(--accent); }
.toast.error { border-color: var(--pink); color: var(--pink); }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  :root { --panel-w: 200px; --preview-w: 40%; }
  .topbar-tagline { display: none; }
}
@media (max-width: 700px) {
  .agent-panel { display: none; }
  :root { --preview-w: 45%; }
}