/* terminal.css - Styling for the Standalone & Embedded Terminal CLI Experience */

:root {
  --term-bg: #0d1117;
  --term-card-bg: #161b22;
  --term-header-bg: #1f242c;
  --term-border: #30363d;
  --term-text-main: #e6edf3;
  --term-text-muted: #8b949e;
  --term-green: #3fb950;
  --term-cyan: #58a6ff;
  --term-yellow: #d29922;
  --term-red: #f85149;
  --term-purple: #bc8cff;
  --term-pink: #f778ba;
  --term-font: 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
}

body.terminal-page-body {
  background-color: #f7f3ee;
  background-image: radial-gradient(#eadbc8 1.5px, transparent 1.5px);
  background-size: 24px 24px;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  font-family: 'Fredoka', 'Quicksand', sans-serif;
  color: var(--purble-chocolate);
}

.brand-link {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
}

.terminal-main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px 20px;
}

/* HERO CONTEXT BANNER */
.terminal-hero {
  background: #ffffff;
  border: 4px solid var(--purble-border);
  border-radius: 20px;
  padding: 24px 28px;
  box-shadow: var(--shadow-chunky);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 30px;
  margin-bottom: 24px;
}

.hero-left {
  flex: 1;
}

.hero-tag {
  display: inline-block;
  background: var(--purble-yellow);
  color: var(--purble-chocolate);
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  border: 2px solid var(--purble-border);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.hero-left h2 {
  font-size: 24px;
  font-weight: 800;
  color: var(--purble-chocolate);
  margin: 0 0 8px 0;
}

.hero-left p {
  font-size: 14px;
  font-weight: 600;
  color: #63534b;
  margin: 0;
  line-height: 1.5;
}

.hero-left code {
  background: #f1e7db;
  color: #a84218;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: var(--term-font);
  font-weight: 700;
  font-size: 13px;
}

.hero-right {
  display: flex;
  gap: 14px;
}

.quick-stats-pill {
  background: #fff8f0;
  border: 3px solid var(--purble-border);
  border-radius: 14px;
  padding: 12px 18px;
  text-align: center;
  min-width: 90px;
  box-shadow: 2px 3px 0 var(--purble-border);
}

.quick-stats-pill .stat-num {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--purble-pink);
}

.quick-stats-pill .stat-lbl {
  font-size: 11px;
  font-weight: 700;
  color: #8c6a54;
}

/* CLI TOOLBAR */
.cli-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.cli-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.cli-preset-lbl {
  font-size: 13px;
  font-weight: 800;
  color: var(--purble-chocolate);
  margin-right: 4px;
}

.btn-preset {
  background: #ffffff;
  border: 2px solid var(--purble-border);
  border-radius: 10px;
  padding: 6px 12px;
  cursor: pointer;
  font-family: var(--term-font);
  font-size: 12px;
  font-weight: 600;
  color: #4a3e3d;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
  box-shadow: 0 2px 0 var(--purble-border);
}

.btn-preset:hover {
  background: #fff4ea;
  transform: translateY(-1px);
  box-shadow: 0 3px 0 var(--purble-border);
}

.btn-preset.active {
  background: var(--purble-pink);
  color: #ffffff;
  border-color: var(--purble-border);
  box-shadow: 0 2px 0 var(--purble-border);
}

.btn-preset.active code {
  color: #ffffff;
}

.badge-mini {
  background: rgba(0, 0, 0, 0.08);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
}

.btn-preset.active .badge-mini {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.cli-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.speed-toggle {
  display: flex;
  background: #e9decb;
  border: 2px solid var(--purble-border);
  border-radius: 10px;
  padding: 2px;
  gap: 2px;
}

.speed-btn {
  background: transparent;
  border: none;
  font-size: 11px;
  font-weight: 800;
  color: #735d50;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.speed-btn.active {
  background: #ffffff;
  color: var(--purble-chocolate);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.btn-terminal-action {
  background: #ffffff;
  border: 2px solid var(--purble-border);
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 800;
  color: var(--purble-chocolate);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  box-shadow: 0 2px 0 var(--purble-border);
}

.btn-terminal-action:hover {
  background: #fff8f0;
  transform: translateY(-1px);
}

.btn-terminal-action:active {
  transform: translateY(1px);
  box-shadow: none;
}

.btn-terminal-run {
  background: var(--purble-mint);
  color: #155724;
  border-color: var(--purble-border);
}

.btn-terminal-run:hover {
  background: #9fe2bf;
}

/* TERMINAL WINDOW FRAME */
.terminal-window {
  background: var(--term-bg);
  border: 4px solid var(--purble-border);
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25), 0 4px 0 var(--purble-border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Titlebar */
.terminal-titlebar {
  background: var(--term-header-bg);
  border-bottom: 2px solid var(--term-border);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.window-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.win-btn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  cursor: pointer;
  box-shadow: inset 0 0 1px rgba(0,0,0,0.5);
}

.win-close { background: #ff5f56; border: 1px solid #e0443e; }
.win-minimize { background: #ffbd2e; border: 1px solid #dea123; }
.win-maximize { background: #27c93f; border: 1px solid #1aab29; }

.window-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #c9d1d9;
  font-family: var(--term-font);
  font-size: 13px;
  font-weight: 600;
}

.window-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--term-font);
  font-size: 11px;
  color: #8b949e;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3fb950;
  box-shadow: 0 0 8px rgba(63, 185, 80, 0.7);
  display: inline-block;
}

/* TERMINAL SCREEN BODY */
.terminal-screen {
  background: var(--term-bg);
  color: var(--term-text-main);
  font-family: var(--term-font);
  font-size: 13px;
  line-height: 1.45;
  padding: 20px 22px;
  min-height: 480px;
  max-height: 640px;
  overflow-y: auto;
  overflow-x: auto;
  white-space: pre;
}

.terminal-screen::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.terminal-screen::-webkit-scrollbar-track {
  background: #0d1117;
}

.terminal-screen::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 5px;
}

.terminal-screen::-webkit-scrollbar-thumb:hover {
  background: #484f58;
}

/* TERMINAL LINE STYLES */
.term-line {
  margin: 0;
  padding: 1px 0;
  display: block;
}

.term-prompt-line {
  color: #79c0ff;
  font-weight: 600;
  margin-bottom: 8px;
}

.term-prompt-user { color: #7ee787; font-weight: 700; }
.term-prompt-dir { color: #58a6ff; font-weight: 700; }
.term-prompt-cmd { color: #ffeb95; font-weight: 700; }

.term-banner-border {
  color: #58a6ff;
  opacity: 0.85;
}

.term-banner-title {
  color: #ffffff;
  font-weight: 700;
}

.term-table-header {
  color: #8b949e;
  font-weight: 700;
}

.term-table-divider {
  color: #30363d;
}

.term-order-id {
  color: #79c0ff;
  font-weight: 600;
}

.term-product-name {
  color: #f0f6fc;
}

.term-deadline {
  color: #f38b3c;
}

.term-val {
  color: #a5d6ff;
}

.term-fragile-yes {
  color: #ff7b72;
  font-weight: 700;
}

.term-fragile-no {
  color: #6e7681;
}

.term-badge-high {
  color: #ff7b72;
  font-weight: 800;
  background: rgba(248, 81, 73, 0.15);
  padding: 1px 5px;
  border-radius: 4px;
}

.term-badge-med {
  color: #d29922;
  font-weight: 800;
  background: rgba(210, 153, 34, 0.15);
  padding: 1px 5px;
  border-radius: 4px;
}

.term-badge-low {
  color: #3fb950;
  font-weight: 800;
  background: rgba(63, 185, 80, 0.15);
  padding: 1px 5px;
  border-radius: 4px;
}

.term-confidence {
  color: #79c0ff;
  font-weight: 700;
}

.term-complete-banner {
  color: #3fb950;
  font-weight: 700;
  margin-top: 8px;
}

/* TERMINAL CURSOR */
.term-cursor {
  display: inline-block;
  width: 8px;
  height: 15px;
  background: #58a6ff;
  vertical-align: middle;
  margin-left: 2px;
  animation: termBlink 1s infinite;
}

@keyframes termBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* TERMINAL INPUT BAR */
.terminal-input-bar {
  background: var(--term-card-bg);
  border-top: 2px solid var(--term-border);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.prompt-prefix {
  font-family: var(--term-font);
  font-size: 13px;
  white-space: nowrap;
}

.prompt-user { color: #7ee787; font-weight: 700; }
.prompt-path { color: #58a6ff; font-weight: 700; }
.prompt-symbol { color: #f0f6fc; font-weight: 700; margin-left: 2px; }

.terminal-cli-input {
  flex: 1;
  background: #0d1117;
  border: 1px solid var(--term-border);
  border-radius: 8px;
  padding: 8px 12px;
  color: #ffeb95;
  font-family: var(--term-font);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s ease;
}

.terminal-cli-input:focus {
  border-color: #58a6ff;
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

.btn-send-cmd {
  background: #21262d;
  color: #c9d1d9;
  border: 1px solid var(--term-border);
  border-radius: 8px;
  padding: 8px 14px;
  font-family: var(--term-font);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-send-cmd:hover {
  background: #30363d;
  color: #ffffff;
}

/* INSIGHTS GRID */
.terminal-insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.insight-card {
  background: #ffffff;
  border: 3px solid var(--purble-border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow-chunky);
  display: flex;
  gap: 16px;
}

.insight-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.insight-content h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--purble-chocolate);
  margin: 0 0 6px 0;
}

.insight-content p {
  font-size: 13px;
  font-weight: 600;
  color: #6a594d;
  line-height: 1.5;
  margin: 0;
}

.insight-content code {
  background: #f3e9dc;
  color: #a84218;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--term-font);
  font-size: 12px;
}

/* TOAST NOTIFICATION */
.terminal-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1f242c;
  color: #3fb950;
  border: 2px solid #30363d;
  border-radius: 12px;
  padding: 12px 20px;
  font-family: var(--term-font);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
  z-index: 9999;
}

.terminal-toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 768px) {
  .terminal-hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .cli-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .terminal-screen {
    font-size: 11px;
    padding: 14px;
    min-height: 360px;
  }
  .prompt-prefix {
    font-size: 11px;
  }
}
