/* Coding Interface */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--editor-bg);
  color: var(--editor-text);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--editor-sidebar);
  border-bottom: 1px solid var(--editor-border);
}

.logo-small {
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
}

.project-selector {
  display: flex;
  gap: 10px;
  align-items: center;
}

#project-select {
  padding: 6px 12px;
  background: var(--editor-input-bg);
  border: 1px solid var(--editor-border);
  color: var(--editor-text);
  border-radius: 4px;
  min-width: 200px;
}

.header-info {
  display: flex;
  gap: 20px;
  align-items: center;
}

.token-display, .wallet-display {
  font-size: 13px;
  color: var(--editor-text-muted);
}

.token-display {
  font-weight: 600;
}

.wallet-display {
  font-family: monospace;
}

/* Main Content Area */
.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* File Explorer */
.file-explorer {
  width: 250px;
  min-width: 150px;
  max-width: 600px;
  background: var(--editor-sidebar);
  border-right: 1px solid var(--editor-border);
  display: flex;
  flex-direction: column;
}

/* Explorer Resizer */
.explorer-resizer {
  width: 4px;
  background: var(--editor-border);
  cursor: col-resize;
  transition: background 0.2s;
}

.explorer-resizer:hover {
  background: var(--accent-blue);
}

.explorer-header {
  padding: 10px 15px;
  border-bottom: 1px solid var(--editor-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.explorer-header h3 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--editor-text-muted);
}

.file-tree {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
}

.file-item {
  padding: 8px 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}

.file-item:hover {
  background: var(--editor-hover);
}

.file-item.active {
  background: var(--editor-active);
  color: var(--text-primary);
}

.file-icon {
  width: 16px;
  text-align: center;
}

/* Editor Container */
.editor-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--editor-bg);
}

.editor-tabs {
  background: var(--editor-sidebar);
  border-bottom: 1px solid var(--editor-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
}

.editor-mode-tabs {
  display: flex;
  gap: 2px;
}

.mode-tab {
  padding: 10px 20px;
  background: transparent;
  border: none;
  color: var(--editor-text-muted);
  cursor: pointer;
  border-top: 2px solid transparent;
  transition: all 0.2s;
  font-size: 13px;
  font-weight: 600;
}

.mode-tab:hover {
  color: var(--editor-text);
}

.mode-tab.active {
  color: var(--text-primary);
  border-top-color: var(--accent-blue);
  background: var(--editor-bg);
}

.editor-actions {
  display: flex;
  gap: 8px;
}

.editor-actions .btn-modern {
  transition: all 0.2s ease;
}

/* Download button hover */
#download-project-btn:hover {
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

/* Testnet button hover */
#run-testnet-btn:hover {
  background: rgba(163, 230, 53, 0.1);
  border-color: var(--accent-blue);
}

/* Mainnet button hover */
#run-mainnet-btn:hover {
  background: rgba(245, 158, 11, 0.1);
  border-color: #f59e0b;
}

/* Editor Views (Code/Preview Toggle) */
.editor-view {
  display: none;
  flex: 1;
  min-height: 0;
}

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

#code-view {
  flex-direction: column;
}

.monaco-editor {
  flex: 1;
  min-height: 0;
}

#preview-view {
  background: var(--bg-primary);
}

#preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: var(--bg-primary);
}

/* Console Resizer */
.console-resizer {
  height: 4px;
  background: var(--editor-border);
  cursor: row-resize;
  transition: background 0.2s;
}

.console-resizer:hover {
  background: var(--accent-blue);
}

/* Console Output (Bottom) */
.console-output {
  height: 200px;
  min-height: 100px;
  max-height: 600px;
  background: var(--editor-bg);
  border-top: 1px solid var(--editor-border);
  display: flex;
  flex-direction: column;
}

.console-header {
  padding: 8px 15px;
  background: var(--editor-sidebar);
  font-size: 13px;
  font-weight: 600;
  color: var(--editor-text-muted);
  border-bottom: 1px solid var(--editor-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.terminal-actions {
  display: flex;
  gap: 8px;
}

.terminal-actions .btn-modern {
  transition: all 0.2s ease;
}

/* Terminal Clear button hover */
#terminal-clear-btn:hover {
  color: var(--text-primary);
  border-color: var(--editor-border);
  background: var(--editor-hover);
}

/* Terminal Stop button hover */
#terminal-stop-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
}

/* Terminal New Session button hover */
#terminal-new-btn:hover {
  background: rgba(163, 230, 53, 0.1);
  border-color: var(--accent-blue);
}

.console-content {
  flex: 1;
  overflow-y: auto;
  padding: 10px 15px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.6;
}

/* Terminal Container */
.terminal-container {
  flex: 1;
  overflow: hidden;
  background: var(--editor-bg);
  padding: 10px;
}

.terminal-container .xterm {
  height: 100%;
}

.terminal-container .xterm-viewport {
  overflow-y: auto !important;
}

.console-line {
  margin-bottom: 5px;
}

.console-line.error {
  color: #f48771;
}

.console-line.success {
  color: #89d185;
}

.console-line.info {
  color: #75beff;
}

/* Chat Resizer */
.chat-resizer {
  width: 4px;
  background: var(--editor-border);
  cursor: col-resize;
  transition: background 0.2s;
}

.chat-resizer:hover {
  background: var(--accent-blue);
}

/* Side Panel - AI Chat Only */
.side-panel {
  width: 400px;
  min-width: 300px;
  max-width: 800px;
  background: var(--editor-sidebar);
  border-left: 1px solid var(--editor-border);
  display: flex;
  flex-direction: column;
}

.panel-header {
  padding: 12px 15px;
  background: var(--editor-sidebar);
  border-bottom: 1px solid var(--editor-border);
}

.panel-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* AI Chat Panel */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
}

.chat-message {
  margin-bottom: 15px;
  padding: 12px;
  border-radius: 8px;
  line-height: 1.5;
}

.chat-message.user {
  background: var(--editor-hover);
  margin-left: 20px;
}

.chat-message.assistant {
  background: rgba(59, 130, 246, 0.1);
  margin-right: 20px;
  border-left: 3px solid var(--accent-blue);
}

.chat-message.system {
  background: rgba(16, 185, 129, 0.1);
  margin: 0 20px;
  border-left: 3px solid var(--color-success);
}

.chat-message strong {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  opacity: 0.8;
}

.chat-message code {
  background: rgba(0,0,0,0.3);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Consolas', monospace;
  font-size: 13px;
}

.chat-message pre {
  background: var(--editor-bg);
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 10px 0;
  border: 1px solid var(--editor-border);
}

.chat-input-container {
  padding: 0;
  border-top: none;
  display: block;
  width: 100%;
  box-sizing: border-box;
}

#chat-input {
  flex: 1;
  padding: 10px;
  background: var(--editor-input-bg);
  border: 1px solid var(--editor-border);
  color: var(--editor-text);
  border-radius: 4px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
}

.chat-info {
  padding: 8px 15px;
  text-align: center;
  font-size: 12px;
  color: var(--editor-text-muted);
  border-top: 1px solid var(--editor-border);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--editor-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--editor-border);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--editor-text-muted);
}

/* File Manager Styles */
.file-tree {
  padding: 10px;
}

.file-item {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  margin: 2px 0;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
}

.file-item:hover {
  background: var(--editor-hover);
}

.file-item.active {
  background: var(--accent-blue);
  color: white;
}

.file-icon {
  margin-right: 8px;
  font-size: 16px;
}

.file-name {
  flex: 1;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-delete {
  opacity: 0;
  background: #f14c4c;
  border: none;
  color: white;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 16px;
  margin-left: 8px;
}

.file-item:hover .file-delete {
  opacity: 1;
}

.file-delete:hover {
  background: #c93a3a;
}

.empty-state {
  padding: 20px;
  text-align: center;
  color: var(--editor-text-muted);
  font-size: 13px;
}

/* Console Output Styles */
.console-output {
  border-top: 1px solid var(--editor-border);
}

.console-header {
  padding: 8px 15px;
  background: var(--editor-sidebar);
  font-weight: 600;
  font-size: 13px;
  border-bottom: 1px solid var(--editor-border);
}

.console-content {
  padding: 10px 15px;
  max-height: 200px;
  overflow-y: auto;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
}

.console-line {
  padding: 2px 0;
  line-height: 1.5;
}

.console-info {
  color: #4ec9b0;
}

.console-success {
  color: #4ec9b0;
  font-weight: 600;
}

.console-error {
  color: #f48771;
}

.console-output {
  color: var(--editor-text);
}

.console-code {
  background: var(--editor-bg);
  padding: 10px;
  border-radius: 4px;
  margin: 5px 0;
  overflow-x: auto;
}

/* ===== MODERN AI CHAT STYLES ===== */

/* Compact Thinking Indicator */
.ai-thinking-compact {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  margin: var(--space-sm) 0;
  background: var(--bg-primary);
  border: 2px solid var(--border-primary);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  animation: fadeIn 0.2s ease-out;
}

.ai-thinking-compact .thinking-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-primary);
  animation: pulse-brutal 1.5s infinite;
}

.ai-thinking-compact .thinking-text {
  color: var(--text-primary);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Old thinking animation - hidden */
.ai-thinking {
  display: none;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.thinking-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: #60a5fa;
  font-size: 14px;
}

.thinking-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #3b82f6;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.thinking-dots::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* Action Steps */
.action-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.action-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 6px;
  font-size: 13px;
  color: #94a3b8;
  transition: all 0.3s ease;
}

.action-step.active {
  background: rgba(59, 130, 246, 0.2);
  color: #e2e8f0;
  border-left: 2px solid #3b82f6;
}

.action-step.completed {
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
}

.step-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.step-icon.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Todo List Styles */
.todo-list {
  margin: 16px 0;
  padding: 16px;
  background: #1e293b;
  border-radius: 8px;
  border-left: 3px solid #8b5cf6;
}

.todo-list-header {
  font-weight: 600;
  color: #c4b5fd;
  margin-bottom: 12px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  margin: 6px 0;
  background: rgba(139, 92, 246, 0.05);
  border-radius: 6px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.todo-item:hover {
  background: rgba(139, 92, 246, 0.1);
  transform: translateX(2px);
}

.todo-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid #6366f1;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all 0.2s ease;
}

.todo-item.completed .todo-checkbox {
  background: #22c55e;
  border-color: #22c55e;
}

.todo-item.completed .todo-checkbox::after {
  content: '✓';
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.todo-item.in-progress .todo-checkbox {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.2);
}

.todo-item.in-progress .todo-checkbox::after {
  content: '⟳';
  color: #3b82f6;
  font-size: 12px;
  animation: spin 2s linear infinite;
}

.todo-text {
  flex: 1;
  font-size: 13px;
  line-height: 1.6;
  color: #cbd5e1;
}

.todo-item.completed .todo-text {
  text-decoration: line-through;
  opacity: 0.6;
  color: #86efac;
}

.todo-item.in-progress .todo-text {
  color: #93c5fd;
  font-weight: 500;
}

/* Improved Message Styles */
.chat-message.assistant {
  background: rgba(59, 130, 246, 0.1);
  border-left: 3px solid var(--accent-blue);
  padding: 16px;
  border-radius: 12px;
  animation: slideIn 0.3s ease-out;
}

.chat-message.user {
  background: var(--editor-hover);
  border-left: 3px solid var(--color-success);
  padding: 16px;
  border-radius: 12px;
  animation: slideIn 0.3s ease-out;
}

.message-role {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chat-message.user .message-role {
  color: #6ee7b7;
}

.chat-message.assistant .message-role {
  color: #93c5fd;
}

.message-role::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.chat-message.user .message-role::before {
  background: #10b981;
}

.chat-message.assistant .message-role::before {
  background: #3b82f6;
}

/* Code Block Improvements */
.chat-message pre {
  background: var(--editor-bg);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 12px 0;
  border: 1px solid var(--editor-border);
}

.chat-message pre code {
  background: transparent;
  padding: 0;
  color: var(--editor-text);
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.5;
}

.chat-message code {
  background: rgba(59, 130, 246, 0.1);
  color: #93c5fd;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'Consolas', monospace;
  font-size: 13px;
  font-weight: 500;
}

/* Progress Indicator */
.progress-bar {
  height: 3px;
  background: #1e293b;
  border-radius: 2px;
  overflow: hidden;
  margin-top: 12px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
  0% { width: 0%; }
  50% { width: 70%; }
  100% { width: 100%; }
}

/* Summary Section */
.summary-section {
  margin: 16px 0;
  padding: 16px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.05) 100%);
  border-left: 3px solid #10b981;
  border-radius: 8px;
}

.summary-title {
  font-weight: 600;
  color: #6ee7b7;
  margin-bottom: 8px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.summary-title::before {
  content: '✓';
  background: #10b981;
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

/* File Indicator - Minimal display for auto-saved files */
.file-indicator {
  display: inline-block;
  padding: 6px 12px;
  margin: 4px 4px 4px 0;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 6px;
  color: #93c5fd;
  font-size: 13px;
  font-family: 'Monaco', 'Menlo', monospace;
  transition: all 0.2s ease;
}

.file-indicator:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.5);
}

/* Creation Summary - Clean file creation summary */
.creation-summary {
  margin: 12px 0;
  padding: 16px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.05) 100%);
  border-left: 3px solid #10b981;
  border-radius: 8px;
  animation: slideIn 0.3s ease-out;
}

.summary-header {
  font-weight: 600;
  color: #6ee7b7;
  margin-bottom: 12px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

/* Mobile Editor Warning */
.editor-mobile-warning {
  display: none;
}

/* ==================== TABLET OPTIMIZATIONS (768px - 1024px) ==================== */
@media (min-width: 768px) and (max-width: 1024px) {
  /* Editor Container für Tablets */
  .app-header {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: var(--space-sm);
  }

  .project-selector {
    flex: 1;
    min-width: 200px;
  }

  #project-select {
    min-width: 180px;
    font-size: 13px;
  }

  .header-info {
    gap: var(--space-sm);
    flex-wrap: wrap;
  }

  .token-display,
  .wallet-display {
    font-size: 12px;
  }

  /* File Explorer für Tablets - schmaler */
  .file-explorer {
    width: 200px;
    min-width: 180px;
  }

  .explorer-header {
    padding: 8px 12px;
  }

  .file-item {
    padding: 10px 12px;
    min-height: 44px; /* Touch-Target */
  }

  /* Editor Tabs für Tablets */
  .editor-tabs {
    padding: 0 8px;
    flex-wrap: wrap;
  }

  .mode-tab {
    padding: 10px 16px;
    font-size: 12px;
    min-height: 44px; /* Touch-Target */
  }

  .editor-actions {
    gap: 6px;
    flex-wrap: wrap;
  }

  .editor-actions .btn-modern {
    padding: 8px 12px;
    font-size: 12px;
    min-height: 44px; /* Touch-Target */
  }

  /* Console für Tablets */
  .console-output {
    height: 180px;
    min-height: 120px;
  }

  .console-header {
    padding: 8px 12px;
    font-size: 12px;
  }

  .terminal-actions .btn-modern {
    padding: 6px 10px;
    font-size: 11px;
    min-height: 40px; /* Touch-Target */
  }

  /* AI Chat Panel für Tablets */
  .ai-panel {
    width: 320px;
    min-width: 280px;
  }

  .chat-header {
    padding: 12px 16px;
  }

  .chat-messages {
    padding: 12px 16px;
  }

  .chat-input-container {
    padding: 12px 16px;
  }

  .chat-input {
    min-height: 44px; /* Touch-Target */
    font-size: 14px;
  }

  .chat-send-btn {
    min-width: 44px;
    min-height: 44px;
  }

  /* Touch-optimierte Buttons */
  .btn-modern,
  button {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Mobile Warning nur für kleine Bildschirme */
@media (max-width: 767px) {
  body.editor-page .editor-mobile-warning {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 8, 15, 0.95);
    backdrop-filter: blur(14px);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    text-align: center;
  }

  body.editor-page .editor-mobile-warning .warning-card {
    max-width: 480px;
    border: 3px solid var(--accent-blue);
    padding: var(--space-2xl);
    background: rgba(10, 10, 15, 0.9);
    box-shadow: 12px 12px 0 rgba(0, 0, 0, 0.6);
  }

  body.editor-page .warning-eyebrow {
    font-family: var(--font-mono);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--accent-blue);
    font-size: 0.75rem;
  }

  body.editor-page .warning-card h2 {
    margin: var(--space-md) 0;
    font-size: 1.75rem;
    color: var(--text-primary);
  }

  body.editor-page .warning-message {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: var(--space-lg);
  }

  body.editor-page .warning-actions {
    display: flex;
    justify-content: center;
  }

  body.editor-page .app-container {
    filter: blur(4px);
    pointer-events: none;
    user-select: none;
  }
}

