/* ── Tasks page ── */

.tasks-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header ── */
.tasks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.tasks-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0;
  letter-spacing: -0.02em;
}

/* ── Project selector ── */
.tasks-project-selector {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  background: rgba(0,0,0,0.03);
  border-radius: 8px;
  padding: 3px;
}
.tasks-project-pill {
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #777;
  text-decoration: none;
  border: none;
  border-radius: 6px;
  transition: all 0.15s;
}
.tasks-project-pill:hover {
  color: #333;
  background: rgba(0,0,0,0.04);
}
.tasks-project-pill.active {
  background: #fff;
  color: #1a1a1a;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
}

/* ── Project name ── */
.tasks-project-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: #555;
  margin-bottom: 20px;
}
.tasks-project-name svg { opacity: 0.5; }

/* ── Quick-add (Things-style expanding card) ── */
.tqa {
  margin-bottom: 24px;
  position: relative;
}
.tqa-circle {
  flex-shrink: 0;
}

/* Collapsed trigger */
.tqa-collapsed {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  cursor: text;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  transition: border-color 0.15s;
}
.tqa-collapsed:hover {
  border-color: rgba(0,0,0,0.12);
}
.tqa-placeholder {
  font-size: 14px;
  color: #ccc;
}
.tqa.open .tqa-collapsed {
  display: none;
}

/* Expanded form */
.tqa-expanded {
  display: none;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  overflow: hidden;
  animation: tqa-in 0.2s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
.tqa.open .tqa-expanded {
  display: block;
}
@keyframes tqa-in {
  0% { opacity: 0; transform: translateY(-4px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.tqa-body {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px 8px;
}
.tqa-body .tqa-circle {
  margin-top: 2px;
}
.tqa-fields {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tqa-title {
  border: none;
  outline: none;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: #1a1a1a;
  padding: 0;
  background: transparent;
}
.tqa-title::placeholder { color: #ccc; font-weight: 500; }
.tqa-notes {
  border: none;
  outline: none;
  font-size: 13px;
  font-family: inherit;
  color: #888;
  padding: 0;
  background: transparent;
  resize: none;
}
.tqa-notes::placeholder { color: #ddd; }

/* Toolbar */
.tqa-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid rgba(0,0,0,0.05);
  background: rgba(0,0,0,0.015);
}
.tqa-toolbar-left {
  display: flex;
  align-items: center;
  gap: 4px;
}
.tqa-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Tool buttons (date etc) */
.tqa-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 12px;
  font-family: inherit;
  color: #888;
  background: transparent;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
  position: relative;
}
.tqa-tool-btn:hover {
  background: rgba(0,0,0,0.03);
  color: #555;
  border-color: rgba(0,0,0,0.12);
}
.tqa-tool-label.has-date {
  color: #144629;
  font-weight: 500;
}
.tqa-date-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* Cancel / Save */
.tqa-cancel-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  color: #888;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.12s;
}
.tqa-cancel-btn:hover { color: #333; }
.tqa-save-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: #144629;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}
.tqa-save-btn:hover { background: #1a5c36; }

/* ── Sections ── */
.tasks-section {
  margin-bottom: 8px;
}
.tasks-section-label {
  font-size: 13px;
  font-weight: 700;
  color: #144629;
  text-transform: none;
  letter-spacing: 0;
  margin: 0 0 6px 2px;
  padding: 0;
}
.tasks-completed-section {
  margin-top: 4px;
}
.tasks-completed-section .tasks-section-label {
  color: #999;
}
.tasks-section-toggle {
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
}
.tasks-section-toggle::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.15s;
  opacity: 0.5;
}
details[open] > .tasks-section-toggle::before {
  transform: rotate(90deg);
}
.tasks-section-toggle::-webkit-details-marker {
  display: none;
}

/* ── Task list ── */
.tasks-list {
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
}

/* ── Task row ── */
.task-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  border-radius: 8px;
  margin: 0 -8px;
  transition: background 0.1s;
}
.task-row:last-child {
  border-bottom: none;
}
.task-row:hover {
  background: rgba(0,0,0,0.02);
}

/* ── Checkbox ── */
.task-checkbox-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.1s;
}
.task-checkbox-btn svg {
  transition: transform 0.1s;
}
.task-checkbox-btn:hover {
  background: rgba(20,70,41,0.06);
}
.task-checkbox-btn:hover svg rect {
  stroke: #144629;
}
.task-checkbox-btn:active svg {
  transform: scale(0.9);
}

/* ── Task content ── */
.task-content {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.task-title {
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
  line-height: 1.5;
  transition: color 0.3s, text-decoration-color 0.3s;
}
.task-title.completed {
  color: #aaa;
  text-decoration: line-through;
  text-decoration-color: #aaa;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.task-due {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #999;
}
.task-due.overdue {
  color: #dc2626;
  font-weight: 500;
}

.task-assignee {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #999;
}

.task-link-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: #144629;
  text-decoration: none;
  background: rgba(20,70,41,0.06);
  padding: 2px 8px;
  border-radius: 10px;
  transition: background 0.1s;
}
.task-link-chip:hover {
  background: rgba(20,70,41,0.12);
}

/* ── Task detail panel (expandable) ── */
.task-detail {
  display: none;
  width: 100%;
  padding: 8px 0 4px 32px;
  flex-direction: column;
  gap: 6px;
}
.task-row {
  transition: background 0.2s ease, padding-bottom 0.2s ease;
}
.task-row.expanded {
  flex-wrap: wrap;
  background: rgba(0,0,0,0.015);
  border-radius: 10px;
  padding-bottom: 12px;
}
.task-row.expanded .task-detail {
  display: flex;
  animation: detail-in 0.2s ease both;
}
@keyframes detail-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.task-detail-notes {
  font-size: 13px;
  color: #888;
  line-height: 1.5;
  white-space: pre-wrap;
}
.task-detail-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #999;
}
.task-detail-field .overdue { color: #dc2626; font-weight: 500; }
.task-detail-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #144629;
  text-decoration: none;
  padding: 3px 10px;
  background: rgba(20,70,41,0.05);
  border-radius: 6px;
  transition: background 0.1s;
  width: fit-content;
}
.task-detail-link:hover { background: rgba(20,70,41,0.1); }

/* Indicators in collapsed row */
.task-has-notes, .task-has-links {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: #ccc;
}

/* Cursor hint that rows are clickable */
.task-row { cursor: pointer; }

/* ── Task actions (delete) ── */
.task-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  opacity: 0;
  transition: opacity 0.1s;
  padding-top: 1px;
}
.task-row:hover .task-actions {
  opacity: 1;
}
.task-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: #ccc;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.task-delete-btn:hover {
  background: rgba(220,38,38,0.06);
  color: #dc2626;
}

/* ── Empty state ── */
.tasks-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 100px 20px;
  color: #bbb;
  font-size: 15px;
}
.tasks-empty p { margin: 0; }
.tasks-empty svg { opacity: 0.3; }
.tasks-empty-sub {
  font-size: 13px;
  color: #ccc;
}

/* ── Animations ── */

/* Row entrance on page load */
.task-row {
  animation: task-row-in 0.3s ease both;
}
@keyframes task-row-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Checkbox pop on toggle */
.task-checkbox-btn.popping svg {
  animation: check-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes check-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Slide out when moving between sections */
.task-row.sliding-out {
  opacity: 0;
  transform: translateX(-20px);
}

/* Slide in when appearing in new section */
.task-row.sliding-in {
  animation: task-slide-in 0.35s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
@keyframes task-slide-in {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Delete slide out */
.task-row.deleting {
  transition: opacity 0.2s, transform 0.2s, max-height 0.3s ease 0.05s, padding 0.3s ease 0.05s;
  opacity: 0;
  transform: translateX(30px);
}

/* ── Sync button ── */
.tasks-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.tasks-sync-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  color: #888;
  background: transparent;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
}
.tasks-sync-btn:hover {
  background: rgba(0,0,0,0.03);
  color: #555;
  border-color: rgba(0,0,0,0.12);
}

/* ── Connect banner ── */
.tasks-connect-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #888;
  background: rgba(20,70,41,0.03);
  border: 1px solid rgba(20,70,41,0.08);
  border-radius: 8px;
}
.tasks-connect-banner span { flex: 1; }
.tasks-connect-link {
  font-size: 12px;
  font-weight: 600;
  color: #144629;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 5px;
  transition: background 0.12s;
}
.tasks-connect-link:hover {
  background: rgba(20,70,41,0.08);
}

/* ── Dark mode ── */
[data-theme="wistful_juniper"],
[data-theme="deep_current"] {
  /* Header */
  .tasks-header h1 { color: var(--color-text-primary); }

  /* Project selector */
  .tasks-project-selector { background: rgba(255,255,255,0.05); }
  .tasks-project-pill { color: var(--color-text-muted); }
  .tasks-project-pill:hover { color: var(--color-text-secondary); background: rgba(255,255,255,0.05); }
  .tasks-project-pill.active {
    background: var(--color-card);
    color: var(--color-text-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.06);
  }

  /* Project name */
  .tasks-project-name { color: var(--color-text-secondary); }

  /* Quick-add collapsed */
  .task-circle-unchecked { color: var(--color-text-muted); }
  .tqa-placeholder { color: var(--color-text-muted); }
  .tqa-collapsed { border-color: rgba(255,255,255,0.06); }
  .tqa-collapsed:hover { border-color: rgba(255,255,255,0.12); }

  /* Quick-add expanded card */
  .tqa-expanded {
    background: var(--color-card);
    border-color: rgba(255,255,255,0.1);
    box-shadow: 0 4px 24px rgba(0,0,0,0.3), 0 1px 4px rgba(0,0,0,0.2);
  }
  .tqa-title { color: var(--color-text-primary); }
  .tqa-title::placeholder { color: var(--color-text-muted); }
  .tqa-notes { color: var(--color-text-secondary); }
  .tqa-notes::placeholder { color: var(--color-text-muted); }

  /* Toolbar */
  .tqa-toolbar {
    border-color: rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
  }
  .tqa-tool-btn {
    color: var(--color-text-muted);
    border-color: rgba(255,255,255,0.1);
  }
  .tqa-tool-btn:hover {
    background: rgba(255,255,255,0.05);
    color: var(--color-text-secondary);
    border-color: rgba(255,255,255,0.15);
  }
  .tqa-cancel-btn { color: var(--color-text-muted); }
  .tqa-cancel-btn:hover { color: var(--color-text-primary); }
  .tqa-save-btn { background: var(--color-brand); color: var(--color-brand-text); }
  .tqa-save-btn:hover { background: var(--color-brand-hover); }

  /* Section labels */
  .tasks-section-label { color: var(--color-brand); }
  .tasks-completed-section .tasks-section-label { color: var(--color-text-muted); }

  /* Task rows */
  .task-row { border-color: rgba(255,255,255,0.04); }
  .task-row:hover { background: rgba(255,255,255,0.03); }
  .task-row.expanded { background: rgba(255,255,255,0.03); }
  .task-title { color: var(--color-text-primary); }
  .task-title.completed { color: var(--color-text-muted); text-decoration-color: var(--color-text-muted); }
  .task-due { color: var(--color-text-muted); }
  .task-assignee { color: var(--color-text-muted); }

  /* Task detail panel */
  .task-detail-notes { color: var(--color-text-secondary); }
  .task-detail-field { color: var(--color-text-muted); }
  .task-detail-link {
    color: var(--color-brand);
    background: rgba(255,255,255,0.05);
  }
  .task-detail-link:hover { background: rgba(255,255,255,0.08); }
  .task-link-chip {
    color: var(--color-brand);
    background: rgba(255,255,255,0.05);
  }
  .task-link-chip:hover { background: rgba(255,255,255,0.08); }

  /* Indicators */
  .task-has-notes, .task-has-links { color: var(--color-text-muted); }

  /* Checkbox hover */
  .task-checkbox-btn:hover { background: rgba(255,255,255,0.08); }
  .task-checkbox-btn:hover svg rect { stroke: var(--color-brand); }

  /* Delete button */
  .task-delete-btn { color: var(--color-text-muted); }
  .task-delete-btn:hover { background: rgba(220,38,38,0.12); color: #f87171; }

  /* Connect banner */
  .tasks-connect-banner {
    background: rgba(255,255,255,0.03);
    border-color: rgba(255,255,255,0.08);
    color: var(--color-text-muted);
  }
  .tasks-connect-link { color: var(--color-text-primary); }

  /* Sync button */
  .tasks-sync-btn {
    color: var(--color-text-muted);
    border-color: rgba(255,255,255,0.1);
  }
  .tasks-sync-btn:hover {
    color: var(--color-text-primary);
    background: rgba(255,255,255,0.05);
  }

  /* Empty state */
  .tasks-empty { color: var(--color-text-muted); }
  .tasks-empty-sub { color: var(--color-text-muted); }
}
