/* Reset and base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #f8f9fa;
  color: #212529;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}

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

/* Header and Tabs */
.header {
  background-color: #2c3e50;
  color: white;
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo {
  font-size: 1.5rem;
}

.title {
  font-weight: bold;
  font-size: 1.1rem;
}

.subtitle {
  font-size: 0.75rem;
  opacity: 0.8;
}

.tabs {
  display: flex;
  gap: 0.5rem;
}

.tab-btn {
  background: transparent;
  border: none;
  color: #bdc3c7;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: 4px;
  font-weight: 500;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: white;
  background-color: rgba(255,255,255,0.1);
}

.tab-btn.active {
  color: white;
  background-color: #3498db;
}

/* Main Content and Tab Panes */
.main {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.tab-content {
  display: none;
  width: 100%;
  height: 100%;
  padding: 1rem;
}

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

.panel {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.panel-title {
  padding: 0.75rem 1rem;
  font-weight: bold;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Chat Styles */
.chat-panel {
  max-width: 900px;
  margin: 0 auto;
}

.chat-actions {
  padding: 0.5rem 1rem;
  display: flex;
  gap: 0.5rem;
  background: #fdfdfd;
  border-bottom: 1px solid #eee;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.msg {
  max-width: 85%;
  padding: 0.75rem;
  border-radius: 8px;
  position: relative;
}

.msg.user {
  align-self: flex-end;
  background-color: #e3f2fd;
  color: #0d47a1;
}

.msg.assistant {
  align-self: flex-start;
  background-color: #f1f3f4;
  color: #202124;
}

.msg .role {
  font-size: 0.7rem;
  font-weight: bold;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
  opacity: 0.7;
}

.msg .body {
  white-space: pre-wrap;
  word-break: break-word;
}

.composer {
  padding: 1rem;
  border-top: 1px solid #eee;
  display: flex;
  gap: 0.5rem;
}

/* Workspace Styles */
.workspace-panel {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: auto auto 1fr;
}

.workspace-panel .panel-title {
  grid-column: 1 / span 2;
}

.workspace-actions {
  grid-column: 1 / span 2;
  padding: 0.5rem 1rem;
  background: #f8f9fa;
  border-bottom: 1px solid #eee;
  display: flex;
  gap: 0.5rem;
}

.files {
  border-right: 1px solid #eee;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.file-item {
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item:hover {
  background-color: #f0f7ff;
}

.file-item.active {
  background-color: #e3f2fd;
  font-weight: 500;
  color: #1976d2;
}

.file-view {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.file-view-title {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-weight: bold;
  background: #fcfcfc;
  border-bottom: 1px solid #eee;
}

.file-content {
  flex: 1;
  border: none;
  padding: 1rem;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.9rem;
  resize: none;
  outline: none;
  background: #fff;
}

.editor-actions {
  padding: 0.75rem 1rem;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
}

/* Terminal Styles */
.terminal-panel {
  background-color: #000;
  color: #fff;
}

#terminal-container {
  flex: 1;
  padding: 0.5rem;
  overflow: hidden;
}

.terminal-hint {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  color: #888;
  border-top: 1px solid #222;
}

/* Buttons and Inputs */
.button {
  background-color: #3498db;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
}

.button:hover {
  background-color: #2980b9;
}

.button-secondary {
  background-color: #f1f3f4;
  color: #3c4043;
}

.button-secondary:hover {
  background-color: #e8eaed;
}

.input {
  flex: 1;
  padding: 0.6rem 1rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
  outline: none;
}

.input:focus {
  border-color: #3498db;
}

.error {
  color: #d32f2f;
  padding: 1rem;
  background-color: #ffebee;
  border-radius: 4px;
  margin: 1rem;
}

.muted {
  color: #70757a;
  padding: 1rem;
  text-align: center;
}
