/* ============================================
   CONNECTION STATUS STYLES
   ============================================ */

.status-dot {
  width: var(--space-2);
  height: var(--space-2);
  border-radius: var(--radius-full);
  display: inline-block;
  margin-right: var(--space-2);
  transition: all 0.3s;
  background: var(--neutral);  /* Default: neutral gray until JS sets state */
}

.status-dot.connected {
  background: var(--success);
  box-shadow: 0 0 var(--space-2) var(--success);
}

.status-dot.disconnected {
  background: var(--warning);
  animation: pulse-yellow 2s infinite;
}

.status-dot.connecting,
.status-dot.reconnecting {
  background: var(--info);
  animation: pulse-blue 1s infinite;
}

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

.status-dot.error,
.status-dot.failed {
  background: var(--error);
  box-shadow: 0 0 var(--space-2) var(--error);
}

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

@keyframes pulse-blue {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* Status text */
#status {
  cursor: pointer;
  user-select: none;
}

#status:hover {
  opacity: 0.8;
}

/* Connection mode badge */
.connection-mode-badge {
  font-size: var(--text-xs);
  opacity: 0.7;
}

.connection-mode-badge .mode-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  display: inline-block;
  margin-right: var(--space-1);
}

.connection-mode-badge.direct .mode-dot {
  background: var(--success);
}

.connection-mode-badge.proxied .mode-dot {
  background: var(--info);
}

/* ============================================
   CONTEXT TRACKER
   ============================================ */

.context-badge {
  display: none; /* Hidden until data arrives */
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  cursor: default;
  user-select: none;
  padding: 2px 0;
}

.context-bar {
  width: 60px;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  flex-shrink: 0;
}

.context-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--success);
  transition: width 0.6s ease, background 0.6s ease;
  min-width: 1px;
}

.context-text {
  white-space: nowrap;
  opacity: 0.8;
}

/* ==========================================================================
   Chat Header Controls — shared between primary and secondary panes
   Layout: per-pane model selector + tool indicator + context bar
   ========================================================================== */

.chat-header-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3, 12px);
  margin-left: auto;  /* pushes right in header */
  flex-shrink: 0;
}

/* Model Selector Dropdown */
.model-selector {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: var(--radius-md, 6px);
  color: var(--text-muted, #999);
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  padding: 3px 22px 3px 8px;
  cursor: pointer;
  outline: none;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease;
  /* Custom chevron */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 10px;
}

.model-selector:hover {
  border-color: var(--accent, #007bff);
  color: var(--text, #fff);
}

.model-selector:focus-visible {
  border-color: var(--accent, #007bff);
  box-shadow: 0 0 0 2px var(--accent-20, rgba(0, 123, 255, 0.25));
}

.model-selector option {
  background: var(--bg, #1a1a1a);
  color: var(--text, #fff);
}

/* Tool Indicator */
.tool-indicator {
  display: none; /* shown via JS */
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--accent, #007bff);
  white-space: nowrap;
  animation: tool-indicator-fade-in 0.2s ease;
}

.tool-indicator-icon {
  flex-shrink: 0;
  color: var(--accent, #007bff);
  animation: tool-indicator-pulse 1.5s ease-in-out infinite;
}

.tool-indicator-name {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes tool-indicator-fade-in {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: translateX(0); }
}

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

/* Accessibility: Respect reduced motion preference (M-09) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
