@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --bg-primary: #f5f5f5;
  --bg-secondary: #ffffff;
  --border-color: #e0e0e0;
  --text-primary: #212121;
  --text-secondary: #757575;
  --primary: #f59e0b;
  --primary-rgb: 245, 158, 11;
  --accent: #2196f3;
  --accent-hover: #1976d2;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 4px 8px rgba(0, 0, 0, 0.15);
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #22c55e;
  --surface: #ffffff;
  --surface-alt: #f8f9fa;
  --overlay: rgba(0, 0, 0, 0.45);

  --priority-default: #888888;
  --priority-red: #ef4444;
  --priority-orange: #f97316;
  --priority-yellow: #eab308;
  --priority-green: #22c55e;
  --priority-blue: #3b82f6;
  --priority-purple: #a855f7;
  --priority-white: #e5e7eb;
  --priority-black: #1f2937;
}

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

body {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
}

.app-root {
  min-height: 100vh;
}

.background-glow {
  position: fixed;
  top: -20vh;
  right: -10vw;
  width: 40vw;
  height: 40vw;
  background: radial-gradient(circle, rgba(33, 150, 243, 0.18), transparent 70%);
  filter: blur(10px);
  pointer-events: none;
  z-index: 0;
}

.header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: none;
  width: 100%;
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  height: 32px;
  width: auto;
  max-width: 132px;
  border-radius: 0;
  display: block;
  object-fit: contain;
  background: transparent;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.brand-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.repo-select {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: white;
  font-size: 0.85rem;
  min-width: 200px;
}

.btn {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-hover);
}

.btn-secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: #e8e8e8;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.btn:disabled:hover {
  box-shadow: none;
  transform: none;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
}

.container {
  max-width: none;
  width: 100%;
  margin: 2rem 0;
  padding: 0;
}

.welcome {
  text-align: center;
  padding: 4rem 2rem;
}

.welcome h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.welcome p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

.filter-bar {
  background: white;
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 0 1rem;
}

.filter-content {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0 2rem;
}

.filter-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.filter-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.filter-group label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.filter-group select {
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
  min-width: 120px;
  font-size: 0.85rem;
  background: #f5f5f5;
}

.filter-row .btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  border-radius: 6px;
}

.filter-input {
  padding: 0.5rem;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  min-width: 150px;
}

.search-wrap {
  position: relative;
  max-width: 600px;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 0.75rem 3rem 0.75rem 1rem;
  border: 2px solid #cbd5e0;
  border-radius: 8px;
  font-size: 1rem;
}

.active-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-height: 32px;
  justify-content: center;
}

.filter-pill {
  background: #3b82f6;
  color: white;
  padding: 0.35rem 0.75rem;
  border-radius: 16px;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.kanban-board {
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 2rem;
  overflow-x: auto;
  justify-content: flex-start;
  min-width: 100%;
  width: 100%;
}

.kanban-column {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: var(--shadow);
  min-width: 280px;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
}

.column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border-color);
}

.column-title {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.column-count {
  background: var(--bg-primary);
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.task-list {
  min-height: 100px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.task-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.task-card * {
  cursor: pointer;
}

.task-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.task-card.dragging {
  opacity: 0.5;
}

.task-card.drag-over {
  border-top: 3px solid var(--primary);
  margin-top: -3px;
}

.task-list.drag-over-empty {
  background: rgba(var(--primary-rgb, 245, 158, 11), 0.1);
  border: 2px dashed var(--primary);
  border-radius: 8px;
  min-height: 100px;
}

.task-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}

.task-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.task-card:hover .task-actions {
  opacity: 1;
}

.task-actions .btn {
  padding: 0.1rem;
  font-size: 0.9rem;
  line-height: 1;
}

.task-actions .btn-ghost {
  border: none;
  background: transparent;
}

.task-id {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.task-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.task-detail-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.task-detail-meta-item {
  min-width: 0;
}

.badge {
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-category {
  background: #e3f2fd;
  color: #1565c0;
}

.badge-assignee {
  background: #f3e5f5;
  color: #6a1b9a;
}

.tag {
  background: #fff3e0;
  color: #e65100;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-size: 0.7rem;
}

.task-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-detail {
  line-height: 1.8;
}

.task-detail strong {
  color: var(--text-primary);
}

.task-modified {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.task-subtasks {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.subtask-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--overlay);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 8px;
  padding: 2rem;
  width: min(960px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.task-detail-header {
  align-items: center;
  gap: 1rem;
}

.task-detail-header .task-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.task-id-badge {
  background: var(--primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
}

.task-id-badge:empty {
  display: none;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.form-warning {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #b45309;
}

.tags-autocomplete {
  margin-top: 0.5rem;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  background: white;
  max-height: 180px;
  overflow-y: auto;
}

.tag-option {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid #eee;
}

.tag-option:last-child {
  border-bottom: none;
}

.tag-option:hover {
  background: #f0f0f0;
}

.tag-pill {
  background: var(--primary);
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

.todo-modal {
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.todo-modal .modal-header {
  padding: 1.5rem 2rem 0;
  margin-bottom: 0;
}

.todo-body {
  padding: 1.5rem 2rem 2rem;
}

.todo-list {
  max-height: 500px;
  overflow-y: auto;
}

.archive-modal {
  padding: 0;
  width: min(900px, 95vw);
  overflow: hidden;
}

.archive-modal .modal-header {
  padding: 1.5rem 2rem 0;
  margin-bottom: 0;
}

.archive-body {
  padding: 1.5rem 2rem 2rem;
}

.archive-search {
  margin-bottom: 1rem;
}

.archive-search-input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #cbd5e0;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}

.archive-list {
  max-height: 500px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.archive-item {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
}

.archive-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.archive-title {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.archive-id {
  background: #6b7280;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.archive-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.archive-actions .btn {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.archive-delete {
  background: #ef4444;
  color: white;
  border: none;
}

.archive-restore {
  border: none;
}

.archive-description {
  color: #666;
  margin: 0.5rem 0;
}

.archive-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.archive-pill {
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.8rem;
  color: white;
}

.archive-pill-category {
  background: #8b5cf6;
}

.archive-pill-tag {
  background: #3b82f6;
}

.archive-empty {
  text-align: center;
  color: #999;
  padding: 2rem;
}

.todo-task-group {
  margin-bottom: 1.25rem;
}

.todo-empty {
  text-align: center;
  color: #999;
  padding: 2rem;
}

.todo-task-header {
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  background: transparent;
  border: none;
  padding: 0;
  text-align: left;
}

.todo-task-id {
  font-weight: normal;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.todo-task-assignees {
  font-weight: normal;
  color: var(--primary);
  font-size: 0.85rem;
  margin-left: 0.5rem;
}

.todo-subtask {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  margin-left: 1rem;
  background: var(--bg-primary);
  border-radius: 4px;
  margin-bottom: 0.25rem;
}

.todo-subtask-text {
  flex: 1;
}

.todo-due {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 600;
}

.diff-view {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
  font-family: "Consolas", "Monaco", "Menlo", monospace;
  font-size: 0.85rem;
  white-space: pre;
  max-height: 50vh;
  overflow: auto;
}

.diff-line {
  display: block;
  padding: 0 0.25rem;
}

.diff-file {
  color: #6b7280;
  font-weight: 600;
}

.diff-hunk {
  background: #f1f5f9;
  color: #1f2937;
}

.diff-add {
  background: #ecfdf3;
  color: #166534;
}

.diff-del {
  background: #fef2f2;
  color: #991b1b;
}

.diff-context {
  color: #374151;
}

.actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .task-detail-meta {
    grid-template-columns: 1fr;
  }

  .task-detail-meta-item {
    grid-column: auto !important;
    grid-row: auto !important;
  }
}

.notification {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: white;
  padding: 1rem 1.5rem;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: none;
  align-items: center;
  gap: 0.75rem;
  z-index: 1001;
}

.notification.show {
  display: flex;
  animation: slideIn 0.3s ease;
}

.notification.success {
  border-left: 4px solid var(--success);
}

.notification.error {
  border-left: 4px solid var(--danger);
}

.notification.warning {
  border-left: 4px solid var(--warning);
}

@keyframes slideIn {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.loading {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.loading-overlay {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
  z-index: 1100;
  border: 1px solid var(--border-color);
}

.loading::before {
  content: "";
  width: 20px;
  height: 20px;
  border: 3px solid var(--bg-primary);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
}

.summary-card {
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.summary-card pre {
  white-space: pre-wrap;
  font-family: inherit;
  background: #f9f9f9;
  padding: 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.status-bar {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.status-pill {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(33, 150, 243, 0.12);
  color: #0d47a1;
  font-size: 0.8rem;
  font-weight: 600;
}

@media (max-width: 960px) {
  .header {
    padding: 1rem;
  }

  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .container {
    padding: 0 1rem;
  }

  .kanban-board {
    padding: 1.5rem 1rem;
  }
}
