/* ABOUTME: Dashboard styles — monochrome theme with bright accent splashes. */
/* ABOUTME: Designed for desktop-first dev tool use at 800px+ width. */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes flash {
  0% { background: var(--accent); color: #fff; }
  100% { background: transparent; color: var(--text-primary); }
}

:root {
  --bg-primary: #FAFAFA;
  --bg-secondary: #FFFFFF;
  --bg-hover: #F0F0F0;
  --bg-surface: #F5F5F5;

  --text-primary: #111111;
  --text-secondary: #555555;
  --text-muted: #999999;

  --border: #E0E0E0;
  --border-light: #EEEEEE;

  /* Single bright accent for splashes of color */
  --accent: #FF4D00;
  --accent-dim: rgba(255, 77, 0, 0.08);

  /* Status — grayscale base with accent for active states */
  --status-in-progress: #FF4D00;
  --status-likely-in-progress: #FF8040;
  --status-waiting: #CCAA00;
  --status-done: #888888;
  --status-likely-done: #AAAAAA;

  --badge-claude: #111111;
  --badge-codex: #555555;

  --radius: 4px;
  --transition: 120ms ease;

  --font-display: "Archivo Black", "Arial Black", sans-serif;
  --font-body: "Archivo", "Helvetica Neue", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== Header ===== */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px;
  border-bottom: 3px solid var(--text-primary);
  background: var(--bg-secondary);
}

.header-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400; /* Archivo Black is already black weight */
  letter-spacing: 0.04em;
  color: var(--text-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.last-scan {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ===== Scan Days Input ===== */

.scan-days-label {
  display: flex;
  align-items: center;
  border: 2px solid var(--text-primary);
  background: var(--bg-secondary);
  padding: 0 8px 0 0;
}

.scan-days-input {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  width: 40px;
  padding: 5px 2px 5px 10px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  text-align: right;
  -moz-appearance: textfield;
}

.scan-days-input::-webkit-inner-spin-button,
.scan-days-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.scan-days-input:focus {
  outline: none;
}

.scan-days-suffix {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-left: 2px;
}

/* ===== Refresh Button ===== */

.btn-refresh {
  padding: 7px 20px;
  border: 2px solid var(--text-primary);
  background: var(--text-primary);
  color: var(--bg-secondary);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-refresh:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.btn-refresh:active {
  transform: scale(0.97);
}

.btn-refresh.spinning {
  opacity: 0.5;
  pointer-events: none;
}

/* ===== Filter Bar (Time Slider) ===== */

.filter-bar {
  padding: 10px 32px;
  max-width: 1100px;
  margin: 0 auto;
}

.time-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.time-slider-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  min-width: 80px;
}

.time-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--border);
  outline: none;
  border-radius: 2px;
  max-width: 300px;
}

.time-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition);
}

.time-slider::-webkit-slider-thumb:hover {
  background: var(--accent);
}

.time-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-primary);
  cursor: pointer;
  border: none;
}

/* ===== Search Overlay ===== */

.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: flex;
  justify-content: center;
  padding-top: 15vh;
}

.search-overlay.hidden {
  display: none;
}

.search-box {
  width: 600px;
  max-width: 90vw;
  background: var(--bg-secondary);
  border: 2px solid var(--text-primary);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  align-self: flex-start;
}

.search-input-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

.search-icon {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 500;
  color: var(--accent);
}

.search-input {
  flex: 1;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--text-primary);
  outline: none;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.search-results {
  overflow-y: auto;
  max-height: calc(60vh - 50px);
}

.search-result-row {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background var(--transition);
}

.search-result-row:hover,
.search-result-row.selected {
  background: var(--bg-hover);
}

.search-result-row.selected {
  border-left: 3px solid var(--accent);
  padding-left: 13px;
}

.search-result-repo {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.search-result-summary {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-summary mark {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 700;
  padding: 0 1px;
}

.search-no-results {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ===== Help Overlay ===== */

.help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: flex;
  justify-content: center;
  padding-top: 20vh;
}

.help-overlay.hidden {
  display: none;
}

.help-box {
  width: 360px;
  max-width: 90vw;
  background: var(--bg-secondary);
  border: 2px solid var(--text-primary);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  align-self: flex-start;
  padding: 20px 24px;
}

.help-title {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 0.04em;
  margin-bottom: 16px;
}

.help-shortcuts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.help-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

.help-row kbd {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  min-width: 48px;
  text-align: center;
  padding: 2px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-primary);
}

.help-dismiss {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

.help-dismiss kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 3px;
}

/* ===== Group Focus (j/k navigation) ===== */

.repo-group.group-focused > .repo-header {
  background: var(--accent-dim);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ===== Content ===== */

.content {
  padding: 24px 32px 64px;
  max-width: 1100px;
  margin: 0 auto;
}

.hidden {
  display: none !important;
}

.loading {
  text-align: center;
  padding: 64px;
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 500;
}

.empty-state {
  text-align: center;
  padding: 64px;
  color: var(--text-secondary);
  font-size: 15px;
}

.empty-state-title {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.empty-state-body {
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.7;
}

.empty-state-body p {
  margin-bottom: 8px;
}

.empty-state code {
  font-family: var(--font-mono);
  background: var(--bg-surface);
  padding: 2px 6px;
  font-size: 13px;
}

/* ===== Search Hint Bar ===== */

.search-hint-bar {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  margin-bottom: 8px;
}

.search-hint-bar kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  margin-right: 4px;
}

/* ===== Repo Group ===== */

.repo-group {
  margin-bottom: 2px;
  animation: fadeInUp 300ms ease both;
}

.repo-group:nth-child(1) { animation-delay: 0ms; }
.repo-group:nth-child(2) { animation-delay: 40ms; }
.repo-group:nth-child(3) { animation-delay: 80ms; }
.repo-group:nth-child(4) { animation-delay: 120ms; }
.repo-group:nth-child(5) { animation-delay: 160ms; }
.repo-group:nth-child(6) { animation-delay: 200ms; }

.repo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 8px;
  cursor: pointer;
  transition: background var(--transition);
  user-select: none;
  border-bottom: 1px solid var(--border-light);
}

.repo-header:hover {
  background: var(--bg-hover);
}

.repo-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.repo-chevron {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 150ms cubic-bezier(0.34, 1.56, 0.64, 1);
  width: 16px;
  text-align: center;
}

.repo-chevron.expanded {
  transform: rotate(90deg);
}

.octocat-icon {
  opacity: 0.3;
  margin-right: 2px;
  vertical-align: -1px;
  flex-shrink: 0;
}

.repo-name {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.repo-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.repo-meta .dirty {
  color: var(--accent);
  font-weight: 500;
}

.repo-meta .unpushed {
  color: var(--text-secondary);
  font-weight: 500;
}

.repo-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.btn-new-session {
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.btn-new-session:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ===== Repo Timeline ===== */

.repo-timeline {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
}

.timeline-phase {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 3px 0;
  font-size: 13px;
}

.timeline-period {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  min-width: 80px;
  text-align: right;
  flex-shrink: 0;
}

.timeline-desc {
  color: var(--text-secondary);
}

/* ===== Session List ===== */

.session-list {
  margin-left: 24px;
  border-left: 2px solid var(--border-light);
  overflow: hidden;
  transition: max-height 200ms ease;
}

.session-list.collapsed {
  max-height: 0 !important;
}

/* ===== Session Row ===== */

.session-row {
  display: grid;
  grid-template-columns: 10px 1fr auto auto auto;
  align-items: center;
  gap: 14px;
  padding: 7px 12px;
  cursor: pointer;
  transition: all var(--transition);
}

.session-row:hover {
  background: var(--bg-hover);
}

.session-row.launched {
  animation: flash 400ms ease;
}

/* ===== Status Dot ===== */

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.in-progress {
  background: var(--status-in-progress);
}

.status-dot.likely-in-progress {
  background: var(--status-likely-in-progress);
}

.status-dot.waiting-for-input {
  background: var(--status-waiting);
}

.status-dot.done {
  background: var(--status-done);
}

.status-dot.likely-done {
  background: var(--status-likely-done);
}

/* ===== Session Summary ===== */

.session-summary {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
}

/* ===== Status Label ===== */

.status-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  white-space: nowrap;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-label.in-progress {
  color: var(--status-in-progress);
  background: var(--accent-dim);
}

.status-label.likely-in-progress {
  color: var(--status-likely-in-progress);
  background: rgba(255, 128, 64, 0.08);
}

.status-label.waiting-for-input {
  color: var(--status-waiting);
  background: rgba(204, 170, 0, 0.08);
}

.status-label.done {
  color: var(--status-done);
  background: rgba(0, 0, 0, 0.04);
}

.status-label.likely-done {
  color: var(--status-likely-done);
  background: rgba(0, 0, 0, 0.03);
}

/* ===== Time Ago ===== */

.time-ago {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ===== Source Badge ===== */

.source-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 2px 8px;
  white-space: nowrap;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--border);
}

.source-badge.claude {
  color: var(--badge-claude);
}

.source-badge.codex {
  color: var(--badge-codex);
}

/* ===== Show More Button ===== */

.show-more-btn {
  padding: 8px 12px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  transition: background var(--transition);
  letter-spacing: 0.02em;
}

.show-more-btn:hover {
  background: var(--accent-dim);
}

/* ===== Non-Repo Separator ===== */

.non-repo-separator {
  padding: 20px 8px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-top: 2px solid var(--border);
  margin-top: 12px;
}

/* ===== Terminal Panel ===== */

.terminal-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50vh;
  background: #111111;
  border-top: 3px solid var(--accent);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.terminal-panel.hidden {
  display: none;
}

.terminal-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 0 0;
  background: #1a1a1a;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
}

.terminal-tabs {
  display: flex;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  gap: 1px;
}

.terminal-tabs::-webkit-scrollbar {
  display: none;
}

.terminal-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #777;
  cursor: pointer;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  flex-shrink: 0;
}

.terminal-tab:hover {
  color: #ccc;
  background: #222;
}

.terminal-tab.active {
  color: #ccc;
  background: #111111;
  border-bottom-color: var(--accent);
}

.terminal-tab.ended {
  color: #555;
  text-decoration: line-through;
}

.terminal-tab-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 14px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  opacity: 0.5;
}

.terminal-tab-close:hover {
  opacity: 1;
  color: var(--accent);
}

.terminal-tab-title {
  overflow: hidden;
  text-overflow: ellipsis;
}

.terminal-panel-close {
  background: none;
  border: none;
  color: #999;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.terminal-panel-close:hover {
  color: var(--accent);
}

#terminal-container {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.terminal-tab-container {
  display: none;
  position: absolute;
  inset: 4px;
}

.terminal-tab-container.active {
  display: block;
}

body.terminal-open .content {
  padding-bottom: calc(50vh + 24px);
}

/* ===== Responsive ===== */

@media (max-width: 800px) {
  .header,
  .content {
    padding-left: 16px;
    padding-right: 16px;
  }

  .header-title {
    font-size: 20px;
  }

  .session-row {
    grid-template-columns: 10px 1fr auto;
    gap: 8px;
  }

  .status-label,
  .time-ago {
    display: none;
  }
}

/* ===== Dark Mode ===== */

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #111111;
    --bg-secondary: #1a1a1a;
    --bg-hover: #252525;
    --bg-surface: #222222;

    --text-primary: #EEEEEE;
    --text-secondary: #BBBBBB;
    --text-muted: #777777;

    --border: #333333;
    --border-light: #2a2a2a;

    --accent-dim: rgba(255, 77, 0, 0.15);

    --status-done: #888888;
    --status-likely-done: #666666;

    --badge-claude: #DDDDDD;
    --badge-codex: #AAAAAA;
  }

  .status-label.done {
    background: rgba(255, 255, 255, 0.05);
  }

  .status-label.likely-done {
    background: rgba(255, 255, 255, 0.03);
  }

  .status-label.likely-in-progress {
    background: rgba(255, 128, 64, 0.15);
  }

  .status-label.waiting-for-input {
    background: rgba(204, 170, 0, 0.15);
  }

  .search-overlay {
    background: rgba(0, 0, 0, 0.7);
  }

  .source-badge {
    border-color: var(--border);
  }
}
