/* ============================================
   SATELLITES MODULE STYLES
   EXACT match to Activity panel (.dev-panel)
   ============================================ */

/* Panel Container - matches dev-panel exactly */
.satellite-navigator {
  position: fixed;
  bottom: 160px;
  right: var(--space-4);
  width: 360px;
  max-width: calc(100vw - var(--space-8));
  max-height: 400px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  z-index: var(--z-modal);
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 40px var(--black-40);
}

.satellite-navigator.visible {
  display: flex;
}

/* Header - matches dev-panel-header exactly */
.satellite-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--black-20);
}

.satellite-nav-title {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--accent);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.satellite-nav-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--text-2xl);
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border-radius: var(--radius-md);
}

.satellite-nav-close:hover {
  color: var(--text);
}

/* Session Status Row */
.satellite-session-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.1);
}

.session-indicator {
  font-size: 8px;
  transition: color 0.3s;
}

.session-indicator.connected {
  color: var(--success);
  animation: pulse 2s infinite;
}

.session-indicator.disconnected {
  color: var(--error);
}

.session-indicator.loading {
  color: var(--warning);
  animation: blink 1s infinite;
}

.session-key {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  opacity: 0.7;
  cursor: pointer;
  transition: opacity 0.2s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.session-key:hover {
  opacity: 1;
}

/* Satellite List - content area */
.satellite-list {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* Satellite Item — conversation row */
.satellite-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  margin: 0;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--white-05);
  position: relative;
}

.satellite-item:last-child {
  border-bottom: none;
}

.satellite-item:hover {
  background: var(--white-05);
}

.satellite-item.current {
  background: var(--accent-10, rgba(99, 102, 241, 0.12));
}

#satellitesBtn {
  position: relative;
}

#satellitesBtn.has-unread {
  overflow: visible;
}

.satellites-header-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--error);
  color: var(--text-inverse, #fff);
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--bg);
}

.satellite-item.has-unread {
  /* No background highlight — let the unread badge do the work */
}

/* Avatar */
.satellite-item-avatar-wrap {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white-05);
}

.satellite-item-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.satellite-item-avatar-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  color: var(--text-muted);
}

.satellite-item-avatar-wrap.no-avatar .satellite-item-avatar-fallback {
  display: flex;
}

/* Content area - name/time on top, preview below */
.satellite-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.satellite-item-top-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
}

.satellite-item-top-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  flex-shrink: 0;
}

.satellite-item-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.satellite-item-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.satellite-item-activity {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--accent);
  white-space: nowrap;
}

.satellite-activity-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: satelliteActivityPulse 1.4s ease-in-out infinite;
}

.satellite-item-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.satellite-item-preview {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  line-height: 1.4;
}

.satellite-preview-you {
  color: var(--accent);
  font-weight: 500;
}

.satellite-item-unread {
  flex-shrink: 0;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--text-inverse, #fff);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

.satellite-unread-dot {
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--text-inverse, #fff);
  flex-shrink: 0;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 700;
}

@keyframes satelliteActivityPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

/* Item Actions (edit, delete buttons) - overlay on hover */
.satellite-item-actions {
  display: flex;
  gap: var(--space-1);
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 2px;
  box-shadow: 0 2px 8px var(--black-20);
}

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

/* Show actions on touch devices */
@media (hover: none), (pointer: coarse) {
  .satellite-item-actions {
    opacity: 1;
    position: static;
    transform: none;
    background: none;
    box-shadow: none;
    padding: 0;
  }
}

.satellite-item-btn {
  background: none;
  border: none;
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
  color: var(--text-muted);
  touch-action: manipulation;
}

.satellite-item-btn:hover {
  background: var(--white-10);
  color: var(--text);
}

/* Bottom Actions */
.satellite-nav-actions {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
}

.satellite-nav-btn {
  width: 100%;
  padding: var(--space-2) var(--space-4);
  background: var(--accent);
  color: var(--text-inverse);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.satellite-nav-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.satellite-nav-btn:active {
  transform: translateY(0);
}

/* ============================================
   NAME PROMPT (for new satellite)
   ============================================ */

.satellite-name-prompt {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: relative;
  z-index: 10;
}

.satellite-name-input {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text);
  font-size: var(--text-base);
  margin-bottom: var(--space-2);
}

.satellite-name-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Agent selector field */
.satellite-agent-field {
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.satellite-agent-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

/* Custom dropdown */
.satellite-agent-dropdown {
  position: relative;
  flex: 1;
  min-width: 0;
}

.satellite-agent-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: border-color 0.15s;
  white-space: nowrap;
}

.satellite-agent-trigger:hover {
  border-color: var(--accent);
}

.satellite-agent-trigger:focus {
  outline: none;
  border-color: var(--accent);
}

.satellite-agent-chevron {
  flex-shrink: 0;
  transition: transform 0.15s;
  opacity: 0.6;
}

.satellite-agent-dropdown.open .satellite-agent-chevron {
  transform: rotate(180deg);
}

/* Options list */
.satellite-agent-options {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  z-index: var(--z-modal, 500);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  padding: var(--space-1) 0;
}

/* Themed scrollbar for agent list */
.satellite-agent-options::-webkit-scrollbar {
  width: 6px;
}

.satellite-agent-options::-webkit-scrollbar-track {
  background: transparent;
}

.satellite-agent-options::-webkit-scrollbar-thumb {
  background: var(--accent-30, rgba(255, 165, 0, 0.3));
  border-radius: 3px;
}

.satellite-agent-options::-webkit-scrollbar-thumb:hover {
  background: var(--accent-50, rgba(255, 165, 0, 0.5));
}

/* Firefox scrollbar */
.satellite-agent-options {
  scrollbar-width: thin;
  scrollbar-color: var(--accent-30, rgba(255, 165, 0, 0.3)) transparent;
}

.satellite-agent-dropdown.open .satellite-agent-options {
  display: block;
}

.satellite-agent-option {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
  border-radius: var(--radius-sm, 4px);
  margin: 0 var(--space-1);
  white-space: nowrap;
}

.satellite-agent-option:hover {
  background: var(--white-05, var(--hover));
}

.satellite-agent-option.selected {
  background: var(--accent-10, rgba(255, 165, 0, 0.1));
  color: var(--accent);
}

.satellite-prompt-buttons {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

.satellite-prompt-cancel,
.satellite-prompt-create {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  cursor: pointer;
  border: none;
}

.satellite-prompt-cancel {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.satellite-prompt-cancel:hover {
  background: var(--white-05);
}

.satellite-prompt-create {
  background: var(--accent);
  color: var(--text-inverse);
}

.satellite-prompt-create:hover {
  background: var(--accent-hover);
}

/* ============================================
   SWITCH OVERLAY
   ============================================ */

.satellite-switch-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--black-80);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.15s ease;
  backdrop-filter: blur(2px);
}

.satellite-switch-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
}

.satellite-switch-spinner span:first-child {
  font-size: 32px;
  animation: satellitePulse 1s ease-in-out infinite;
}

@keyframes satellitePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.7; }
}

/* Input area disabled state during switch */
.input-area.switching-satellite,
.chat-input.switching-satellite {
  pointer-events: none;
  opacity: 0.5;
  transition: opacity 0.15s ease;
}

/* ============================================
   PENDING DELETE STATE
   ============================================ */

.satellite-item.pending-delete {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: var(--error) !important;
  animation: pendingPulse 1s ease-in-out infinite;
}

.satellite-item.pending-delete .satellite-item-delete {
  background: var(--error);
  color: white;
  border-radius: var(--radius-md);
}

@keyframes pendingPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

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

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ============================================
   MOBILE (< 480px)
   ============================================ */

@media (max-width: 480px) {
  .satellite-navigator {
    bottom: 140px;
    left: var(--space-4);
    right: var(--space-4);
    width: auto;
  }
}

/* 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;
  }
}
