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

// =============================================================================
// Session Panel — main content area (session stream, task tabs, empty states)
// =============================================================================

.panelContainer {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.emptyState {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  animation: fadeIn 300ms ease;
}

.workspaceSummary {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  flex-direction: column;
  gap: var(--space-sm);
  animation: fadeIn 300ms ease;
}

.workspaceSummaryTitle {
  font-size: var(--font-size-xl);
}

.workspaceSummarySubtitle {
  font-size: var(--font-size-sm);
}

// ---------------------------------------------------------------------------
// Header bar
// ---------------------------------------------------------------------------

.header {
  @include surface-panel;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 10;

  @include mobile {
    flex-wrap: wrap;
    gap: var(--space-xs);
  }
}

.headerInfo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.killButton {
  @include btn-ghost(var(--accent-red));
  font-size: 11px;
  padding: 1px var(--space-sm);

  &:hover {
    background: var(--accent-red-dim);
  }
}

.headerTitle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  @include mobile {
    flex: 1 1 100%;
  }
}

.headerActions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.taskStatusBadge {
  background: var(--bg-overlay);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 1px var(--space-sm);
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}

.taskBranch {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.taskBlockedBadge {
  background: var(--accent-yellow-dim);
  color: var(--accent-yellow);
  border-radius: var(--radius-full);
  padding: 1px var(--space-sm);
  font-size: var(--font-size-xs);
}

.btnPrimary {
  @include btn-primary;
}

.btnDanger {
  @include btn-danger;
}

.btnGhost {
  @include btn-ghost(var(--text-secondary));
  padding: var(--space-xs) var(--space-md);
  font-size: var(--font-size-sm);
}

.rejectInput {
  @include input-field;
  width: 160px;
  font-size: var(--font-size-xs);
}

// ---------------------------------------------------------------------------
// Tab bar (Stream / Diff / Findings)
// ---------------------------------------------------------------------------

.tabBar {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);

  @include mobile {
    overflow-x: auto;
  }
}

.tab {
  padding: var(--space-xs) var(--space-md);
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast),
              background var(--transition-fast);

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

  &.active {
    color: var(--accent-green);
    border-bottom-color: var(--accent-green);
  }
}

// ---------------------------------------------------------------------------
// Content areas
// ---------------------------------------------------------------------------

.eventScroll {
  flex: 1;
  overflow: auto;
  padding: var(--space-md);
}

.tabContent {
  flex: 1;
  overflow: auto;
}

.noContext {
  padding: var(--space-xl);
  color: var(--text-tertiary);
  text-align: center;
}

// ---------------------------------------------------------------------------
// Overview tab
// ---------------------------------------------------------------------------

.overviewContent {
  flex: 1;
  overflow: auto;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

// NOTE: Full overview dashboard styles have been extracted to
// @grackle-ai/web-components TaskOverviewPanel. A minimal subset is kept
// here for TaskShimmer and other page-level consumers.

.overviewDashboard {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.overviewHero {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.overviewSection {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.overviewLabel {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.envRow {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.timelineRow {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  font-size: var(--font-size-sm);
}

.waitingMessage {
  color: var(--text-tertiary);
}

.errorMessage {
  color: var(--accent-red);
}

// NOTE: Session attempt selector styles have been extracted to
// @grackle-ai/web-components SessionAttemptSelector.

// ---------------------------------------------------------------------------
// Empty state CTAs
// ---------------------------------------------------------------------------

.emptyCta {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-xl);
  text-align: center;
  animation: fadeIn 300ms ease;
}

.ctaTitle {
  font-size: var(--font-size-lg);
  color: var(--text-secondary);
  font-weight: var(--font-weight-bold);
}

.ctaDescription {
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
  max-width: 320px;
  line-height: var(--line-height);
}

.ctaButton {
  @include btn-primary;
  padding: var(--space-sm) var(--space-xl);
  font-size: var(--font-size-md);
}

.ctaCreateForm {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.ctaCreateInput {
  @include input-field;
  font-size: var(--font-size-md);
  padding: var(--space-sm) var(--space-md);
  min-width: 200px;
}

.ctaCreateOk {
  @include btn-primary;
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--font-size-md);
}

.ctaLink {
  background: none;
  border: none;
  color: var(--accent-green);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;

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

// ---------------------------------------------------------------------------
// Workspace detail metadata
// ---------------------------------------------------------------------------

.workspaceHeader {
  @include surface-panel;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.workspaceName {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspaceMeta {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  border-bottom: 1px solid var(--border-subtle);
}

.metaRow {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  min-height: 24px;

  @include mobile {
    flex-direction: column;
    gap: var(--space-xs);
  }
}

.metaLabel {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 100px;
  flex-shrink: 0;
  padding-top: 2px;

  @include mobile {
    min-width: unset;
  }
}

.metaValue {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.archiveButton {
  @include btn-ghost(var(--accent-red));
  font-size: 11px;
  padding: 2px var(--space-sm);
  flex-shrink: 0;

  &:hover {
    background: var(--accent-red-dim);
  }
}

.repoLink {
  color: var(--accent-blue);
  text-decoration: none;
  font-size: var(--font-size-sm);

  &:hover {
    text-decoration: underline;
    color: var(--accent-cyan);
  }
}

// Collapsible metadata toggle
.metaToggle {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--space-xs) var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  width: 100%;
  transition: color var(--transition-fast);

  &:hover {
    color: var(--text-secondary);
  }
}

.metaToggleArrow {
  transition: transform var(--transition-fast);
  font-size: 10px;
}

.metaToggleArrowOpen {
  transform: rotate(90deg);
}

// Task progress bar
.progressBarContainer {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0 var(--space-md);
  margin-bottom: var(--space-xs);
}

.progressBar {
  flex: 1;
  height: 4px;
  background: var(--bg-overlay);
  border-radius: 2px;
  overflow: hidden;
}

.progressFill {
  height: 100%;
  background: var(--accent-green);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.progressLabel {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

// Timestamp row
.metaTimestamps {
  display: flex;
  gap: var(--space-md);
  font-size: 11px;
  color: var(--text-tertiary);
  padding-top: var(--space-xs);
  border-top: 1px solid var(--border-subtle);
  margin-top: var(--space-xs);

  @include mobile {
    flex-direction: column;
    gap: var(--space-xs);
  }
}

.metaTimestamp {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.metaPlaceholder {
  color: var(--text-tertiary);
  font-style: italic;
}

.linkedEnvList {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.linkedEnvChip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 1px var(--space-sm);
  border-radius: var(--radius-full);
  background: var(--bg-overlay);
  border: 1px solid var(--border-subtle);
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}

.chipDismiss {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: var(--font-size-xs);
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  border-radius: var(--radius-sm);

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

.linkError {
  color: var(--accent-red);
  font-size: var(--font-size-xs);
}

.linkEnvSelect {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  background: transparent;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 1px var(--space-sm);
  cursor: pointer;

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

