/* =====================================================
   SOPHIA QW-CODE - AI IDE Design System
   Cursor-like dark theme with red/orange/blue accents
   ===================================================== */

/* === CSS Custom Properties === */
:root {
  /* Dark Background Palette */
  --bg-deep: #0A0A0F;
  --bg-primary: #0D1117;
  --bg-secondary: #161B22;
  --bg-tertiary: #1C2128;
  --bg-elevated: #21262D;
  --bg-surface: #2D333B;

  /* Accent Colors - Red/Orange/Blue */
  --accent-red: #FF3B30;
  --accent-orange: #FF9500;
  --accent-blue: #00D4FF;
  --accent-deep-blue: #0066FF;
  --accent-coral: #FF6B6B;

  /* Glassmorphism */
  --glass-bg: rgba(13, 17, 23, 0.9);
  --glass-border: rgba(255, 59, 48, 0.15);
  --glass-border-hover: rgba(255, 149, 0, 0.3);
  --glass-shadow: rgba(0, 0, 0, 0.6);

  /* Text Colors */
  --text-primary: #F0F6FC;
  --text-secondary: rgba(240, 246, 252, 0.7);
  --text-muted: rgba(240, 246, 252, 0.4);
  --text-code: #FF9500;

  /* Accent Gradients */
  --accent-gradient: linear-gradient(135deg, var(--accent-red), var(--accent-orange));
  --accent-gradient-blue: linear-gradient(135deg, var(--accent-blue), var(--accent-deep-blue));
  --accent-gradient-soft: linear-gradient(135deg, rgba(255, 59, 48, 0.15), rgba(255, 149, 0, 0.15));
  --neon-gradient: linear-gradient(90deg, var(--accent-red), var(--accent-orange), var(--accent-blue));

  /* Semantic Colors */
  --success: #34C759;
  --warning: #FF9500;
  --error: #FF3B30;
  --info: #00D4FF;

  /* Typography */
  --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --font-ui: 'Inter', sans-serif;

  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 14px;

  /* Shadows & Glows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
  --glow-red: 0 0 20px rgba(255, 59, 48, 0.4), 0 0 40px rgba(255, 59, 48, 0.2);
  --glow-orange: 0 0 20px rgba(255, 149, 0, 0.4), 0 0 40px rgba(255, 149, 0, 0.2);
  --glow-blue: 0 0 20px rgba(0, 212, 255, 0.4), 0 0 40px rgba(0, 212, 255, 0.2);

  /* Transitions */
  --transition-fast: 0.12s ease-out;
  --transition-base: 0.2s ease-out;
  --transition-slow: 0.35s ease-out;

  /* Layout */
  --sidebar-width: 240px;
  --chat-width: 380px;
  --header-height: 48px;
  --terminal-height: 200px;
}

/* === Reset & Base === */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-deep);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* === Subtle Background Effect === */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 0% 0%, rgba(255, 59, 48, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 100% 100%, rgba(0, 212, 255, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* === IDE Layout === */
.ide-container {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr var(--chat-width);
  grid-template-rows: var(--header-height) 1fr;
  height: calc(100vh - 28px); /* Account for fixed status bar at bottom */
  width: 100vw;
}

/* === Header Bar === */
.ide-header {
  grid-column: 1 / -1;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  gap: var(--space-4);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.ide-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.ide-logo-img {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
}

.ide-logo-text {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.header-tab {
  padding: var(--space-2) var(--space-4);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.header-tab:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.header-tab.active {
  background: var(--bg-elevated);
  color: var(--accent-orange);
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.project-name {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* === File Explorer Sidebar === */
.file-explorer {
  background: var(--bg-primary);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.explorer-title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.explorer-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2);
}

.file-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.file-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.file-item.active {
  background: rgba(255, 149, 0, 0.1);
  color: var(--accent-orange);
}

.file-item.folder {
  color: var(--accent-blue);
}

.file-icon {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

/* === Main Editor Area === */
.main-area {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}

/* Editor Tabs */
.editor-tabs {
  display: flex;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--glass-border);
  overflow-x: auto;
}

.editor-tab {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: transparent;
  border: none;
  border-right: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.editor-tab:hover {
  background: var(--bg-tertiary);
}

.editor-tab.active {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-bottom: 2px solid var(--accent-orange);
}

.tab-close {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.editor-tab:hover .tab-close {
  opacity: 0.5;
}

.tab-close:hover {
  opacity: 1;
  background: rgba(255, 59, 48, 0.2);
}

/* Code Editor */
.code-editor {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: var(--bg-deep);
}

.line-numbers {
  padding: var(--space-4) var(--space-3);
  background: var(--bg-primary);
  border-right: 1px solid var(--glass-border);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: right;
  user-select: none;
  line-height: 1.6;
}

.code-content {
  flex: 1;
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.6;
  overflow: auto;
  white-space: pre;
  color: var(--text-primary);
}

/* Syntax Highlighting */
.code-keyword {
  color: var(--accent-red);
}

.code-string {
  color: #A8FF60;
}

.code-number {
  color: var(--accent-orange);
}

.code-comment {
  color: var(--text-muted);
  font-style: italic;
}

.code-function {
  color: var(--accent-blue);
}

.code-variable {
  color: var(--text-primary);
}

.code-property {
  color: #79C0FF;
}

/* === Terminal Panel === */
.terminal-panel {
  height: var(--terminal-height);
  background: var(--bg-deep);
  border-top: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-4);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--glass-border);
}

.terminal-tabs {
  display: flex;
  gap: var(--space-2);
}

.terminal-tab {
  padding: var(--space-1) var(--space-3);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.terminal-tab:hover {
  color: var(--text-secondary);
}

.terminal-tab.active {
  background: var(--bg-tertiary);
  color: var(--accent-orange);
}

.terminal-content {
  flex: 1;
  padding: var(--space-3);
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.terminal-line {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.terminal-prompt {
  color: var(--accent-blue);
}

.terminal-command {
  color: var(--text-primary);
}

.terminal-output {
  color: var(--text-secondary);
}

.terminal-error {
  color: var(--accent-red);
}

.terminal-input {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-secondary);
  border-top: 1px solid var(--glass-border);
}

.terminal-input-prompt {
  color: var(--accent-blue);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.terminal-input input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  outline: none;
}

/* === AI Chat Sidebar === */
.chat-sidebar {
  background: var(--bg-primary);
  border-left: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-title {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.chat-title-icon {
  color: var(--accent-orange);
}

/* Model Selector */
.model-selector {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--glass-border);
  overflow-x: auto;
}

.model-btn {
  padding: var(--space-1) var(--space-3);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.model-btn:hover {
  color: var(--text-secondary);
  border-color: var(--glass-border);
}

.model-btn.active {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
}

.model-btn.kimi {
  --model-color: #FF6B6B;
}

.model-btn.gemini {
  --model-color: var(--accent-blue);
}

.model-btn.gpt4 {
  --model-color: #10A37F;
}

.model-btn.grok {
  --model-color: var(--accent-orange);
}

.model-btn.claude {
  --model-color: #CC785C;
}

.model-btn.sophiaq {
  --model-color: var(--accent-red);
}

.model-btn.active.sophiaq {
  background: linear-gradient(135deg, var(--accent-red), var(--accent-orange));
  box-shadow: var(--glow-red);
}

.model-btn.active.kimi {
  background: linear-gradient(135deg, #FF6B6B, #FF3B30);
}

.model-btn.active.gemini {
  background: var(--accent-gradient-blue);
}

.model-btn.active.gpt4 {
  background: linear-gradient(135deg, #10A37F, #1A7F64);
}

.model-btn.active.grok {
  background: var(--accent-gradient);
}

.model-btn.active.claude {
  background: linear-gradient(135deg, #CC785C, #DA9276);
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.chat-message {
  display: flex;
  gap: var(--space-3);
}

.chat-message.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  flex-shrink: 0;
}

.message-avatar.ai {
  background: var(--accent-gradient);
  color: white;
}

.message-avatar.user {
  background: var(--bg-elevated);
  color: var(--accent-blue);
}

.message-content {
  flex: 1;
  max-width: 85%;
}

.message-bubble {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.chat-message.ai .message-bubble {
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  border-top-left-radius: var(--radius-sm);
}

.chat-message.user .message-bubble {
  background: rgba(255, 149, 0, 0.15);
  border: 1px solid rgba(255, 149, 0, 0.3);
  border-top-right-radius: var(--radius-sm);
}

.message-code {
  margin-top: var(--space-2);
  padding: var(--space-3);
  background: var(--bg-deep);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  overflow-x: auto;
  border: 1px solid var(--glass-border);
}

.message-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--glass-border);
}

.message-code-lang {
  font-size: 10px;
  color: var(--accent-orange);
  text-transform: uppercase;
}

/* Chat Input */
.chat-input-area {
  padding: var(--space-3);
  background: var(--bg-secondary);
  border-top: 1px solid var(--glass-border);
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

.chat-input-wrapper:focus-within {
  border-color: var(--accent-orange);
  box-shadow: 0 0 0 2px rgba(255, 149, 0, 0.1);
}

.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  resize: none;
  outline: none;
  max-height: 120px;
  min-height: 24px;
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-send-btn {
  width: 32px;
  height: 32px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.chat-send-btn:hover {
  transform: scale(1.05);
  box-shadow: var(--glow-orange);
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
}

.btn-primary:hover {
  box-shadow: var(--glow-orange);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--glass-border-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: var(--space-2);
}

.btn-ghost:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-icon {
  width: 28px;
  height: 28px;
  padding: 0;
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-surface);
}

/* === Status Bar === */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-1) var(--space-4);
  background: var(--bg-secondary);
  border-top: 1px solid var(--glass-border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.status-left,
.status-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.status-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.status-dot.warning {
  background: var(--warning);
}

.status-dot.error {
  background: var(--error);
}

/* Desktop-only text helper */
.desktop-only-text {
  display: inline;
}

@media (max-width: 768px) {
  .desktop-only-text {
    display: none;
  }
}

/* === Loading States === */
.loading-dots {
  display: flex;
  gap: 4px;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  background: var(--accent-orange);
  border-radius: 50%;
  animation: loadingDot 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes loadingDot {

  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.4;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* === Responsive === */
@media (max-width: 1200px) {
  .ide-container {
    grid-template-columns: var(--sidebar-width) 1fr;
  }

  .chat-sidebar {
    display: none;
  }
}

@media (max-width: 768px) {
  .ide-container {
    grid-template-columns: 1fr;
  }

  .file-explorer {
    display: none;
  }
}

/* === Utility Classes === */
.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.gap-2 {
  gap: var(--space-2);
}

.gap-4 {
  gap: var(--space-4);
}

/* === Design System Panels === */
.design-system {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.design-tabs {
  display: flex;
  gap: 2px;
  padding: var(--space-2);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--glass-border);
}

.design-tab {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.design-tab:hover {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.design-tab.active {
  background: var(--accent-gradient);
  color: white;
}

.design-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
}

.design-panel {
  max-width: 600px;
}

.design-group {
  margin-bottom: var(--space-6);
}

.design-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-3);
}

.design-input,
.design-select,
.design-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
}

.design-input:focus,
.design-select:focus,
.design-textarea:focus {
  outline: none;
  border-color: var(--accent-orange);
  box-shadow: 0 0 0 2px rgba(255, 149, 0, 0.1);
}

.design-textarea {
  min-height: 120px;
  resize: vertical;
  font-family: var(--font-mono);
}

.design-textarea.spec-editor {
  min-height: 200px;
}

/* Color Swatches */
.color-swatches {
  display: flex;
  gap: var(--space-2);
}

.swatch {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition-fast);
}

.swatch:hover {
  transform: scale(1.1);
}

.swatch.selected {
  border-color: white;
  box-shadow: var(--glow-orange);
}

/* Toggle List */
.toggle-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.toggle-btn {
  padding: var(--space-1) var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toggle-btn.active {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
}

/* Button Group */
.button-group {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.choice-btn {
  padding: var(--space-2) var(--space-4);
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.choice-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.choice-btn.active {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
}

/* Templates Grid */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: var(--space-3);
}

.template-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.template-card:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-orange);
}

.template-card.selected {
  background: rgba(255, 149, 0, 0.1);
  border-color: var(--accent-orange);
  box-shadow: var(--glow-orange);
}

.template-icon {
  font-size: 24px;
}

.template-name {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
}

/* Generate Button */
.generate-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-4);
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.generate-btn:hover {
  box-shadow: var(--glow-orange);
  transform: translateY(-2px);
}

/* === Preview Wrapper === */
.preview-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--glass-border);
}

.device-buttons {
  display: flex;
  gap: var(--space-2);
}

.device-btn {
  padding: var(--space-2) var(--space-3);
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.device-btn:hover {
  background: var(--bg-tertiary);
}

.device-btn.active {
  background: var(--accent-gradient);
  border-color: transparent;
}

.preview-actions {
  display: flex;
  gap: var(--space-2);
}

.preview-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: var(--bg-deep);
}

.preview-frame.tablet {
  max-width: 768px;
  margin: 0 auto;
}

.preview-frame.mobile {
  max-width: 375px;
  margin: 0 auto;
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 400px;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--glass-border);
}

.modal-header h3 {
  font-size: var(--text-lg);
  font-weight: 600;
}

.modal-body {
  padding: var(--space-4);
}

.api-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.api-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}

code {
  background: var(--bg-deep);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-orange);
}

/* === Command Palette === */
.command-palette {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  z-index: 20000;
}

.palette-content {
  width: 100%;
  max-width: 600px;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.palette-search {
  width: 100%;
  padding: var(--space-4) var(--space-5);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: var(--text-base);
  font-family: var(--font-ui);
  outline: none;
}

.palette-search::placeholder {
  color: var(--text-muted);
}

.palette-results {
  max-height: 400px;
  overflow-y: auto;
  padding: var(--space-2);
}

.palette-section {
  padding: var(--space-2) var(--space-3);
}

.palette-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.palette-item:hover {
  background: var(--bg-tertiary);
}

.palette-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.palette-item-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.palette-item-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.palette-item-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* Context Menu */
.context-menu {
  min-width: 150px;
}

.context-menu .btn {
  border-radius: 0;
}

/* Status Dot Variants */
.status-dot.warning {
  background: var(--warning);
}

.status-dot.error {
  background: var(--error);
}

/* === File Explorer Enhancements === */
.folder-toggle {
  font-size: 10px;
  width: 16px;
  text-align: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.folder-toggle:hover {
  color: var(--accent-orange);
}

.file-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  position: relative;
}

.file-item .file-actions {
  margin-left: auto;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

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

.file-actions .btn {
  padding: 2px 6px;
  min-width: auto;
  font-size: 12px;
}

.explorer-actions {
  border-top: 1px solid var(--glass-border);
  padding-top: var(--space-2);
}

/* Nested folder line indicator */
.file-item.folder::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  width: 1px;
  height: calc(100% + 4px);
  background: var(--glass-border);
  opacity: 0;
}
/* =====================================================
   MOBILE RESPONSIVE STYLES
   ===================================================== */

/* Mobile Chat Toggle Button - Hidden on desktop */
.mobile-chat-toggle {
  display: none !important;
}

/* Mobile styles */
@media (max-width: 768px) {
  /* Show mobile chat toggle */
  .mobile-chat-toggle {
    display: flex !important;
    padding: 8px !important;
    min-width: 44px !important;
    justify-content: center;
  }

  /* Hide desktop-only elements */
  #settingsBtn,
  #generateBtn,
  .header-tabs,
  .header-center {
    display: none !important;
  }

  /* Simplify header */
  .ide-header {
    padding: 0 8px !important;
    height: 52px !important;
  }

  .header-left {
    gap: 8px !important;
  }

  .ide-logo-text {
    font-size: 14px !important;
  }

  /* Hide file explorer on mobile */
  .file-explorer {
    display: none !important;
  }

  /* Test mode banner - simplified for mobile */
  #testModeBanner {
    flex-wrap: wrap;
    padding: 8px 12px !important;
    font-size: 11px !important;
    gap: 6px !important;
  }

  #testModeBanner span:nth-child(2),
  #testModeBanner span:nth-child(3) {
    display: none;
  }

  /* Main content takes full width */
  .main-content {
    grid-column: 1 / -1 !important;
  }

  /* IDE container - single column on mobile */
  .ide-container {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto 1fr !important;
  }

  /* Chat sidebar - fullscreen overlay on mobile */
  .chat-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 1000 !important;
    transform: translateX(100%);
    transition: transform 0.3s ease-out;
    border-left: none !important;
  }

  .chat-sidebar.mobile-open {
    transform: translateX(0);
  }

  /* Chat header with close button */
  .chat-header {
    padding: 16px !important;
    position: relative;
  }

  /* Model selector - scrollable on mobile */
  .model-selector {
    overflow-x: auto;
    flex-wrap: nowrap !important;
    padding: 8px 12px !important;
    gap: 8px !important;
    -webkit-overflow-scrolling: touch;
  }

  .model-btn {
    flex-shrink: 0;
    font-size: 12px !important;
    padding: 8px 12px !important;
    white-space: nowrap;
  }

  /* Chat messages area */
  .chat-messages {
    padding: 12px !important;
  }

  /* Chat input area - larger touch targets */
  .chat-input-area {
    padding: 12px !important;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .chat-input {
    font-size: 16px !important; /* Prevent zoom on iOS */
    padding: 14px !important;
    min-height: 50px !important;
  }

  .chat-send-btn {
    width: 48px !important;
    height: 48px !important;
  }

  /* Mobile close button for chat */
  .mobile-chat-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
  }

  .mobile-chat-close:hover {
    background: var(--accent-red);
  }

  /* Hide terminal on mobile by default */
  .terminal-panel {
    display: none !important;
  }

  /* Editor panel adjustments */
  .editor-panel {
    height: calc(100vh - 100px) !important;
  }

  .editor-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Extra small screens */
@media (max-width: 380px) {
  .ide-logo-text {
    display: none !important;
  }

  #testModeBanner button {
    padding: 4px 8px !important;
    font-size: 10px !important;
  }
}

/* Hide mobile close button on desktop */
.mobile-chat-close {
  display: none;
}

@media (max-width: 768px) {
  .mobile-chat-close {
    display: flex;
  }
}

/* =====================================================
   MOBILE LAYOUT - Complete Redesign
   Chat at bottom, editor in center, simple controls
   ===================================================== */

/* Hide mobile elements on desktop */
.mobile-bottom-bar,
.mobile-preview-modal,
.mobile-chat-toggle {
  display: none !important;
}

/* Show desktop elements */
.desktop-only {
  display: flex;
}

/* Mobile styles */
@media (max-width: 768px) {
  /* Hide desktop elements on mobile */
  .desktop-only,
  .file-explorer,
  .chat-sidebar,
  .terminal-panel,
  .header-tabs,
  .header-center,
  #settingsBtn,
  #generateBtn,
  .mobile-chat-toggle,
  .mobile-chat-close {
    display: none !important;
  }

  /* Test mode banner - compact */
  #testModeBanner {
    padding: 6px 12px !important;
    font-size: 11px !important;
    flex-wrap: nowrap;
    gap: 8px !important;
  }

  #testModeBanner span:nth-child(2),
  #testModeBanner span:nth-child(3) {
    display: none;
  }

  #testModeBanner button {
    padding: 4px 10px !important;
    font-size: 11px !important;
    white-space: nowrap;
  }

  /* Simplify header for mobile */
  .ide-header {
    padding: 0 8px !important;
    height: 48px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  .header-left {
    flex: 1;
    gap: 6px !important;
  }

  #backBtn {
    padding: 6px 10px !important;
    font-size: 11px !important;
  }

  .ide-logo-text {
    font-size: 13px !important;
  }

  .header-right {
    display: none !important;
  }

  /* IDE container - single column */
  .ide-container {
    display: flex !important;
    flex-direction: column !important;
    height: calc(100vh - 36px) !important; /* Account for test banner */
  }

  /* Main area takes full width */
  .main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 130px !important; /* Space for mobile bottom bar */
  }

  /* Editor tabs - scrollable on mobile */
  .editor-tabs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0;
    padding: 0 8px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--glass-border);
  }

  .editor-tab {
    flex-shrink: 0;
    font-size: 12px !important;
    padding: 10px 14px !important;
    white-space: nowrap;
    min-width: auto;
  }

  /* Code editor - full width */
  .code-editor {
    flex: 1;
    overflow: auto;
    font-size: 13px !important;
  }

  .line-numbers {
    padding: 12px 8px !important;
    font-size: 11px !important;
    min-width: 32px !important;
  }

  .code-content {
    padding: 12px !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
  }

  /* MOBILE BOTTOM BAR - Always visible */
  .mobile-bottom-bar {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--accent-orange);
    padding: 8px 12px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 2000;
    gap: 8px;
  }

  .mobile-action-buttons {
    display: flex;
    gap: 8px;
  }

  .mobile-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
  }

  .mobile-action-btn:hover,
  .mobile-action-btn:active {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
  }

  .mobile-chat-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
  }

  .mobile-chat-input {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--accent-orange);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 16px; /* Prevent iOS zoom */
    resize: none;
    min-height: 48px;
    max-height: 120px;
    outline: none;
  }

  .mobile-chat-input::placeholder {
    color: var(--text-muted);
  }

  .mobile-chat-input:focus {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 2px rgba(255, 149, 0, 0.2);
  }

  .mobile-send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-red), var(--accent-orange));
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s, box-shadow 0.2s;
  }

  .mobile-send-btn:hover,
  .mobile-send-btn:active {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(255, 149, 0, 0.4);
  }

  /* MOBILE PREVIEW MODAL */
  .mobile-preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-deep);
    z-index: 3000;
    flex-direction: column;
  }

  .mobile-preview-modal.active {
    display: flex !important;
  }

  .mobile-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-weight: 600;
  }

  .mobile-preview-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .mobile-preview-frame {
    flex: 1;
    border: none;
    background: white;
  }
}

/* Mobile Inline Preview - shows in center container */
.mobile-inline-preview {
  display: none;
  flex-direction: column;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-deep);
  z-index: 100;
}

.mobile-inline-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
}

.mobile-preview-close-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, var(--accent-red), var(--accent-orange));
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.mobile-inline-frame {
  flex: 1;
  border: none;
  background: white;
  width: 100%;
}

.main-area.showing-preview .code-editor,
.main-area.showing-preview .editor-tabs,
.main-area.showing-preview .terminal-panel {
  display: none;
}

/* Extra small screens */
@media (max-width: 380px) {
  .ide-logo-text {
    display: none !important;
  }

  .mobile-action-btn span {
    display: none;
  }

  .mobile-action-btn {
    padding: 12px !important;
  }
}

/* ==========================================
   Credits Display & Purchase Modal
   ========================================== */

.credits-container {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 217, 61, 0.1);
  border: 1px solid rgba(255, 217, 61, 0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
  color: #FFD93D;
}

.credits-container:hover {
  background: rgba(255, 217, 61, 0.2);
  border-color: rgba(255, 217, 61, 0.5);
}

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

.credits-admin {
  color: #00D4FF;
}

.credits-count {
  color: #22c55e;
}

.credits-free {
  color: #00D4FF;
}

.credits-empty {
  color: #FF3B30;
}

/* Credits Modal - Premium Design */
.credits-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.credits-modal.active {
  display: flex;
  animation: modalFadeIn 0.3s ease-out;
}

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

.credits-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
}

.credits-modal-content {
  position: relative;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(165deg, rgba(13, 17, 23, 0.98) 0%, rgba(10, 10, 15, 0.99) 100%);
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: 24px;
  box-shadow: 
    0 30px 60px -15px rgba(0, 0, 0, 0.7),
    0 0 80px rgba(0, 212, 255, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Animated glow orbs */
.modal-glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  opacity: 0.4;
}

.modal-glow-1 {
  top: -100px;
  right: -50px;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(0, 212, 255, 0.4) 0%, transparent 70%);
  animation: glowFloat1 8s ease-in-out infinite;
}

.modal-glow-2 {
  bottom: -80px;
  left: -30px;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(255, 149, 0, 0.3) 0%, transparent 70%);
  animation: glowFloat2 10s ease-in-out infinite;
}

@keyframes glowFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-20px, 20px) scale(1.1); }
}

@keyframes glowFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, -10px) scale(1.05); }
}

.credits-modal-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 32px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.modal-icon {
  width: 48px;
  height: 48px;
  animation: iconPulse 3s ease-in-out infinite;
}

@keyframes iconPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 8px rgba(255, 217, 61, 0.4)); }
  50% { transform: scale(1.05); filter: drop-shadow(0 0 16px rgba(255, 217, 61, 0.6)); }
}

.credits-modal-header h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  background: linear-gradient(135deg, #FFD93D 0%, #FF9500 50%, #FF6B9D 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.credits-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all 0.25s ease;
}

.credits-modal-close svg {
  width: 20px;
  height: 20px;
}

.credits-modal-close:hover {
  background: rgba(255, 59, 48, 0.15);
  border-color: rgba(255, 59, 48, 0.3);
  color: #FF3B30;
  transform: rotate(90deg);
}

.credits-modal-body {
  position: relative;
  padding: 32px;
}

.credits-modal-desc {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  color: rgba(255, 255, 255, 0.75);
  font-size: 15px;
  margin: 0 0 32px 0;
  line-height: 1.5;
}

.desc-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.highlight-text {
  color: #00D4FF;
  font-weight: 600;
}

.credit-tiers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.credit-tier {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.credit-tier::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.5), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.credit-tier:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(0, 212, 255, 0.4);
  transform: translateY(-8px);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5), 0 0 30px rgba(0, 212, 255, 0.1);
}

.credit-tier:hover::before {
  opacity: 1;
}

.credit-tier.featured {
  background: linear-gradient(165deg, rgba(255, 217, 61, 0.08) 0%, rgba(255, 149, 0, 0.05) 50%, rgba(255, 107, 157, 0.05) 100%);
  border-color: rgba(255, 149, 0, 0.35);
  box-shadow: 0 0 40px rgba(255, 149, 0, 0.1);
}

.credit-tier.featured::before {
  background: linear-gradient(90deg, transparent, rgba(255, 149, 0, 0.7), transparent);
  opacity: 1;
}

.credit-tier.featured:hover {
  border-color: rgba(255, 149, 0, 0.6);
  box-shadow: 0 25px 50px -15px rgba(0, 0, 0, 0.5), 0 0 50px rgba(255, 149, 0, 0.2);
}

.tier-popular {
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: linear-gradient(135deg, #FFD93D, #FF9500);
  border-radius: 0 0 16px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #000;
  box-shadow: 0 4px 12px rgba(255, 149, 0, 0.4);
}

.tier-popular svg {
  width: 14px;
  height: 14px;
}

.tier-icon-wrap {
  margin-bottom: 16px;
}

.tier-icon {
  width: 64px;
  height: 64px;
  transition: transform 0.3s ease;
}

.credit-tier:hover .tier-icon {
  transform: scale(1.1);
}

.featured-icon .tier-icon {
  animation: starGlow 2s ease-in-out infinite;
}

@keyframes starGlow {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(255, 149, 0, 0.3)); }
  50% { filter: drop-shadow(0 0 12px rgba(255, 149, 0, 0.6)); }
}

.tier-badge {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.tier-credits {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 8px;
}

.credit-num {
  font-size: 42px;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, #FFD93D, #FF9500);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.credit-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 500;
  margin-top: 4px;
}

.tier-price {
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.tier-per-credit {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 16px;
}

.tier-features {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.tier-feature {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.tier-feature svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.tier-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(0, 102, 255, 0.15));
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 12px;
  color: #00D4FF;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.tier-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.tier-btn:hover {
  background: linear-gradient(135deg, #00D4FF, #0066FF);
  border-color: transparent;
  color: #fff;
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(0, 212, 255, 0.3);
}

.tier-btn:hover svg {
  transform: translateX(4px);
}

.tier-btn.featured-btn {
  background: linear-gradient(135deg, rgba(255, 217, 61, 0.2), rgba(255, 149, 0, 0.2));
  border-color: rgba(255, 149, 0, 0.4);
  color: #FFD93D;
}

.tier-btn.featured-btn:hover {
  background: linear-gradient(135deg, #FFD93D, #FF9500);
  color: #000;
  box-shadow: 0 8px 24px rgba(255, 149, 0, 0.4);
}

.credits-modal-footer {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.secure-badge,
.instant-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

.secure-badge svg,
.instant-badge svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 768px) {
  .credits-modal-content {
    max-width: 100%;
    border-radius: 20px;
  }

  .credit-tiers {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .credit-tier {
    padding: 24px 20px;
  }

  .credit-tier.featured {
    order: -1;
  }

  .tier-popular {
    top: -1px;
  }

  .credits-modal-header {
    padding: 20px 24px;
  }

  .credits-modal-header h2 {
    font-size: 22px;
  }

  .modal-icon {
    width: 40px;
    height: 40px;
  }

  .credits-modal-body {
    padding: 24px;
  }

  .credits-modal-footer {
    flex-direction: column;
    gap: 12px;
    align-items: center;
  }

  .credits-container {
    padding: 4px 8px;
    font-size: 12px;
  }
}

/* ==========================================
   Orchestrator Toggle & Panel
   ========================================== */

.orchestrator-toggle-wrap {
  margin-right: 8px;
}

.orchestrator-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 12px;
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 10px;
  transition: all 0.3s ease;
}

.orchestrator-toggle:hover {
  background: rgba(0, 212, 255, 0.15);
  border-color: rgba(0, 212, 255, 0.4);
}

.orchestrator-toggle input {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 36px;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 2px;
}

.toggle-icon {
  width: 16px;
  height: 16px;
  color: rgba(255, 255, 255, 0.5);
  transition: all 0.3s ease;
}

.orchestrator-toggle input:checked + .toggle-slider {
  background: linear-gradient(135deg, #00D4FF, #0066FF);
  justify-content: flex-end;
}

.orchestrator-toggle input:checked + .toggle-slider .toggle-icon {
  color: #fff;
  animation: spinGlow 1s ease;
}

@keyframes spinGlow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(180deg); }
}

.toggle-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  transition: color 0.3s ease;
}

.orchestrator-toggle input:checked ~ .toggle-label {
  color: #00D4FF;
}

/* Orchestrator Panel */
.orchestrator-panel {
  position: fixed;
  bottom: 60px;
  right: 20px;
  width: 360px;
  max-height: 500px;
  background: linear-gradient(165deg, rgba(13, 17, 23, 0.98) 0%, rgba(10, 10, 15, 0.99) 100%);
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: 20px;
  box-shadow: 
    0 20px 40px -10px rgba(0, 0, 0, 0.6),
    0 0 60px rgba(0, 212, 255, 0.1);
  z-index: 9000;
  overflow: hidden;
  animation: panelSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.orchestrator-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(180deg, rgba(0, 212, 255, 0.08) 0%, transparent 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.orch-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.orch-icon {
  width: 24px;
  height: 24px;
  animation: iconSpin 8s linear infinite;
}

@keyframes iconSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.orch-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.2s ease;
}

.orch-close svg {
  width: 16px;
  height: 16px;
}

.orch-close:hover {
  background: rgba(255, 59, 48, 0.2);
  color: #FF3B30;
}

.orchestrator-body {
  padding: 16px 20px;
}

.orch-status {
  margin-bottom: 16px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}

.status-indicator svg {
  width: 20px;
  height: 20px;
}

.status-indicator.idle {
  color: rgba(255, 255, 255, 0.5);
}

.status-indicator.planning {
  color: #FFD93D;
  border-color: rgba(255, 217, 61, 0.3);
  background: rgba(255, 217, 61, 0.08);
}

.status-indicator.working {
  color: #00D4FF;
  border-color: rgba(0, 212, 255, 0.3);
  background: rgba(0, 212, 255, 0.08);
}

.status-indicator.complete {
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.08);
}

.orch-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.orch-control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.orch-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.5);
}

.orch-slider-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.orch-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
}

.orch-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, #00D4FF, #0066FF);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 212, 255, 0.4);
  transition: transform 0.2s ease;
}

.orch-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.orch-slider-value {
  font-size: 12px;
  font-weight: 700;
  color: #00D4FF;
  min-width: 40px;
}

.orch-mode-btns {
  display: flex;
  gap: 8px;
}

.orch-mode-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.orch-mode-btn svg {
  width: 18px;
  height: 18px;
}

.orch-mode-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.8);
}

.orch-mode-btn.active {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(0, 102, 255, 0.15));
  border-color: rgba(0, 212, 255, 0.4);
  color: #00D4FF;
}

.orch-agents {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.orch-agent {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 9px;
  font-weight: 600;
  transition: all 0.25s ease;
}

.orch-agent svg {
  width: 20px;
  height: 20px;
}

.orch-agent.active {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.8);
}

.orch-task-list {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.orch-task-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.5);
}

.orch-clear-btn {
  padding: 4px 10px;
  background: transparent;
  border: 1px solid rgba(255, 59, 48, 0.3);
  border-radius: 6px;
  color: rgba(255, 59, 48, 0.7);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.orch-clear-btn:hover {
  background: rgba(255, 59, 48, 0.15);
  border-color: rgba(255, 59, 48, 0.5);
  color: #FF3B30;
}

.orch-tasks-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 12px;
}

.orch-tasks-empty svg {
  width: 32px;
  height: 32px;
  opacity: 0.5;
}

/* Credits icon custom SVG */
.credits-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Thinking/Loading Animation - Theme Matched */
.thinking-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.08), rgba(255, 149, 0, 0.08));
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 12px;
  margin: 8px 0;
}

.thinking-dots {
  display: flex;
  gap: 4px;
}

.thinking-dots span {
  width: 8px;
  height: 8px;
  background: linear-gradient(135deg, #00D4FF, #FF9500);
  border-radius: 50%;
  animation: thinkingPulse 1.4s ease-in-out infinite;
}

.thinking-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.thinking-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes thinkingPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.thinking-text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  font-style: italic;
}

.thinking-text::after {
  content: '';
  animation: thinkingEllipsis 1.5s infinite;
}

@keyframes thinkingEllipsis {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

@media (max-width: 768px) {
  .orchestrator-panel {
    left: 10px;
    right: 10px;
    width: auto;
    bottom: 80px;
  }

  .orch-agents {
    grid-template-columns: repeat(2, 1fr);
  }

  .orchestrator-toggle-wrap {
    display: none;
  }
}

/* ==========================================
   Settings Modal
   ========================================== */

.settings-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
}

.settings-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
}

.settings-modal-content {
  position: relative;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  background: linear-gradient(165deg, rgba(13, 17, 23, 0.98) 0%, rgba(10, 10, 15, 0.99) 100%);
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: 20px;
  overflow: hidden;
  animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
  from { transform: translateY(30px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.settings-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(0, 212, 255, 0.08) 0%, transparent 100%);
}

.settings-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.settings-title svg {
  width: 24px;
  height: 24px;
}

.settings-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.2s ease;
}

.settings-close svg {
  width: 18px;
  height: 18px;
}

.settings-close:hover {
  background: rgba(255, 59, 48, 0.2);
  color: #FF3B30;
}

.settings-modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(80vh - 80px);
}

.settings-group {
  margin-bottom: 24px;
}

.settings-group-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.setting-item label {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
}

.setting-item input[type="range"] {
  width: 120px;
  -webkit-appearance: none;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, #00D4FF, #0066FF);
  border-radius: 50%;
  cursor: pointer;
}

.setting-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #00D4FF;
}

.setting-item select {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
}

.setting-item span {
  font-size: 12px;
  color: #00D4FF;
  min-width: 50px;
  text-align: right;
}

/* ==========================================
   Templates Modal
   ========================================== */

.templates-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
}

.templates-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.templates-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
}

.templates-modal-content {
  position: relative;
  width: 95%;
  max-width: 900px;
  max-height: 85vh;
  background: linear-gradient(165deg, rgba(13, 17, 23, 0.98) 0%, rgba(10, 10, 15, 0.99) 100%);
  border: 1px solid rgba(255, 149, 0, 0.25);
  border-radius: 24px;
  overflow: hidden;
  animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.templates-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 149, 0, 0.08) 0%, transparent 100%);
}

.templates-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 600;
  color: #fff;
}

.templates-title svg {
  width: 26px;
  height: 26px;
}

.templates-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.05);
  border: none;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.2s ease;
}

.templates-close:hover {
  background: rgba(255, 59, 48, 0.2);
  color: #FF3B30;
}

.templates-categories {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  overflow-x: auto;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.template-cat-btn {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.template-cat-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
}

.template-cat-btn.active {
  background: linear-gradient(135deg, rgba(255, 149, 0, 0.2), rgba(255, 107, 157, 0.2));
  border-color: rgba(255, 149, 0, 0.4);
  color: #FF9500;
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  padding: 20px 24px;
  overflow-y: auto;
  max-height: calc(85vh - 160px);
}

.template-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.template-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 149, 0, 0.4);
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.5);
}

.template-card-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.template-card-name {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 6px;
}

.template-card-category {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #FF9500;
  margin-bottom: 8px;
}

.template-card-desc {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.5;
}

/* ==========================================
   Enhanced Mobile Experience
   ========================================== */

@media (max-width: 768px) {
  .templates-modal-content {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
  
  .templates-grid {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 160px);
  }
  
  .settings-modal-content {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
  
  .mobile-bottom-bar {
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  
  .mobile-action-buttons {
    gap: 12px;
  }
  
  .mobile-action-btn {
    flex: 1;
    padding: 10px;
    gap: 6px;
  }
  
  .mobile-chat-input-wrapper {
    margin-top: 12px;
  }
  
  .mobile-chat-input {
    font-size: 16px;
    padding: 14px 16px;
  }
  
  .mobile-send-btn {
    width: 48px;
    height: 48px;
  }
  
  .orchestrator-panel {
    left: 8px;
    right: 8px;
    bottom: 100px;
    max-height: 60vh;
  }
  
  .orch-mode-btns {
    flex-wrap: wrap;
  }
  
  .orch-mode-btn {
    flex: 1 1 30%;
  }
  
  .orch-agents {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Reduce motion preference */
body.reduce-motion * {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}
