/* ==========================================================================
   list-view.css — Todoist-style indented task list
   HMS Inkwell · Scoped under #list-view
   All colours via tokens from styles.css; no duplicated :root vars.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Outer wrapper
   -------------------------------------------------------------------------- */
#list-view .lv-root {
  padding: 24px 32px;
  max-width: 752px;          /* 720px content + 32px padding on each side */
}

/* --------------------------------------------------------------------------
   Empty state
   -------------------------------------------------------------------------- */
#list-view .lv-empty {
  padding: 48px 32px;
  color: var(--subtext);
  font-size: 14px;
  font-style: italic;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Task row
   -------------------------------------------------------------------------- */
#list-view .lv-task-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 0;
  padding-left: calc(var(--indent, 0) * 24px + 12px);
  border-bottom: 1px solid var(--border);
  background: transparent;
  transition: background 120ms;
  position: relative;
}

#list-view .lv-task-row:hover {
  background: var(--hover);
}

/* Completed row — dimmed */
#list-view .lv-task-row.task--complete {
  opacity: 0.78;
}

/* --------------------------------------------------------------------------
   Chevron (expand / collapse triangle)
   -------------------------------------------------------------------------- */
#list-view .lv-chevron {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--subtext);
  border-radius: 3px;
  padding: 0;
  cursor: pointer;
  transition: color 120ms, background 120ms;
  line-height: 1;
}

#list-view .lv-chevron:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.06);
}

#list-view .lv-chevron--hidden {
  visibility: hidden;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Checkbox (priority-bordered circular toggle)
   -------------------------------------------------------------------------- */
#list-view .lv-checkbox {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--priority-color, var(--p4));
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: transparent;      /* ✓ hidden by default */
  cursor: pointer;
  padding: 0;
  transition: background 120ms, color 120ms,
              box-shadow 120ms;
}

#list-view .lv-checkbox:hover {
  background: color-mix(in srgb, var(--priority-color, var(--p4)) 12%, transparent);
}

/* Done state — filled circle with white checkmark */
#list-view .lv-checkbox.lv-checkbox--done {
  background: var(--priority-color, var(--p4));
  border-color: var(--priority-color, var(--p4));
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   Content area (flex column: title + meta)
   -------------------------------------------------------------------------- */
#list-view .lv-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;              /* allow text-overflow to work */
}

/* --------------------------------------------------------------------------
   Task title
   -------------------------------------------------------------------------- */
#list-view .lv-task-title {
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  line-height: 1.45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 120ms;
}

/* Completed title */
#list-view .lv-task-row.task--complete .lv-task-title {
  color: var(--subtext);
  text-decoration: line-through;
}

/* --------------------------------------------------------------------------
   Meta line (due chip + description)
   -------------------------------------------------------------------------- */
#list-view .lv-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}

/* Hide the meta container when empty (no children appended) */
#list-view .lv-meta:empty {
  display: none;
}

/* --------------------------------------------------------------------------
   Description excerpt
   -------------------------------------------------------------------------- */
#list-view .lv-description {
  font-size: 12px;
  color: var(--subtext);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

/* --------------------------------------------------------------------------
   Due-date chip
   -------------------------------------------------------------------------- */
#list-view .lv-due-chip {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  padding: 1px 8px;
  border-radius: 999px;
  flex-shrink: 0;
  line-height: 1.6;
}

/* Overdue — red */
#list-view .lv-due-chip.lv-due--overdue {
  color: #d1453b;
  background: color-mix(in srgb, #d1453b 10%, transparent);
}

/* Today — green */
#list-view .lv-due-chip.lv-due--today {
  color: #1f9d55;
  background: color-mix(in srgb, #1f9d55 10%, transparent);
}

/* Future — muted subtext, no strong background */
#list-view .lv-due-chip.lv-due--future {
  color: var(--subtext);
  background: color-mix(in srgb, var(--subtext) 6%, transparent);
}

/* --------------------------------------------------------------------------
   Hover action group
   -------------------------------------------------------------------------- */
#list-view .lv-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  margin-left: auto;
  padding-right: 4px;
  opacity: 0;
  transition: opacity 120ms;
}

#list-view .lv-task-row:hover .lv-actions {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Action buttons
   -------------------------------------------------------------------------- */
#list-view .lv-action-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--subtext);
  background: transparent;
  padding: 0;
  cursor: pointer;
  transition: background 120ms, color 120ms;
  flex-shrink: 0;
}

#list-view .lv-action-btn:hover {
  background: var(--hover);
  color: var(--text);
}

#list-view .lv-action-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Delete variant — danger hover colour */
#list-view .lv-action-btn.lv-action-btn--delete:hover {
  color: var(--p1);
  background: color-mix(in srgb, var(--p1) 8%, transparent);
}

/* --------------------------------------------------------------------------
   Add-task / add-subtask row
   -------------------------------------------------------------------------- */
#list-view .lv-add-row {
  display: flex;
  align-items: center;
  padding: 6px 0;
  padding-left: calc(var(--indent, 0) * 24px + 12px);
}

/* --------------------------------------------------------------------------
   "Add task" trigger pill
   -------------------------------------------------------------------------- */
#list-view .lv-add-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--accent);
  background: transparent;
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}

#list-view .lv-add-trigger:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

#list-view .lv-add-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Inline input wrapper (visible once trigger is clicked)
   -------------------------------------------------------------------------- */
#list-view .lv-add-input-wrap {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}

/* --------------------------------------------------------------------------
   Add-task input field
   -------------------------------------------------------------------------- */
#list-view .lv-add-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  padding: 4px 2px;
  outline: none;
  transition: border-color 120ms;
}

#list-view .lv-add-input::placeholder {
  color: var(--muted);
}

#list-view .lv-add-input:focus {
  border-bottom-color: var(--accent);
}

/* --------------------------------------------------------------------------
   Inline rename input (double-click on title)
   -------------------------------------------------------------------------- */
#list-view .lv-inline-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--accent);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  padding: 2px 2px 1px;
  outline: none;
  line-height: 1.45;
}

#list-view .lv-inline-input::placeholder {
  color: var(--muted);
}

/* ==========================================================================
   Mobile affordances — list-view
   ≤640px only; all desktop styles above remain pristine.
   ========================================================================== */
@media (max-width: 640px) {
  /* Actions always visible — no hover required on touch */
  #list-view .lv-actions {
    opacity: 1 !important;
  }

  /* Touch-sized action buttons — 36px saves 12px vs 40px without losing usability */
  #list-view .lv-action-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  /* Slightly larger checkbox; row padding ensures ≥40px tap area on the row */
  #list-view .lv-checkbox {
    width: 22px;
    height: 22px;
  }

  /* Taller rows → ≥40px tap area; tighter gap to reclaim horizontal space */
  #list-view .lv-task-row {
    padding-top: 12px;
    padding-bottom: 12px;
    padding-right: 12px;
    gap: 4px;
  }

  /* Remove trailing padding from actions group — the row right-padding is enough */
  #list-view .lv-actions {
    padding-right: 0;
  }

  /* Tighter indentation (16px/level) so deep subtrees don't overflow on narrow screens */
  #list-view .lv-task-row {
    padding-left: calc(var(--indent, 0) * 16px + 12px);
  }

  /* Bigger tap target for the add-task trigger */
  #list-view .lv-add-trigger {
    padding: 10px 14px;
  }

  /* Use the full narrow width with tighter outer padding */
  #list-view .lv-root {
    padding: 16px 12px;
  }

  /* Hide description excerpt — keeps rows compact; still editable in modal */
  #list-view .lv-description {
    display: none;
  }
}
