/* ── Branch Picker Overlay ──────────────────────────────────── */

/* Backdrop / full-screen overlay */
.bp-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 9000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.bp-backdrop.bp-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Sheet — slides up from bottom on mobile, centred card on desktop */
.bp-sheet {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bp-backdrop.bp-visible .bp-sheet {
  transform: translateY(0);
}

/* Desktop: centred card */
@media (min-width: 768px) {
  .bp-backdrop {
    align-items: center;
  }
  .bp-sheet {
    width: 420px;
    max-height: 70vh;
    border-radius: 16px;
    transform: translateY(20px) scale(0.97);
    padding-bottom: 0;
  }
  .bp-backdrop.bp-visible .bp-sheet {
    transform: translateY(0) scale(1);
  }
}

/* Drag handle */
.bp-handle {
  width: 36px;
  height: 4px;
  background: #30363d;
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .bp-handle { display: none; }
}

/* Header */
.bp-header {
  padding: 14px 16px 10px;
  flex-shrink: 0;
}

.bp-title {
  font-size: 17px;
  font-weight: 600;
  color: #f0f6fc;
  line-height: 1.2;
  margin-bottom: 2px;
}

.bp-subtitle {
  font-size: 12px;
  color: #8b949e;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Search box */
.bp-search-wrap {
  padding: 4px 12px 8px;
  flex-shrink: 0;
}

.bp-search-input {
  width: 100%;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
  min-height: 40px;
  font-family: inherit;
  transition: border-color 0.15s;
}

.bp-search-input::placeholder {
  color: #484f58;
}

.bp-search-input:focus {
  border-color: #4fc3f7;
}

/* Branch list */
.bp-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0;
}

/* Loading state */
.bp-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 16px;
  color: #8b949e;
  font-size: 14px;
}

.bp-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #30363d;
  border-top-color: #4fc3f7;
  border-radius: 50%;
  animation: bp-spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

/* Empty state */
.bp-empty {
  padding: 32px 16px;
  text-align: center;
  color: #8b949e;
  font-size: 14px;
}

/* Branch row */
.bp-branch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  min-height: 52px;
  cursor: pointer;
  transition: background 0.12s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  color: inherit;
  font-family: inherit;
}

.bp-branch-row:active,
.bp-branch-row:hover {
  background: #161b22;
}

/* Status indicator dot */
.bp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid #484f58;
  flex-shrink: 0;
}

.bp-dot-current {
  background: #3fb950;
  border-color: #3fb950;
}

.bp-branch-name {
  flex: 1;
  font-size: 14px;
  color: #e6edf3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
}

.bp-branch-current-label {
  font-size: 11px;
  color: #3fb950;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.bp-branch-remote-badge {
  font-size: 10px;
  color: #8b949e;
  background: rgba(139, 148, 158, 0.12);
  border: 1px solid rgba(139, 148, 158, 0.2);
  border-radius: 4px;
  padding: 1px 5px;
  flex-shrink: 0;
}

/* Divider row */
.bp-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  color: #484f58;
  font-size: 11px;
  flex-shrink: 0;
}

.bp-divider::before,
.bp-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #21262d;
}

/* Action rows (new branch, terminal) */
.bp-action-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  min-height: 52px;
  cursor: pointer;
  transition: background 0.12s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  color: inherit;
  font-family: inherit;
}

.bp-action-row:active,
.bp-action-row:hover {
  background: #161b22;
}

.bp-action-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 17px;
}

.bp-action-icon-new {
  background: rgba(79, 195, 247, 0.12);
  color: #4fc3f7;
}

.bp-action-icon-terminal {
  background: rgba(139, 148, 158, 0.1);
  color: #8b949e;
}

.bp-action-text {
  font-size: 14px;
  color: #e6edf3;
  flex: 1;
}

.bp-action-text-dim {
  color: #8b949e;
}

/* New branch inline input area */
.bp-new-branch-form {
  padding: 8px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bp-new-branch-input {
  width: 100%;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
  min-height: 42px;
  font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
  transition: border-color 0.15s;
}

.bp-new-branch-input::placeholder {
  color: #484f58;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.bp-new-branch-input:focus {
  border-color: #4fc3f7;
}

.bp-new-branch-base {
  font-size: 12px;
  color: #8b949e;
}

.bp-new-branch-base select {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #c9d1d9;
  font-size: 12px;
  padding: 3px 6px;
  outline: none;
  font-family: inherit;
}

.bp-new-branch-row {
  display: flex;
  gap: 8px;
}

.bp-btn-create {
  flex: 1;
  min-height: 44px;
  background: #1f6feb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}

.bp-btn-create:hover {
  background: #388bfd;
}

.bp-btn-create:disabled {
  background: #21262d;
  color: #484f58;
  cursor: not-allowed;
}

.bp-btn-cancel-form {
  min-height: 44px;
  padding: 0 16px;
  background: #21262d;
  color: #8b949e;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}

.bp-btn-cancel-form:hover {
  background: #30363d;
}

/* Error message */
.bp-error {
  padding: 8px 14px;
  font-size: 13px;
  color: #f85149;
  background: rgba(248, 81, 73, 0.08);
  border-radius: 6px;
  margin: 0 14px 8px;
}

/* Footer cancel button */
.bp-footer {
  padding: 8px 12px 12px;
  flex-shrink: 0;
  border-top: 1px solid #21262d;
}

.bp-btn-cancel {
  width: 100%;
  min-height: 48px;
  background: #21262d;
  color: #8b949e;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}

.bp-btn-cancel:hover {
  background: #30363d;
  color: #c9d1d9;
}

/* Branch badge on conversation rows in the dashboard */
.tree-branch-badge {
  font-size: 10px;
  font-weight: 600;
  font-family: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
  color: #4fc3f7;
  background: rgba(79, 195, 247, 0.1);
  border: 1px solid rgba(79, 195, 247, 0.25);
  border-radius: 4px;
  padding: 1px 5px;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-block;
}
