/* ── Command Center Styles ─────────────────────────────────────── */

:root {
  --cc-bg: #050b14;
  --cc-surface: #0d1520;
  --cc-surface-hover: #141e2d;
  --cc-border: #1e2a3a;
  --cc-text: #e0e6ed;
  --cc-text-muted: #6b7a8d;
  --cc-accent: #6366f1;
  --cc-accent-hover: #818cf8;
  --cc-green: #4ade80;
  --cc-orange: #fb923c;
  --cc-red: #f87171;
  --cc-blue: #60a5fa;
  --cc-user-bg: #1a1f36;
  --cc-assistant-bg: #0d1520;
  --cc-sidebar-w: 280px;
  --cc-radius: 8px;
  --cc-font: 'DM Mono', 'Consolas', monospace;
  --cc-font-display: 'Syne', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--cc-font);
  background: var(--cc-bg);
  color: var(--cc-text);
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}

/* ── Layout ──────────────────────────────────────────────────── */

.cc-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.cc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid var(--cc-border);
  background: var(--cc-surface);
  flex-shrink: 0;
}

.cc-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cc-header-left h1 {
  font-family: var(--cc-font-display);
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, #6366f1, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.cc-header-left .subtitle {
  font-size: 11px;
  color: var(--cc-text-muted);
}

.cc-nav {
  display: flex;
  gap: 8px;
}

.cc-nav a {
  padding: 5px 14px;
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  color: var(--cc-text);
  text-decoration: none;
  font-size: 12px;
  transition: all 0.15s;
}

.cc-nav a:hover { border-color: var(--cc-accent); color: var(--cc-accent); }
.cc-nav a.active { background: var(--cc-accent); border-color: var(--cc-accent); color: white; }

.cc-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────── */

.cc-sidebar {
  width: var(--cc-sidebar-w);
  border-right: 1px solid var(--cc-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
  background: var(--cc-surface);
}

.cc-sidebar-section {
  padding: 12px;
  border-bottom: 1px solid var(--cc-border);
}

.cc-sidebar-section h3 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--cc-text-muted);
  margin-bottom: 8px;
}

.cc-account-select {
  width: 100%;
  background: var(--cc-bg);
  border: 1px solid var(--cc-border);
  color: var(--cc-text);
  padding: 6px 8px;
  border-radius: var(--cc-radius);
  font-family: var(--cc-font);
  font-size: 12px;
}

.cc-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.cc-status-dot.connected { background: var(--cc-green); }
.cc-status-dot.disconnected { background: var(--cc-red); }

.cc-ticket-list {
  list-style: none;
  max-height: 300px;
  overflow-y: auto;
}

.cc-ticket {
  padding: 8px;
  border-radius: var(--cc-radius);
  cursor: pointer;
  font-size: 11px;
  transition: background 0.15s;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.cc-ticket:hover { background: var(--cc-surface-hover); }
.cc-ticket.selected { background: var(--cc-accent); color: white; }

.cc-ticket-priority {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}

.cc-ticket-priority.urgent { background: var(--cc-red); }
.cc-ticket-priority.high { background: var(--cc-orange); }
.cc-ticket-priority.medium { background: var(--cc-blue); }
.cc-ticket-priority.low { background: var(--cc-green); }

.cc-new-chat-btn {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px dashed var(--cc-border);
  color: var(--cc-text-muted);
  border-radius: var(--cc-radius);
  cursor: pointer;
  font-family: var(--cc-font);
  font-size: 12px;
  transition: all 0.15s;
}

.cc-new-chat-btn:hover {
  border-color: var(--cc-accent);
  color: var(--cc-accent);
}

/* ── Main Chat Area ──────────────────────────────────────────── */

.cc-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cc-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--cc-text-muted);
  text-align: center;
  gap: 12px;
}

.cc-welcome h2 {
  font-family: var(--cc-font-display);
  font-size: 22px;
  color: var(--cc-text);
}

.cc-welcome p { font-size: 13px; max-width: 480px; }

.cc-welcome-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.cc-welcome-action {
  padding: 10px 16px;
  background: var(--cc-surface);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  color: var(--cc-text);
  cursor: pointer;
  font-family: var(--cc-font);
  font-size: 12px;
  transition: all 0.15s;
}

.cc-welcome-action:hover {
  border-color: var(--cc-accent);
  background: var(--cc-surface-hover);
}

/* ── Messages ────────────────────────────────────────────────── */

.cc-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--cc-radius);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.cc-msg.user {
  align-self: flex-end;
  background: var(--cc-user-bg);
  border: 1px solid var(--cc-border);
}

.cc-msg.assistant {
  align-self: flex-start;
  background: var(--cc-assistant-bg);
  border: 1px solid var(--cc-border);
}

.cc-msg.assistant code {
  background: rgba(99, 102, 241, 0.15);
  padding: 1px 4px;
  border-radius: 3px;
}

/* ── Questions Card ──────────────────────────────────────────── */

.cc-questions-card {
  background: var(--cc-surface);
  border: 1px solid var(--cc-accent);
  border-radius: var(--cc-radius);
  padding: 16px;
  max-width: 85%;
  align-self: flex-start;
}

.cc-questions-card h4 {
  font-size: 12px;
  color: var(--cc-accent);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cc-question-item {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: flex-start;
}

.cc-question-item .num {
  color: var(--cc-accent);
  font-weight: bold;
  flex-shrink: 0;
}

.cc-question-input {
  width: 100%;
  background: var(--cc-bg);
  border: 1px solid var(--cc-border);
  color: var(--cc-text);
  padding: 6px 8px;
  border-radius: var(--cc-radius);
  font-family: var(--cc-font);
  font-size: 12px;
  margin-top: 4px;
}

.cc-questions-submit {
  margin-top: 10px;
  padding: 6px 16px;
  background: var(--cc-accent);
  color: white;
  border: none;
  border-radius: var(--cc-radius);
  cursor: pointer;
  font-family: var(--cc-font);
  font-size: 12px;
}

/* ── Plan Card ───────────────────────────────────────────────── */

.cc-plan-card {
  background: var(--cc-surface);
  border: 1px solid var(--cc-green);
  border-radius: var(--cc-radius);
  padding: 16px;
  max-width: 90%;
  align-self: flex-start;
}

.cc-plan-card h4 {
  font-size: 12px;
  color: var(--cc-green);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cc-plan-summary {
  margin-bottom: 12px;
  font-size: 13px;
}

.cc-plan-changes {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  margin-bottom: 12px;
}

.cc-plan-change {
  padding: 6px 10px;
  border-bottom: 1px solid var(--cc-border);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cc-plan-change:last-child { border-bottom: none; }

.cc-change-badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  flex-shrink: 0;
}

.cc-change-badge.create { background: rgba(74, 222, 128, 0.2); color: var(--cc-green); }
.cc-change-badge.pause { background: rgba(251, 146, 60, 0.2); color: var(--cc-orange); }
.cc-change-badge.enable { background: rgba(96, 165, 250, 0.2); color: var(--cc-blue); }
.cc-change-badge.budget { background: rgba(99, 102, 241, 0.2); color: var(--cc-accent); }
.cc-change-badge.negative { background: rgba(248, 113, 113, 0.2); color: var(--cc-red); }
.cc-change-badge.keyword { background: rgba(52, 211, 153, 0.2); color: #34d399; }

.cc-plan-actions {
  display: flex;
  gap: 8px;
}

.cc-btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--cc-radius);
  cursor: pointer;
  font-family: var(--cc-font);
  font-size: 12px;
  font-weight: bold;
  transition: all 0.15s;
}

.cc-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.cc-btn-primary { background: var(--cc-green); color: #050b14; }
.cc-btn-primary:hover:not(:disabled) { background: #22c55e; }
.cc-btn-secondary { background: var(--cc-accent); color: white; }
.cc-btn-secondary:hover:not(:disabled) { background: var(--cc-accent-hover); }
.cc-btn-outline { background: transparent; border: 1px solid var(--cc-border); color: var(--cc-text); }
.cc-btn-outline:hover:not(:disabled) { border-color: var(--cc-accent); }

/* ── Results Card ────────────────────────────────────────────── */

.cc-results-card {
  background: var(--cc-surface);
  border: 1px solid var(--cc-border);
  border-radius: var(--cc-radius);
  padding: 16px;
  max-width: 90%;
  align-self: flex-start;
}

.cc-result-item {
  padding: 4px 0;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cc-result-item.success { color: var(--cc-green); }
.cc-result-item.fail { color: var(--cc-red); }

/* ── Input Bar ───────────────────────────────────────────────── */

.cc-input-bar {
  padding: 12px 24px;
  border-top: 1px solid var(--cc-border);
  background: var(--cc-surface);
  flex-shrink: 0;
}

.cc-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.cc-input {
  flex: 1;
  background: var(--cc-bg);
  border: 1px solid var(--cc-border);
  color: var(--cc-text);
  padding: 10px 12px;
  border-radius: var(--cc-radius);
  font-family: var(--cc-font);
  font-size: 13px;
  resize: none;
  min-height: 42px;
  max-height: 120px;
  line-height: 1.4;
}

.cc-input:focus { outline: none; border-color: var(--cc-accent); }

.cc-send-btn {
  padding: 10px 20px;
  background: var(--cc-accent);
  color: white;
  border: none;
  border-radius: var(--cc-radius);
  cursor: pointer;
  font-family: var(--cc-font);
  font-size: 13px;
  font-weight: bold;
  transition: background 0.15s;
  white-space: nowrap;
}

.cc-send-btn:hover:not(:disabled) { background: var(--cc-accent-hover); }
.cc-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.cc-input-hint {
  font-size: 10px;
  color: var(--cc-text-muted);
  margin-top: 4px;
}

/* ── Loading ─────────────────────────────────────────────────── */

.cc-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  color: var(--cc-text-muted);
  font-size: 12px;
  align-self: flex-start;
}

.cc-loading-dots span {
  animation: dotPulse 1.4s infinite ease-in-out both;
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--cc-accent);
  border-radius: 50%;
  margin: 0 2px;
}

.cc-loading-dots span:nth-child(1) { animation-delay: 0s; }
.cc-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.cc-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 80%, 100% { transform: scale(0.4); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ── Scrollbar ───────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--cc-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--cc-text-muted); }
