/*
  Services tab — rows reuse the .task-item / .task-header / .task-info /
  .task-actions / .task-details / .log-container pattern from the
  task list so the two surfaces look identical. The only service-only
  bits are the status dot inside the status pill, the port chips, and
  a streaming-state hint on the log container.
*/

.services-section {
  padding: 0;
}

/* Mirrors .config-title for visual parity across tabs. */
.services-title {
  padding: 20px;
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0;
}

.services-title h3 {
  margin: 0 0 8px 0;
  color: var(--text-primary, #fff);
  font-size: 18px;
  font-weight: 600;
}

.services-title p {
  margin: 0;
  color: var(--text-secondary, #ccc);
  font-size: 13px;
}

.services-list {
  display: flex;
  flex-direction: column;
}

/* Recessed dark panel wrapping the service rows — mirrors the
   .tasks-container the Tasks tab uses on the app detail page so the
   two tabs share one visual idiom. rgba(bg, 0.2) reads as a sunken
   pocket inside the tab-pane's glass surface. */
.services-rows {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 16px;
  margin: 16px;
  background: rgba(var(--bg-rgb), 0.2);
  border-radius: 8px;
}

/* ------------------------------------------------------------------ */
/* Loading + empty + error states                                     */
/* ------------------------------------------------------------------ */
.services-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 2rem;
  color: var(--text-secondary, var(--text-muted));
}

.services-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(var(--text-rgb), 0.15);
  border-top-color: var(--accent-color, var(--accent));
  border-radius: 50%;
  animation: services-spin 0.7s linear infinite;
}

@keyframes services-spin { to { transform: rotate(360deg); } }

.services-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-secondary, var(--text-muted));
}

.services-empty-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.services-empty p {
  margin: 0.25rem 0;
}

.services-empty-hint {
  font-size: 0.85rem;
  opacity: 0.75;
}

/* ------------------------------------------------------------------ */
/* Status dot inside the .task-status pill                            */
/* ------------------------------------------------------------------ */
.service-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  background: var(--text-muted);
}

@keyframes service-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

/* ------------------------------------------------------------------ */
/* Port + IP chips inside .task-info (alongside status / time)        */
/* ------------------------------------------------------------------ */
.service-port {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  color: var(--text-secondary);
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

.service-port-arrow {
  opacity: 0.5;
  margin: 0 1px;
}

.service-port-proto {
  margin-left: 4px;
  font-size: 0.65rem;
  opacity: 0.6;
  text-transform: uppercase;
}

.service-ip {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(var(--text-rgb), 0.05);
  border: 1px solid rgba(var(--text-rgb), 0.08);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.72rem;
  color: var(--text-secondary, var(--text-muted));
}

/* The Open button — flagged with .open on top of .task-btn so the
   shared task-row hover styles still apply but a slightly different
   accent makes it distinguishable from Restart. */
.task-btn.open {
  color: var(--text-secondary);
}
.task-btn.open:hover {
  background: rgba(var(--accent-rgb), 0.15);
}

.service-app-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

/* ------------------------------------------------------------------ */
/* Streaming state hint on the log container                          */
/* ------------------------------------------------------------------ */
.service-log-output[data-stream="connecting"]::before {
  content: 'Connecting…';
  color: var(--status-warning);
  display: block;
  margin-bottom: 0.25rem;
}

.service-log-output[data-stream="disconnected"]::before {
  content: '⚠ disconnected — retrying…';
  color: var(--status-warning);
  display: block;
  margin-bottom: 0.25rem;
}

.service-log-output[data-stream="closed"]::after {
  content: '— stream closed —';
  color: var(--text-muted);
  display: block;
  margin-top: 0.25rem;
}

/* Spinner-on-restart while the request is in flight, mirroring the
   subtle “task is doing something” visual cue used by the task list. */
.task-btn.is-running {
  opacity: 0.6;
  cursor: wait;
}
