/* Review tab + file tree + default base branch picker styles.
   Extracted from the main agent-manager stylesheet to keep files under 3000 lines. */

/* Review tab in tab bar */

.am-tab-review {
  display: flex;
  align-items: center;
  gap: 4px;
  border-left: 1px solid var(--border-weak-base);
}

.am-tab-review [data-component="icon"] {
  flex-shrink: 0;
  opacity: 0.7;
}

/* Full-screen review tab layout */

.am-review-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
  --am-diff-count-size: 12px;
}

/* Review toolbar */

.am-review-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 4px 8px;
  flex-shrink: 0;
  min-width: 0;
  border-bottom: 1px solid var(--border-weak-base);
  background: var(--surface-base);
  gap: 8px;
}

.am-review-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.am-review-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.am-review-toolbar-right > * {
  flex-shrink: 0;
}

.am-review-toolbar [data-component="radio-group"],
.am-review-toolbar [data-component="radio-group"] [data-slot="radio-group-item-label"],
.am-review-toolbar [data-component="radio-group"] [data-slot="radio-group-item-control"] {
  cursor: pointer;
}

.am-review-toolbar
  [data-component="radio-group"]
  [data-slot="radio-group-item-label"]:active
  [data-slot="radio-group-item-control"] {
  transform: translateY(1px);
}

.am-review-toolbar-stats {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  gap: 8px;
  font-size: var(--font-size-small);
  color: var(--text-weak);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.am-review-toolbar-adds {
  color: var(--syntax-diff-add, #318430);
  font-weight: 500;
}

.am-review-toolbar-dels {
  color: var(--syntax-diff-delete, #da3319);
  font-weight: 500;
}

/* Review body: file tree + diff viewer */

.am-review-body {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.am-review-host {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.am-review-tree-resize {
  position: relative;
  display: flex;
  flex-shrink: 0;
  min-width: 0;
}

.am-review-tree-wrapper {
  flex: 1;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid var(--border-weak-base);
}

.am-review-tree-resize > [data-component="resize-handle"]::after {
  background: var(--surface-interactive-base);
}

.am-review-diff {
  flex: 1;
  width: 0;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.am-review-diff-content[data-component="session-review"] {
  height: auto;
  contain: none;
  scrollbar-width: auto;
  width: 100%;
  min-width: 0;
}

.am-review-diff-content[data-component="session-review"] [data-component="sticky-accordion-header"] {
  --sticky-accordion-top: 0px;
}

/* Ensure the diff container fills the available width.
   pierre's diffs-container needs explicit width for split mode. */
.am-review-diff diffs-container,
.am-review-diff [data-component="diff"] {
  width: 100%;
  display: block;
}

/* Tighter diff line height in review mode */
.am-review-layout {
  --diffs-line-height: var(--kilo-font-size-20);
}

/* ─── File tree (GitHub-style) ─── */

.am-file-tree {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  font-size: var(--kilo-font-size-13);
  font-family: var(--font-family-sans, -apple-system, BlinkMacSystemFont, sans-serif);
}

.am-file-tree-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 6px;
}

.am-file-tree-group {
  display: flex;
  flex-direction: column;
}

/* Shared row base for files and directories */
.am-file-tree-dir,
.am-file-tree-file {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 8px;
  border: none;
  background: none;
  color: var(--text-base);
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  text-align: left;
  white-space: nowrap;
  border-radius: 5px;
  position: relative;
}

.am-file-tree-dir:hover,
.am-file-tree-file:hover {
  background: var(--surface-inset-base-hover, rgba(128, 128, 128, 0.1));
}

/* Directory-specific: slightly muted text */
.am-file-tree-dir {
  color: var(--text-weak);
}

/* Shrink icons to 16px */
.am-file-tree [data-component="file-icon"],
.am-file-tree [data-component="icon"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Directory chevron + folder icon color */
.am-file-tree-dir [data-component="icon"] {
  flex-shrink: 0;
  color: var(--text-weaker);
}

.am-file-tree-dir-highlight > [data-component="icon"]:last-of-type {
  color: var(--surface-interactive-strong);
}

/* Active file — subtle background + left accent bar */
.am-file-tree-active {
  background: var(--surface-base-active, rgba(128, 128, 128, 0.15));
}

.am-file-tree-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 3px;
  background: var(--surface-interactive-strong, var(--vscode-focusBorder, #007fd4));
}

.am-file-tree-active:hover {
  background: var(--surface-base-active, rgba(128, 128, 128, 0.15));
}

.am-file-tree-name {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

/* Color the name for added / deleted files */
.am-file-tree-status-added .am-file-tree-name {
  color: var(--syntax-diff-add, #318430);
}

.am-file-tree-status-deleted .am-file-tree-name {
  color: var(--syntax-diff-delete, #da3319);
}

.am-file-tree-status-modified .am-file-tree-name {
  color: var(--text-base);
}

.am-file-tree-check {
  width: 14px;
  height: 14px;
  border: 1px solid var(--border-weak-base);
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: transparent;
  background: var(--surface-base);
}

.am-file-tree-check-on {
  border-color: var(--surface-interactive-strong);
  background: color-mix(in oklab, var(--surface-interactive-strong) 18%, var(--surface-base));
  color: var(--surface-interactive-strong);
}

.am-file-tree-check [data-component="icon"] {
  width: 10px;
  height: 10px;
}

.am-file-tree-selected {
  background: color-mix(in oklab, var(--surface-base-active, rgba(128, 128, 128, 0.15)) 72%, transparent);
}

/* Compact +N -N stats pushed to the right */
.am-file-tree-changes {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
  font-size: var(--am-diff-count-size);
  font-family: var(--vscode-editor-font-family, monospace);
  line-height: 1;
  color: var(--text-weaker);
}

.am-file-tree-stat-add {
  color: var(--syntax-diff-add, #318430);
}

.am-file-tree-stat-del {
  color: var(--syntax-diff-delete, #da3319);
}

/* Status badges for added / deleted files */
.am-file-tree-badge-added {
  font-size: var(--am-diff-count-size);
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background: color-mix(in lab, var(--syntax-diff-add, #318430) 15%, transparent);
  color: var(--syntax-diff-add, #318430);
}

.am-file-tree-comment-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--surface-interactive-strong);
  color: var(--text-on-fill);
  font-size: var(--kilo-font-size-10);
  font-weight: 600;
  line-height: 1;
  margin-left: 6px;
  flex-shrink: 0;
}

.am-file-tree-badge-deleted {
  font-size: var(--am-diff-count-size);
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background: color-mix(in lab, var(--syntax-diff-delete, #da3319) 15%, transparent);
  color: var(--syntax-diff-delete, #da3319);
}

/* File tree revert button — always visible */

.am-file-tree-file-content {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  color: inherit;
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
  white-space: nowrap;
}

.am-file-tree-revert-btn {
  flex-shrink: 0;
  color: var(--text-weaker);
}

.am-file-tree-revert-btn:not(:disabled):hover {
  color: var(--syntax-diff-delete, #da3319);
}

/* Diff header revert button — always visible */

.am-diff-revert-btn {
  color: var(--text-weaker);
}

.am-diff-revert-btn:not(:disabled):hover {
  color: var(--syntax-diff-delete, #da3319);
}

/* File tree summary footer */

.am-file-tree-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid var(--border-weak-base);
  font-size: var(--kilo-font-size-11);
  color: var(--text-weaker);
  flex-shrink: 0;
}

.am-file-tree-summary-adds {
  color: var(--syntax-diff-add, #318430);
}

.am-file-tree-summary-dels {
  color: var(--syntax-diff-delete, #da3319);
}

/* ============ Default base branch picker dialog ============ */

.am-default-base-branch {
  min-width: 360px;
}

.am-default-base-branch .am-dropdown-list {
  max-height: 320px;
}

.am-branch-hint {
  margin-left: auto;
  color: var(--text-weaker);
  font-size: var(--kilo-font-size-11);
}
