/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Animations */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes loadingDots {
  0%, 20% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Chat Interface */
.chat-interface {
  margin-top: 2rem;
  background: #1f2937;
  border-radius: 8px;
  border: 1px solid #374151;
  display: flex;
  flex-direction: column;
}

.chat-header {
  padding: 1.5rem 1.5rem 1rem 1.5rem;
  border-bottom: 1px solid #374151;
  flex-shrink: 0;
}

.chat-header h4 {
  color: #60a5fa;
  margin-bottom: 0.5rem;
}

.chat-conversation {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #0f172a;
}

.chat-welcome {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
}

.welcome-message h5 {
  color: #10b981;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.welcome-message p {
  color: #9ca3af;
  font-size: 0.9rem;
}

.chat-input-area {
  padding: 1rem 1.5rem;
  border-top: 1px solid #374151;
  background: #1f2937;
  flex-shrink: 0;
}

.chat-input {
  width: 100%;
  border: 1px solid #4b5563;
  border-radius: 6px;
  background: #374151;
  color: #e5e7eb;
  padding: 0.75rem;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
}

.chat-input:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  justify-content: flex-end;
}

.chat-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
}

.chat-actions-left {
  display: flex;
  align-items: center;
}

.chat-actions-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
}

.conversation-thread {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  padding: 0.75rem;
  border-radius: 6px;
  border-left: 3px solid;
  position: relative;
}

.message-user {
  background: #1e3a8a;
  border-left-color: #3b82f6;
}

.message-assistant {
  background: #166534;
  border-left-color: #10b981;
}

.message-error {
  background: #7f1d1d;
  border-left-color: #ef4444;
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
}

.message-role {
  font-weight: 600;
  color: #f1f5f9;
}

.message-time {
  color: #94a3b8;
  font-size: 0.7rem;
}

.message-content {
  color: #e2e8f0;
  white-space: pre-wrap;
  line-height: 1.6;
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
}

/* Tool Execution Styling */
.message-tool-execution {
  background: transparent !important;
  border: none !important;
  padding: 0.5rem 0 !important;
}

.tool-execution-container {
  margin: 0.5rem 0;
  border-radius: 8px;
  padding: 1rem;
  border-left: 4px solid;
  background: rgba(55, 65, 81, 0.6);
  backdrop-filter: blur(4px);
  transition: all 0.3s ease;
}

.tool-execution-starting {
  border-left-color: #60a5fa;
  background: rgba(96, 165, 250, 0.1);
}

.tool-execution-started {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

.tool-execution-success {
  border-left-color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.tool-execution-error {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* Inline Tool Components */
.inline-tool-container {
  display: inline-block;
  margin: 0.5rem 0;
  padding: 0.75rem;
  border-radius: 6px;
  border-left: 3px solid;
  background: rgba(55, 65, 81, 1);
  backdrop-filter: blur(4px);
  transition: all 0.3s ease;
  font-size: 0.85rem;
  max-width: 100%;
  overflow: hidden;
}

.inline-tool-starting {
  border-left-color: #9ca3af;
  background: rgba(156, 163, 175, 0.1);
}

.inline-tool-started {
  border-left-color: #9ca3af;
  background: rgba(156, 163, 175, 0.15);
}

.inline-tool-success {
  border-left-color: #6b7280;
  background: rgba(107, 114, 128, 1);
}

.inline-tool-error {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.inline-tool-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  color: #f1f5f9;
  font-weight: 600;
  font-size: 0.9rem;
}

.inline-tool-params,
.inline-tool-result {
  margin-top: 0.5rem;
}

.inline-tool-params details,
.inline-tool-result details {
  cursor: pointer;
}

.inline-tool-params summary,
.inline-tool-result summary {
  font-weight: 500;
  color: #d1d5db;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  padding: 0.25rem 0;
}

.inline-tool-params summary:hover,
.inline-tool-result summary:hover {
  color: #f1f5f9;
}

.tool-code-small {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  padding: 0.5rem;
  overflow-x: auto;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
  line-height: 1.3;
}

.tool-code-small code {
  background: none;
  padding: 0;
  color: #e5e7eb;
}

/* Mixed content layout */
.mixed-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.text-content {
  line-height: 1.6;
}

.tool-content {
  width: 100%;
}

.streaming-text {
  opacity: 0.8;
}

.tool-execution-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
}

.tool-status {
  margin-left: auto;
  font-size: 0.8rem;
  color: #9ca3af;
  font-weight: normal;
}

.tool-execution-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tool-section {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  padding: 0.75rem;
}

.tool-section-title {
  font-weight: 600;
  color: #d1d5db;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.tool-code {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  padding: 0.75rem;
  overflow-x: auto;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.tool-code code {
  background: none;
  padding: 0;
  color: #e5e7eb;
  font-size: 0.8rem;
  line-height: 1.4;
}

.tool-timestamps {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #6b7280;
  margin-top: 0.5rem;
}

.tool-timestamps span {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
}

/* Loading and typing animations */
.loading-dots {
  display: inline-flex;
  gap: 2px;
  margin-left: 4px;
}

.loading-dots span {
  width: 4px;
  height: 4px;
  background: currentColor;
  border-radius: 50%;
  animation: loadingDots 1.4s infinite;
}

.loading-dots span:nth-child(1) {
  animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

.loading-dots.small span {
  width: 3px;
  height: 3px;
}

.typing-animation {
  display: flex;
  align-items: center;
  color: #9ca3af;
  font-style: italic;
}

.typing-text {
  animation: pulse 2s infinite;
}

.typing-indicator {
  animation: pulse 1.5s infinite;
}

.typing-indicator .message-content {
  background: rgba(55, 65, 81, 0.5);
  border-radius: 6px;
  padding: 0.75rem;
  margin: 0.25rem 0;
}

/* Inline code and emphasis styling */
.message-content strong {
  font-weight: 600;
  color: #f8fafc;
}

.message-content code {
  background: rgba(0, 0, 0, 0.4);
  padding: 0.125rem 0.25rem;
  border-radius: 3px;
  font-size: 0.8rem;
  color: #fbbf24;
}

.message-content pre {
  background: rgba(0, 0, 0, 0.4);
  padding: 0.75rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 0.5rem 0;
}

.message-content pre code {
  background: none;
  padding: 0;
  color: #e5e7eb;
}

.copy-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #4b5563;
  border-radius: 4px;
  color: #e5e7eb;
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.copy-button:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: #6b7280;
  transform: scale(1.05);
}

.message:hover .copy-button {
  opacity: 1;
}

.copy-button:active {
  transform: scale(0.95);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #e5e7eb;
  background-color: #111827;
}

/* Navigation */
.navbar {
  background: #1f2937;
  padding: 1rem 2rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #374151;
}

.nav-brand a {
  font-size: 1.5rem;
  font-weight: bold;
  text-decoration: none;
  color: #60a5fa;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-links a {
  text-decoration: none;
  color: #d1d5db;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  background: #4c5ead;
  color: white;
}

.nav-user {
  color: #d1d5db;
  margin-right: 1rem;
}

.nav-logout {
  background: #6b7280;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.nav-logout:hover {
  background: #4b5563;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Authentication */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
}

.auth-form {
  background: #1f2937;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
  width: 100%;
  max-width: 400px;
  border: 1px solid #374151;
}

.auth-form h1 {
  text-align: center;
  margin-bottom: 2rem;
  color: #60a5fa;
}

.auth-switch {
  text-align: center;
  margin-top: 1rem;
  color: #9ca3af;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #d1d5db;
}

.form-group input,
.form-group textarea,
.form-group select,
.provider-select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #4b5563;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.2s;
  background: #374151;
  color: #e5e7eb;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.provider-select:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}

.form-help {
  font-size: 0.875rem;
  color: #9ca3af;
  margin-top: 0.25rem;
  display: block;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: #4c5ead;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #3d4a8c;
}

.btn-secondary {
  background: #6b7280;
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: #4b5563;
}

.btn-danger {
  background: #991b1b;
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #7f1d1d;
}

.btn-outline {
  background: transparent;
  color: white;
  border: 1px solid #60a5fa;
}

.btn-outline:hover:not(:disabled) {
  background: #60a5fa;
  color: #111827;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-link {
  background: none;
  border: none;
  color: #60a5fa;
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
}

.btn-link:hover:not(:disabled) {
  color: #93c5fd;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 3px;
  margin-left: 0.5rem;
}

.badge-app {
  background: #7c3aed;
  color: #ddd6fe;
}

.lock-icon {
  margin-left: 8px;
}

/* Alerts */
.alert {
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.alert-success {
  background: #064e3b;
  color: #6ee7b7;
  border: 1px solid #047857;
}

.alert-error {
  background: #7f1d1d;
  color: #fca5a5;
  border: 1px solid #991b1b;
}

.edit-success-alert {
  margin-top: 1rem;
  animation: fadeInOut 5s ease-in-out forwards;
}

@keyframes fadeInOut {
  0% {
    opacity: 0;
    transform: translateY(-10px);
  }
  10% {
    opacity: 1;
    transform: translateY(0);
  }
  90% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* Dashboard */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.dashboard-header h1 {
  color: #e5e7eb;
}

.loading {
  text-align: center;
  padding: 2rem;
  color: #9ca3af;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: #9ca3af;
}

/* Apps list */
.pages-list {
  display: grid;
  gap: 1rem;
}

.page-card {
  background: #1f2937;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  border: 1px solid #374151;
}

.page-card-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-info h3 {
  color: #e5e7eb;
  margin-bottom: 0.5rem;
}

.page-title-link {
  background: none;
  border: none;
  color: #e5e7eb;
  font-size: inherit;
  font-weight: inherit;
  font-family: inherit;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
}

.page-title-link:hover {
  color: #9ca3af;
}

.page-meta {
  color: #9ca3af;
  font-size: 0.875rem;
}

.page-actions {
  display: flex;
  gap: 0.5rem;
}

/* Edit page */
.edit-page {
  max-width: 1000px;
  margin: 0 auto;
}

.edit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.edit-header h1 {
  color: #e5e7eb;
}

.edit-header h1 a {
  color: inherit;
  text-decoration: underline;
}

.edit-form-container {
  background: #1f2937;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
  border: 1px solid #374151;
}

/* Checkbox styling */
.checkbox-group {
  margin-bottom: 1rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 500;
  color: #d1d5db;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.checkbox-text {
  user-select: none;
  margin-left: 7px;
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
}

/* File upload */
.file-upload-section {
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.file-input-wrapper {
  position: relative;
}

.file-input-wrapper input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.file-input-label {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: #374151;
  border: 1px solid #4b5563;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
  color: #d1d5db;
  white-space: nowrap;
}

.file-input-label:hover {
  background: #4b5563;
}

.file-separator {
  color: #9ca3af;
  font-size: 0.875rem;
}

.drop-zone {
  padding: 1rem;
  border: 2px dashed #4b5563;
  border-radius: 4px;
  text-align: center;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.drop-zone:hover {
  border-color: #60a5fa;
  background: #1f2937;
}

/* App development section */
.app-development-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #374151;
}

.app-development-section h3 {
  color: #e5e7eb;
  margin-bottom: 1rem;
}

.app-dev-placeholder {
  background: #374151;
  border-radius: 4px;
  padding: 1.5rem;
  margin-top: 1rem;
}

.placeholder-item {
  padding: 0.5rem 0;
  color: #9ca3af;
  border-bottom: 1px solid #4b5563;
}

.placeholder-item:last-child {
  border-bottom: none;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }

  .navbar {
    padding: 1rem;
    flex-direction: row;
    gap: 1rem;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
  }

  .container {
    padding: 1rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .dashboard-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .page-card {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .page-actions {
    justify-content: center;
  }

  .edit-page {
    width: 100%;
    max-width: 100%;
    padding: 0;
    overflow-x: hidden;
  }

  .edit-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .edit-form-container {
    width: 100%;
    padding: 1.5rem;
    box-sizing: border-box;
  }

  .form-actions {
    flex-direction: column;
  }

  .file-upload-section {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .form-group input,
  .form-group textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* Code Page Styles */
.code-page {
  min-height: 100vh;
  color: #e2e8f0;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.code-header h1 {
  color: white;
  margin: 0;
}

.code-header h1 a {
  color: white;
  text-decoration: none;
}

.code-header h1 a:hover {
  text-decoration: underline;
}

.header-actions {
  display: flex;
  gap: 1rem;
}

.code-layout {
  display: flex;
  height: calc(100vh - 80px);
}

.file-tree-panel {
  width: 300px;
  background: #1e293b;
  border-right: 1px solid #334155;
  display: flex;
  flex-direction: column;
}

.panel-header {
  padding: 1rem;
  border-bottom: 1px solid #334155;
}

.panel-header h3 {
  color: white;
  margin: 0;
  font-size: 1.5rem;
}

.file-tree {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.file-item, .dir-header {
  display: flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.875rem;
  margin-bottom: 2px;
}

.file-item:hover, .dir-header:hover {
  background: #334155;
}

.file-item.active {
  background: #60a5fa;
  color: #0f172a;
}

.file-item.drag-over {
  background: rgba(34, 197, 94, 0.2);
  border: 2px dashed #22c55e;
}

.file-icon, .dir-icon {
  margin-right: 0.5rem;
  font-size: 0.75rem;
}

.file-name, .dir-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dir-children {
  margin-left: 1rem;
}

.main-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0f172a;
}

.search-section {
  border-bottom: 1px solid #334155;
  background: #1e293b;
  flex-shrink: 0;
}

.search-input-container {
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-input {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #334155;
  border-radius: 4px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.875rem;
}

.search-input:focus {
  outline: none;
  border-color: #60a5fa;
}

.search-loading {
  color: #60a5fa;
  font-size: 1rem;
}

.search-results {
  max-height: 300px;
  overflow-y: auto;
  padding: 0 1rem 1rem;
}

.search-results h4 {
  color: #60a5fa;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.search-result-item {
  padding: 0.5rem;
  border: 1px solid #334155;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  background: #0f172a;
}

.search-result-item:hover {
  background: #1e293b;
  border-color: #60a5fa;
}

.result-path {
  color: #60a5fa;
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
}

.result-content {
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.875rem;
  color: #e2e8f0;
  white-space: pre-wrap;
  background: #1e293b;
  padding: 0.25rem;
  border-radius: 2px;
  margin-bottom: 0.25rem;
}

.result-context {
  margin-top: 0.5rem;
}

.result-context pre {
  background: #1e293b;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #94a3b8;
  overflow-x: auto;
}

.result-context code {
  font-family: 'Fira Code', 'Courier New', monospace;
}

.editor-section {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.editor-header {
  padding: 1rem;
  border-bottom: 1px solid #334155;
  background: #1e293b;
}

.editor-header h4 {
  color: #60a5fa;
  margin: 0;
  font-size: 0.875rem;
}

.editor-container {
  flex: 1;
  padding: 1rem;
  background: #0f172a;
  display: flex;
  flex-direction: column;
}

.editor-wrapper {
  flex: 1;
  display: flex;
  border: 1px solid #334155;
  border-radius: 4px;
  background: #1e293b;
  overflow: hidden;
}

.line-numbers {
  background: #0f172a;
  color: #64748b;
  padding: 1rem 0.5rem;
  text-align: right;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
  user-select: none;
  border-right: 1px solid #334155;
  white-space: pre;
  overflow: hidden;
  width: 3rem;
}

.code-editor {
  flex: 1;
  border: none;
  background: #1e293b;
  color: #e2e8f0;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
  padding: 1rem;
  resize: none;
  outline: none;
  overflow: auto;
}

.code-editor:focus {
  border-color: #60a5fa;
}

/* Responsive design for code page */
@media (max-width: 768px) {
  .code-layout {
    flex-direction: column;
  }
  
  .file-tree-panel {
    width: 100%;
    max-height: 200px;
  }
  
  .header-actions {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .code-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}

/* API Key Input Styling */
.api-key-input.api-key-missing::placeholder {
  color: #dc2626 !important;
  opacity: 1;
}

.api-key-input.api-key-exists::placeholder {
  color: #9ca3af;
  opacity: 1;
}

/* TodoList Component Styles - Dark Mode */
.todo-list-container {
  margin-top: 1rem;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 8px;
  overflow: hidden;
}

.todo-list-header {
  background: #374151;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #4b5563;
}

.todo-list-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.todo-list-title h4 {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #d1d5db;
  flex: 1;
}

.todo-icon {
  font-size: 1rem;
}

.todo-toggle-btn {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.todo-toggle-btn:hover {
  background: #4b5563;
  color: #d1d5db;
}

.todo-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: #4b5563;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.75rem;
  color: #9ca3af;
  font-weight: 500;
  white-space: nowrap;
}

.todo-list-content {
  max-height: 300px;
  overflow-y: auto;
  background: #1f2937;
}

.todo-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #374151;
  transition: background-color 0.2s;
}

.todo-item:last-child {
  border-bottom: none;
}

.todo-item:hover {
  background: #374151;
}

.todo-item-completed {
  background: rgba(16, 185, 129, 0.1);
}

.todo-item-in_progress {
  background: rgba(245, 158, 11, 0.1);
}

.todo-main {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.todo-status-icon {
  font-size: 1rem;
  margin-top: 0.125rem;
  min-width: 1rem;
}

.todo-content {
  flex: 1;
  min-width: 0;
}

.todo-text {
  display: block;
  font-size: 0.875rem;
  line-height: 1.4;
  color: #e5e7eb;
  margin-bottom: 0.5rem;
}

.todo-text.completed {
  text-decoration: line-through;
  color: #9ca3af;
}

.todo-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.todo-priority {
  font-size: 0.625rem;
  font-weight: 600;
  color: white;
  padding: 0.125rem 0.375rem;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.todo-timestamp {
  font-size: 0.625rem;
  color: #6b7280;
}

.todo-status-badge {
  font-size: 0.625rem;
  font-weight: 500;
  padding: 0.125rem 0.375rem;
  border-radius: 12px;
  border: 1px solid;
}

.todo-status-badge.working {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.1);
  border-color: #3b82f6;
  animation: pulse 2s infinite;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .todo-list-container {
    margin-top: 0.75rem;
  }
  
  .todo-list-header {
    padding: 0.5rem 0.75rem;
  }
  
  .todo-item {
    padding: 0.5rem 0.75rem;
  }
  
  .todo-meta {
    gap: 0.25rem;
  }
  
  .todo-text {
    font-size: 0.8125rem;
  }
}

/* Version Panel Styles */
.version-panel {
  position: fixed;
  top: 80px;
  right: 0;
  width: 400px;
  height: calc(100vh - 80px);
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.version-panel .panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.version-panel .panel-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.version-list {
  flex: 1;
  padding: 0;
}

.version-item {
  border-bottom: 1px solid var(--border-color);
  padding: 1rem;
  transition: background-color 0.2s;
}

.version-item:hover {
  background: var(--bg-hover);
}

.version-item.current {
  background: var(--bg-accent-light);
  border-left: 4px solid var(--accent-color);
}

.version-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.version-message {
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  margin-right: 0.5rem;
}

.current-badge {
  background: var(--accent-color);
  color: white;
  font-size: 0.7rem;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  margin-right: 0.5rem;
  font-weight: bold;
}

.version-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.version-meta {
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}

.version-sha {
  background: var(--bg-code);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  color: var(--text-code);
}

.version-parent {
  color: var(--text-secondary);
  margin-left: 0.5rem;
}

.version-actions {
  display: flex;
  gap: 0.5rem;
}

.version-actions .btn {
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
}

.no-versions {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
}

.loading {
  padding: 1rem;
  text-align: center;
  color: var(--text-secondary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .version-panel {
    width: 100%;
    left: 0;
  }
}