/* --- LiteAI Warm Light Theme (Claude UI Style) --- */
:root {
  --bg-app: #ffffff;
  --bg-sidebar: #f7f5f0; /* Soft warm sand/cream */
  --bg-panel: #ffffff;
  --bg-input: #ffffff;
  
  --border-color: #e5e2db; /* Warm grey/beige border */
  --border-active: #cc5a37; /* Claude clay-orange highlight */

  --color-primary: #191919; /* Elegant charcoal black */
  --color-accent: #cc5a37; /* Clay-orange accent */
  --color-success: #0d9488; /* Soft teal */
  --color-danger: #e11d48; /* Soft red */
  
  --text-main: #191919; /* High-readability charcoal */
  --text-muted: #6b6863; /* Warm muted brown-grey */
  --text-dark: #ffffff;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'Fira Code', Menlo, Monaco, Consolas, monospace;
}

/* --- Global Reset & Scrollbars --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  outline: none;
}

body {
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-sans);
  height: 100vh;
  overflow: hidden;
  letter-spacing: -0.2px;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.1);
}

/* --- Layout Structure --- */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* --- Sidebar (Claude Sidebar Aesthetic) --- */
.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.logo span {
  color: var(--color-accent);
  font-weight: 300;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 0 16px 12px 16px;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
}

.nav-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 10px 12px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  text-align: left;
  transition: all 0.15s ease;
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.025);
}

.nav-tab.active {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.04);
  font-weight: 600;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.active-model-badge {
  background: rgba(0, 0, 0, 0.02);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.active-model-badge span {
  color: var(--color-accent);
  font-weight: 600;
}

/* Data Usage Panel */
.data-usage-badge {
  background: rgba(0, 0, 0, 0.01);
  border: 1px solid var(--border-color);
  padding: 10px;
  border-radius: 6px;
}

.data-usage-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.data-usage-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  margin-bottom: 4px;
}

.data-val {
  font-family: var(--font-mono);
  font-weight: 600;
}

.reset-btn {
  background: none;
  border: none;
  color: var(--color-danger);
  cursor: pointer;
  font-size: 0.65rem;
  text-decoration: underline;
  transition: opacity 0.15s;
}

.reset-btn:hover {
  opacity: 0.8;
}

/* --- List Items --- */
.item-list {
  list-style: none;
}

.item-list li {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 4px;
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
}

.item-list li:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.025);
}

.item-list li.active {
  background: rgba(0, 0, 0, 0.04);
  border-color: var(--border-color);
  color: var(--text-main);
  font-weight: 500;
}

.loading-placeholder {
  color: var(--text-muted);
  text-align: center;
  font-size: 0.75rem;
  padding: 12px 0;
  font-style: italic;
}

/* --- File Tree Explorer --- */
.file-actions {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.file-tree {
  list-style: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.file-node {
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
  user-select: none;
  color: var(--text-muted);
}

.file-node:hover {
  background: rgba(0, 0, 0, 0.025);
  color: var(--text-main);
}

.file-node.folder {
  color: var(--color-accent);
  font-weight: 600;
}

.file-node.file {
  padding-left: 20px;
}

.file-node .file-delete-btn {
  margin-left: auto;
  opacity: 0;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.75rem;
  transition: opacity 0.15s;
}

.file-node:hover .file-delete-btn {
  opacity: 0.5;
}

.file-node .file-delete-btn:hover {
  opacity: 1;
}

/* --- Main Pane --- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--bg-app);
}

.view-panel {
  display: none;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

.view-panel.active {
  display: flex;
}

/* --- Headers --- */
.view-header {
  padding: 24px 40px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-app);
}

.view-header h2 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.2px;
  color: var(--text-main);
}

.view-header .subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.btn-primary {
  background-color: var(--color-primary);
  color: var(--text-dark);
  font-weight: 600;
}

.btn-primary:hover {
  background-color: #333333;
}

.btn-secondary {
  background-color: #f0ede6;
  border-color: #e5e2db;
  color: var(--color-accent);
}

.btn-secondary:hover {
  background-color: #e5e2db;
}

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(0, 0, 0, 0.02);
  border-color: var(--text-muted);
}

.btn-danger {
  background: rgba(225, 29, 72, 0.05);
  border: 1px solid rgba(225, 29, 72, 0.2);
  color: var(--color-danger);
}

.btn-danger:hover {
  background: var(--color-danger);
  color: white;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-xs {
  padding: 3px 6px;
  font-size: 0.7rem;
}

.btn-block {
  width: 100%;
  padding: 8px;
  font-size: 0.8rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1rem;
}

/* --- Form Styling --- */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 12px;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  transition: border 0.15s ease;
}

.form-group textarea {
  resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--border-active);
}

/* --- Cards / Sections --- */
.card {
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 24px;
}

.card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-main);
}

.card p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* --- Welcome / Blank States --- */
.welcome-screen {
  max-width: 440px;
  margin: 120px auto;
  text-align: center;
}

.welcome-screen h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-main);
}

.welcome-screen p {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* --- Chat Space --- */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 40px 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Clean message rows - User bubbles on the right (beige), Assistant text on the left (flat) */
.message-bubble {
  max-width: 80%;
  font-size: 0.95rem;
  line-height: 1.7;
  word-wrap: break-word;
}

.message-bubble.user {
  align-self: flex-end;
  background-color: #f3f0ea; /* Warm sand bubble */
  color: var(--text-main);
  padding: 12px 18px;
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.message-bubble.assistant {
  align-self: flex-start;
  max-width: 100%;
  color: var(--text-main);
  padding: 8px 0;
  background: transparent;
}

/* Markdown parsing */
.message-bubble p {
  margin-bottom: 10px;
}

.message-bubble p:last-child {
  margin-bottom: 0;
}

.message-bubble code {
  background: #f0ede6;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 2px 5px;
  border-radius: 4px;
  color: var(--color-accent);
}

.message-bubble pre {
  background: #fbfbf9;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px;
  margin: 12px 0;
  overflow-x: auto;
}

.message-bubble pre code {
  background: none;
  color: #24292f;
  padding: 0;
  font-size: 0.78rem;
}

.message-bubble ul, .message-bubble ol {
  margin-left: 20px;
  margin-bottom: 10px;
}

.message-bubble li {
  margin-bottom: 4px;
}

.message-bubble table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

.message-bubble th, .message-bubble td {
  border: 1px solid var(--border-color);
  padding: 8px;
  font-size: 0.82rem;
}

.message-bubble th {
  background: #fbfaf7;
}

/* --- Floating Input bar --- */
.chat-input-container {
  padding: 24px 80px 40px 80px;
  background: linear-gradient(to top, var(--bg-app) 60%, transparent);
}

#chat-form {
  background-color: var(--bg-app);
  border: 1px solid #d2cfc7;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.03);
}

#chat-form:focus-within {
  border-color: var(--border-active);
  box-shadow: 0 2px 16px rgba(204, 90, 55, 0.08);
}

#chat-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  resize: none;
  max-height: 200px;
}

/* --- Workspace Code Editor --- */
.editor-container {
  flex: 1;
  background: #ffffff;
  position: relative;
}

.editor-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
  gap: 12px;
}

.editor-loading p {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* --- Agent Console --- */
.agent-view-content {
  padding: 40px;
  overflow-y: auto;
  max-width: 720px;
  flex: 1;
}

.console-logs {
  background: #fcfbf9;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #1f2937;
  max-height: 380px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.badge {
  padding: 3px 6px;
  font-size: 0.7rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge.running {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.badge.success {
  background: rgba(13, 148, 136, 0.08);
  color: var(--color-success);
  border: 1px solid rgba(13, 148, 136, 0.2);
}

.badge.failed {
  background: rgba(225, 29, 72, 0.08);
  color: var(--color-danger);
  border: 1px solid rgba(225, 29, 72, 0.2);
}

.task-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

/* --- Configuration Settings Content --- */
.settings-content {
  padding: 40px;
  overflow-y: auto;
  max-width: 720px;
  flex: 1;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-msg {
  font-size: 0.8rem;
  color: var(--color-success);
  font-weight: 600;
}

/* --- Spinner --- */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(0, 0, 0, 0.05);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
