@use '../../styles/mixins' as *;

// =============================================================================
// SessionPicker -- modal dialog for selecting a forward-to session
// =============================================================================

.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay-bg, rgba(0, 0, 0, 0.55));
}

.dialog {
  @include surface-card;
  width: min(480px, calc(100vw - var(--space-xl)));
  max-height: min(480px, calc(100vh - var(--space-xl)));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-md) var(--space-sm);
  flex-shrink: 0;
}

.title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  margin: 0;
}

.closeButton {
  @include btn-ghost(var(--text-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: var(--radius-sm);
  flex-shrink: 0;

  &:hover {
    color: var(--text-primary);
    background: var(--bg-overlay);
  }
}

.filterRow {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0 var(--space-md) var(--space-sm);
  flex-shrink: 0;
}

.searchIcon {
  color: var(--text-secondary);
  flex-shrink: 0;
}

.filterInput {
  flex: 1;
  background: var(--bg-overlay);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  padding: var(--space-xs) var(--space-sm);
  outline: none;

  &::placeholder {
    color: var(--text-muted);
  }

  &:focus {
    border-color: var(--accent-blue);
  }
}

.list {
  list-style: none;
  margin: 0;
  padding: 0 var(--space-sm) var(--space-sm);
  overflow-y: auto;
  flex: 1;
}

.emptyItem {
  padding: var(--space-md);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  text-align: center;
}

.sessionRow {
  @include btn-ghost(var(--text-primary));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-xs);
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  text-align: left;

  &:hover {
    background: var(--bg-overlay);
  }
}

.sessionMain {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
}

.envName {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.personaName {
  font-size: 11px;
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1px var(--space-xs);
  flex-shrink: 0;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statusBadge {
  font-size: 11px;
  font-weight: var(--font-weight-medium);
  padding: 1px var(--space-xs);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;

  &.status_running {
    background: color-mix(in srgb, var(--accent-green) 20%, transparent);
    color: var(--accent-green);
  }

  &.status_idle {
    background: color-mix(in srgb, var(--accent-blue) 20%, transparent);
    color: var(--accent-blue);
  }

  &.status_other {
    background: var(--bg-overlay);
    color: var(--text-secondary);
  }
}

.sessionPrompt {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.noSessions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-xl);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);

  p {
    margin: 0;
  }
}
