/* Copyright (c) 2025-2026 Ioannis Belesiotis. All rights reserved.
   This source code is proprietary and confidential. */
/* ── Unified Jira Pull Picker (ADR-031) ──────────────────────────────────── */

.jp-modal { position: fixed; inset: 0; z-index: 1050; display: flex; align-items: center; justify-content: center; }
.jp-backdrop { position: absolute; inset: 0; background: rgba(30,34,60,0.50); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.jp-dialog { position: relative; z-index: 1; background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; }
.jp-dialog-selector { width: 540px; max-height: 80vh; }
.jp-dialog-picker { width: calc(100vw - 32px); height: calc(100vh - 32px); }

/* Header */
.jp-header { position: relative; padding: 16px 20px 12px; border-bottom: 1px solid var(--color-border); flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; }
.jp-title-group { display: flex; align-items: center; gap: 8px; }
.jp-title { font-size: var(--font-lg); font-weight: var(--font-weight-semibold); margin: 0; }
.jp-close { position: absolute; right: 16px; top: 16px; }
.jp-done-info { font-size: var(--font-xs); color: var(--color-text-muted); margin-left: 12px; }
.jp-header-summary { font-size: 11px; color: var(--color-text-muted); font-weight: 400; margin-left: 16px; }
.jp-sum-num { font-weight: 600; color: var(--color-text); }
.jp-sum-ok { font-weight: 600; color: var(--color-success); }
.jp-sum-attention { font-weight: 600; color: var(--color-accent); }
.jp-sum-held      { font-weight: 600; color: #d97706; }

/* Held-back notice — tasks the pull skipped because they carry unpushed local
   edits. Amber rather than red: nothing is broken, but the planner is about to
   push over a value Jira has already moved. */
.jp-heldback {
  margin: 0 16px 10px;
  padding: 10px 12px;
  border: 1px solid rgba(251,191,36,0.45);
  border-radius: 6px;
  background: rgba(251,191,36,0.07);
  font-size: var(--font-xs, 0.78rem);
  color: var(--color-text);
}
.jp-heldback-title { font-weight: 600; margin-bottom: 6px; }
.jp-heldback-list  { margin: 0 0 6px; padding-left: 16px; list-style: disc; }
.jp-heldback-list li {
  /* catalyst.css styles bare li as a fixed-height bordered calendar row. */
  height: auto; display: list-item; background: none; border: none; padding: 1px 0;
}
.jp-heldback-list li:hover { background: none; box-shadow: none; }
.jp-held-conflict  { color: #b45309; }
.jp-heldback-hint  { color: var(--color-text-muted); font-style: italic; }
.jp-sum-warn { font-weight: 600; color: var(--color-warning); }

/* Project selector */
.jp-selector-body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.jp-selector-hint { font-size: var(--font-sm); color: var(--color-text-muted); margin: 0 0 16px; }
.jp-project-list { display: flex; flex-direction: column; gap: 4px; }
.jp-project-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-md); cursor: pointer; transition: background 0.15s; }
.jp-project-row:hover { background: var(--color-surface-alt); }
.jp-project-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.jp-project-name { font-weight: var(--font-weight-semibold); font-size: var(--font-sm); }
.jp-project-meta { font-size: var(--font-xs); color: var(--color-text-muted); margin-left: auto; }

/* Footer */
.jp-footer { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--color-border); flex-shrink: 0; }
.jp-footer span:nth-child(2) { flex: 1; }
.jp-select-all { display: flex; align-items: center; gap: 6px; font-size: var(--font-sm); color: var(--color-text-muted); cursor: pointer; }

/* Toolbar */
.jp-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 8px 20px; border-bottom: 1px solid var(--color-border); flex-shrink: 0; }
.jp-tabs { display: flex; gap: 4px; }
.jp-tab { padding: 6px 14px; border-radius: var(--radius-md); font-size: var(--font-sm); font-weight: var(--font-weight-medium); background: none; border: 1px solid transparent; cursor: pointer; color: var(--color-text-muted); transition: all 0.15s; }
.jp-tab.active { background: var(--color-accent-subtle); color: var(--color-accent); border-color: var(--color-accent); font-weight: var(--font-weight-semibold); }
.jp-tab:hover:not(.active) { background: var(--color-surface-alt); }
.jp-toolbar-right { display: flex; align-items: center; gap: 8px; }
.jp-group-label-small { font-size: var(--font-xs); color: var(--color-text-muted); }
.jp-priority-legend { display: flex; align-items: center; gap: 4px; margin-right: 12px; border-right: 1px solid var(--color-border); padding-right: 12px; }
.jp-pri-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.jp-pri-label { font-size: 10px; color: var(--color-text-muted); margin-right: 6px; }
.jp-group-select { font-size: var(--font-xs); padding: 3px 6px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-text); }

/* Filter bar (chips left, search center, group toggle right) */
.jp-filter-bar { display: flex; align-items: center; gap: 8px; padding: 8px 20px; flex-shrink: 0; }
.jp-filter-chips-left { display: flex; gap: 6px; flex-shrink: 0; }
.jp-filter-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.jp-chip { padding: 4px 10px; border-radius: var(--radius-full); font-size: 11px; font-weight: 500; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-muted); cursor: pointer; transition: all 0.15s; }
.jp-chip.active { background: var(--color-accent-subtle); color: var(--color-accent); border-color: var(--color-accent); }
.jp-chip:hover:not(.active) { border-color: var(--color-accent); }

/* Scheduling bar */
.jp-scheduling-bar { display: flex; align-items: center; gap: 10px; padding: 8px 20px; background: var(--color-surface-alt); border-bottom: 1px solid var(--color-border); flex-shrink: 0; font-size: var(--font-xs); }
.jp-sched-label { color: var(--color-text-muted); }
.jp-sched-select { font-size: var(--font-xs); padding: 3px 6px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-text); }
.jp-sched-input { width: 40px; font-size: var(--font-xs); padding: 2px 4px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); text-align: center; }

/* Search — inline in filter bar */
.jp-search-bar { flex: 1; min-width: 0; }
.jp-search { width: 100%; padding: 4px 10px; border: 1px solid var(--color-border); border-radius: var(--radius-md); font-size: var(--font-sm); background: var(--color-surface); color: var(--color-text); }
.jp-search::placeholder { color: var(--color-text-muted); }

/* Column header row — per group, same grid as jp-row-main */
.jp-group-col-header { display: grid; grid-template-columns: 24px 30px 40px 80px 1fr 110px 100px auto; gap: 8px; align-items: center; padding: 4px 4px 4px 4px; border-bottom: 1px solid var(--color-border); margin-bottom: 2px; }
.jp-group-col-header span { font-size: 9px; font-weight: 600; color: var(--color-text-muted); letter-spacing: 0.5px; text-transform: uppercase; white-space: nowrap; }
.jp-col-sortable { cursor: pointer; -webkit-user-select: none; user-select: none; }
.jp-col-sortable:hover { color: var(--color-text); }
.jp-col-sorted { color: var(--color-accent); }

/* Issue list */
.jp-issue-list { flex: 1; overflow-y: auto; padding: 0 20px 16px; min-height: 0; }

/* Group */
.jp-group { margin-top: 8px; }
.jp-group-header { display: flex; align-items: center; gap: 6px; padding: 6px 0; cursor: pointer; -webkit-user-select: none; user-select: none; }
.jp-group-label { font-size: var(--font-sm); font-weight: var(--font-weight-semibold); }
.jp-group-count { font-size: var(--font-xs); color: var(--color-text-muted); background: var(--color-surface-alt); padding: 1px 6px; border-radius: var(--radius-full); }
.jp-group-body.collapsed { display: none; }

/* Epic sub-groups within project/status groups */
.jp-epic-sub { border-top: 1px solid var(--color-border); }
.jp-epic-sub:first-child { border-top: none; }
.jp-epic-header {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px 4px 28px;
  background: var(--color-surface);
  font-size: 12px; color: var(--color-text-muted);
}
.jp-epic-label { font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.jp-chevron { width: 14px; height: 14px; transition: transform 0.2s; flex-shrink: 0; }
.jp-chevron.collapsed { transform: rotate(-90deg); }

/* Issue row */
.jp-row { padding: 8px 4px; border-bottom: 1px solid var(--color-border); font-size: var(--font-sm); }
.jp-row:last-child { border-bottom: none; }
.jp-row-main { display: grid; grid-template-columns: 24px 30px 40px 80px 1fr 110px 100px auto; gap: 8px; align-items: center; }
.jp-badges { display: flex; gap: 4px; justify-content: flex-end; }
.jp-row-conflict { background: rgba(251,191,36,0.06); }
.jp-row-state-change { background: rgba(91,115,245,0.04); }
.jp-checkbox { display: flex; align-items: center; }
.jp-priority-dot { width: 8px; height: 8px; border-radius: 50%; }
.jp-type-icon { width: 14px; height: 14px; flex-shrink: 0; margin-top: 3px; }
.jp-key { font-weight: var(--font-weight-semibold); color: var(--color-accent); text-decoration: none; white-space: nowrap; }
.jp-key:hover { text-decoration: underline; }
.jp-issue-summary { flex: 1; min-width: 0; color: var(--color-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jp-assignee { font-size: var(--font-xs); color: var(--color-text-muted); white-space: nowrap; }
.jp-status { font-size: 10px; color: var(--color-text-muted); background: var(--color-surface-alt); padding: 1px 6px; border-radius: var(--radius-sm); white-space: nowrap; }
.jp-badges { display: flex; gap: 4px; flex-shrink: 0; }

/* Badges */
.jp-badge { font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: var(--radius-sm); white-space: nowrap; }
.jp-badge-new { background: rgba(16,185,129,0.1); color: #10b981; }
.jp-badge-updated { background: rgba(91,115,245,0.1); color: var(--color-accent); }
.jp-badge-conflict { background: rgba(251,191,36,0.15); color: #d97706; }
.jp-badge-state { background: rgba(139,92,246,0.1); color: #8b5cf6; }
.jp-badge-on-calendar { background: var(--color-surface-alt); color: var(--color-text-muted); }

/* Action line — per row, shown only when row is selected */
.jp-action { display: none; font-size: var(--font-xs); color: var(--color-accent); padding: 3px 0 2px 206px; }
.jp-row-selected .jp-action { display: block; }
.jp-action-unresolved { font-size: var(--font-xs); color: var(--color-warning); padding: 2px 0 2px 206px; }
/* Scheduling-signal pill on new calendar-bound issues (P2). Mirrors the
 * post-sync chip vocabulary so planner sees the same explanation pre/post. */
.jp-signal-note {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  font-size: 10px;
  font-style: italic;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid var(--color-border);
}

/* Auto-updated */
.jp-auto-section { margin-top: 16px; border-top: 1px solid var(--color-border); padding-top: 8px; }
.jp-auto-row { opacity: 0.6; }
.jp-auto-changes { font-size: 11px; color: var(--color-text-muted); }
.jp-auto-change { margin-right: 12px; }

/* Loading */
.jp-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 20px; gap: 16px; }
.jp-spinner { width: 32px; height: 32px; border: 3px solid var(--color-border); border-top-color: var(--color-accent); border-radius: 50%; animation: jp-spin 0.8s linear infinite; }
@keyframes jp-spin { to { transform: rotate(360deg); } }
.jp-loading-text { font-size: var(--font-sm); color: var(--color-text-muted); }
.jp-loading-projects { display: flex; flex-wrap: wrap; gap: 8px; }
.jp-loading-project { font-size: var(--font-xs); color: var(--color-text-muted); padding: 2px 8px; background: var(--color-surface-alt); border-radius: var(--radius-sm); transition: all 0.3s; }
.jp-loading-project.jp-loading-done { color: var(--color-success); background: rgba(16,185,129,0.08); }
.jp-loading-sub { font-size: var(--font-xs); color: var(--color-text-muted); }

/* Empty state */
.jp-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 20px; }
.jp-empty-title { font-size: var(--font-md); font-weight: var(--font-weight-semibold); color: var(--color-text); }
.jp-empty-sub { font-size: var(--font-sm); color: var(--color-text-muted); margin-top: 4px; }
