/* tasks.css — стили таск-трекера (tasks.html) */
/* Цвета — Revolut dark design tokens (luongnv.com/sleek-ui/designs/revolut.json) */
:root {
  --bg:      hsl(210, 11%, 11%);
  --bg-card: hsl(240, 33%, 17%);
  --bg-el:   hsl(240, 33%, 19%);
  --fg:      hsl(0, 0%, 95%);
  --fg-m:    hsl(240, 5%, 64.9%);
  --primary:   #4ade80;
  --primary-h: #22c55e;
  --border:  hsl(240, 33%, 22%);
  --border-h: hsl(240, 33%, 27%);
  --radius:  0.375rem;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem;
}
a { color: var(--primary); text-decoration: none; }

/* Header */
header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1rem;
}
h1 { flex: 1; font-size: 1.25rem; font-weight: 600; }
.badge {
  font-size: 0.72rem;
  background: var(--bg-el);
  color: var(--fg-m);
  padding: 2px 9px;
  border-radius: 12px;
}

/* Quick-add */
.add-bar {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
}
.add-input-wrap { position: relative; flex: 1; }
.add-bar input {
  width: 100%;
  background: var(--bg-card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.8rem;
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.add-bar input:focus { border-color: var(--primary); }
.add-bar input::placeholder { color: var(--fg-m); }
/* Autocomplete dropdown */
.ac-drop {
  position: absolute;
  top: calc(100% + 2px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--primary);
  border-radius: 0 0 8px 8px;
  z-index: 200;
  max-height: 180px;
  overflow-y: auto;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.ac-item {
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--fg);
  transition: background 0.1s;
}
.ac-item:hover, .ac-item.selected { background: var(--bg-el); }
/* Quick-add «+» button — accent, same height as input */
.add-bar button {
  background: var(--primary);
  color: #0d1117;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 1.1rem;
  font-size: 1.1rem;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  align-self: stretch;
  transition: background 0.14s, box-shadow 0.14s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.add-bar button:hover {
  background: var(--primary-h);
  box-shadow: 0 2px 8px rgba(74,222,128,0.35);
}

/* Search */
.search-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.7rem;
  margin-bottom: 0.75rem;
  transition: border-color 0.15s;
}
.search-bar:focus-within { border-color: var(--primary); }
.search-icon { color: var(--fg-m); font-size: 0.85rem; flex-shrink: 0; }
.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg);
  font-size: 0.88rem;
  font-family: inherit;
}
.search-bar input::placeholder { color: var(--fg-m); }
.search-clear {
  background: transparent;
  border: none;
  color: var(--fg-m);
  cursor: pointer;
  padding: 0 2px;
  font-size: 0.8rem;
  line-height: 1;
  flex-shrink: 0;
}
.search-clear:hover { color: var(--fg); }

/* Tabs */
.tabs { display: flex; gap: 0.35rem; margin-bottom: 0.75rem; }
.tab {
  padding: 0.35rem 1rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--bg-el);
  color: var(--fg-m);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.tab.on { background: var(--primary); color: #0d1117; border-color: transparent; font-weight: 700; }

/* Chips */
.chip-section { margin-bottom: 0.55rem; }
.chip-label {
  font-size: 0.61rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fg-m);
  margin-bottom: 0.26rem;
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  gap: 0.3rem;
}
.chip-label:hover { color: var(--fg); }
.chip-toggle { font-size: 0.6rem; margin-left: auto; transition: transform 0.15s; opacity: 0.55; }
.chip-section.collapsed .chip-toggle { transform: rotate(-90deg); }
.chip-section.collapsed .chip-row { display: none; }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.chip {
  padding: 2px 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-el);
  color: var(--fg-m);
  font-size: 0.76rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s;
}
.chip.on { background: var(--primary); color: #1c1c2e; border-color: var(--primary); }

/* Priority chip colours */
.chip.pri-a { border-color: #c05050; color: #f08080; }
.chip.pri-a.on { background: #f08080; color: #1c1c2e; border-color: #f08080; }
.chip.pri-b { border-color: #b08030; color: #f0c070; }
.chip.pri-b.on { background: #f0c070; color: #1c1c2e; border-color: #f0c070; }
.chip.pri-c { border-color: #3070a0; color: #7cb8f0; }
.chip.pri-c.on { background: #7cb8f0; color: #1c1c2e; border-color: #7cb8f0; }
.chip.pri-d { border-color: #6040a0; color: #bd93f9; }
.chip.pri-d.on { background: #bd93f9; color: #1c1c2e; border-color: #bd93f9; }
/* Hashtag chip */
.chip.ht-chip { border-color: #b0508a; color: #ff79c6; }
.chip.ht-chip.on { background: #ff79c6; color: #1c1c2e; border-color: #ff79c6; }
/* Inline hashtag in task text */
.task-hashtag { color: #ff79c6; cursor: pointer; }
.task-hashtag:hover { opacity: 0.75; }

/* Controls */
.controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  font-size: 0.78rem;
  color: var(--fg-m);
}
.controls select {
  background: var(--bg-el);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
}
#clear-filters {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-m);
  border-radius: 14px;
  padding: 2px 10px;
  font-size: 0.75rem;
  cursor: pointer;
  font-family: inherit;
}
#clear-filters:hover { color: var(--fg); border-color: var(--fg-m); }

/* Task list */
.tasklist { display: flex; flex-direction: column; gap: 0.35rem; }
.task-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.task-row.done { opacity: 0.45; }
.task-row input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 3px;
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
}
.task-body { flex: 1; min-width: 0; }
.task-text {
  font-size: 0.88rem;
  line-height: 1.45;
  word-break: break-word;
}
.task-row.done .task-text { text-decoration: line-through; color: var(--fg-m); }
.task-goal {
  display: block;
  font-size: 0.74rem;
  color: var(--fg-m);
  margin-top: 0.1rem;
  font-style: italic;
}
.task-difficulty,
.task-advice {
  display: block;
  font-size: 0.74rem;
  color: var(--fg-m);
  margin-top: 0.1rem;
  line-height: 1.5;
}
.task-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.3rem;
}
.t { font-size: 0.68rem; padding: 1px 6px; border-radius: 10px; }
.t-ctx  { background: #1b2a3a; color: #7cb8f0; }
.t-proj { background: #1a2b1a; color: #7fc97f; }
.t-pri  { font-weight: 700; border-radius: 4px; padding: 1px 6px; }
.t-pri-A { background: #3a1e1e; color: #f08080; }
.t-pri-B { background: #3a2b1a; color: #f0c070; }
.t-pri-C { background: #1a2a3a; color: #7cb8f0; }
.t-pri-D { background: var(--bg-el); color: var(--fg-m); }
.t-date  { font-size: 0.66rem; color: #55556a; }

/* Due date badges */
.t-due { font-weight: 500; }
.due-overdue { background: #3a1e1e; color: #f08080; }
.due-today   { background: #3a2b1a; color: #f0c070; }
.due-soon    { background: #1a2b1a; color: #7fc97f; }
.due-ok      { background: var(--bg-el); color: var(--fg-m); }

/* Links inside task text */
.task-link { color: #7cb8f0; text-decoration: underline; word-break: break-all; }
.task-link:hover { color: #a8d0ff; }

/* Search highlight */
mark {
  background: rgba(74, 222, 128, 0.25);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* Process button */
.proc-btn {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--fg-m);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 4px;
  opacity: 0.35;
  margin-top: 1px;
}
.proc-btn:hover { opacity: 1; color: var(--primary); }

.empty { text-align: center; color: var(--fg-m); padding: 2.5rem; font-style: italic; }
.kbd { font-size: 0.68rem; color: var(--fg-m); background: var(--bg-el); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; line-height: 1.6; }

/* Section headers */
.section-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--fg-m);
  padding: 0.6rem 0.2rem 0.2rem;
  border-bottom: 1px solid var(--border);
  margin-top: 0.4rem;
  margin-bottom: 0.1rem;
  cursor: pointer;
  user-select: none;
}
.section-header:hover { color: var(--fg); }
.section-toggle {
  font-size: 0.62rem;
  flex-shrink: 0;
  transition: transform 0.15s;
}
.section-toggle.collapsed { transform: rotate(-90deg); }
.section-count {
  margin-left: auto;
  font-size: 0.64rem;
  color: var(--fg-m);
  opacity: 0.6;
}

/* Ignored tasks */
.ignored-row { opacity: 0.38; border-style: dashed; }
.ignored-row .task-text { font-style: italic; }
#ignored-toggle {
  display: none;
  width: 100%;
  text-align: center;
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--fg-m);
  border-radius: 8px;
  padding: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
  margin-top: 0.35rem;
}
#ignored-toggle:hover { color: var(--fg); border-color: var(--fg-m); }

/* Search hint */
.search-hint { font-size: 0.68rem; color: var(--fg-m); margin-bottom: 0.4rem; display: none; }
.search-hint.visible { display: block; }
.search-hint code { background: var(--bg-el); border-radius: 3px; padding: 0 4px; font-size: 0.66rem; }

/* vanilla-context-menu dark theme override */
.vanilla-context-menu {
  --menu-bg: #252539 !important;
  --menu-border: #2e2e4a !important;
  background: #252539 !important;
  border: 1px solid #2e2e4a !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5) !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  font-size: 0.85rem !important;
  padding: 4px !important;
}
.vanilla-context-menu > li {
  color: #f2f2f2 !important;
  border-radius: 5px !important;
  padding: 6px 14px !important;
}
.vanilla-context-menu > li:hover { background: #2e2e4a !important; }
.vanilla-context-menu > li.separator {
  background: #2e2e4a !important;
  height: 1px !important;
  margin: 3px 6px !important;
  padding: 0 !important;
}

/* ── Edit mode ──────────────────────────────────────────────── */
.task-row.editing { background: var(--bg-el); border-color: var(--primary); align-items: flex-start; }
.task-edit-input {
  width: 100%;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--primary);
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  min-height: 3.5rem;
  resize: vertical;
  box-sizing: border-box;
}
.tag-picker { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.4rem; }
.tag-pick-chip {
  padding: 2px 9px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--fg-m);
  font-size: 0.74rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s, color 0.1s;
  user-select: none;
}
.tag-pick-chip.active-tag { background: var(--primary); color: #1c1c2e; border-color: var(--primary); }
.tag-pick-chip.ctx-tag  { border-color: #3070a0; color: #7cb8f0; }
.tag-pick-chip.ctx-tag.active-tag  { background: #3070a0; color: #fff; border-color: #3070a0; }
.tag-pick-chip.proj-tag { border-color: #3a6a3a; color: #7fc97f; }
.tag-pick-chip.proj-tag.active-tag { background: #3a6a3a; color: #fff; border-color: #3a6a3a; }
.tag-pick-chip.pri-pick { border-color: #805050; color: #f0a0a0; font-weight: 700; }
.tag-pick-chip.pri-pick.active-tag { background: #805050; color: #fff; border-color: #805050; }
.edit-hint { font-size: 0.67rem; color: var(--fg-m); margin-top: 0.3rem; opacity: 0.7; }

/* ── Delete & edit hover buttons ────────────────────────────── */
.del-btn, .edit-btn {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--fg-m);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 4px;
  opacity: 0;
  margin-top: 1px;
  transition: opacity 0.1s;
}
.task-row:hover .del-btn,
.task-row:hover .edit-btn { opacity: 0.45; }
.del-btn:hover  { opacity: 1 !important; color: #f08080; }
.edit-btn:hover { opacity: 1 !important; color: var(--primary); }

/* Архив button */
.archive-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-m);
  border-radius: 9999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}
.archive-btn:hover { color: var(--fg); border-color: var(--border-h); }
.archive-btn.on { background: var(--primary); color: #0d1117; border-color: transparent; font-weight: 700; }

/* btn--ghost and btn--sm for header buttons (e.g. «↩ История») */
.btn--ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: var(--radius);
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  transition: background 0.14s, border-color 0.14s;
}
.btn--ghost:hover { background: var(--bg-el); border-color: var(--border-h); }
.btn--sm { font-size: 0.75rem; padding: 0.28rem 0.65rem; }

/* Sync badge */
.sync-badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--bg-el);
  color: var(--fg-m);
  border: 1px solid var(--border);
  white-space: nowrap;
  cursor: default;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sync-badge[data-state="loading"] { color: var(--primary); border-color: var(--primary); }
.sync-badge[data-state="ok"]      { color: #7fc97f;        border-color: #3a6a3a; }

/* Due date picker in edit mode */
.due-pick-lbl {
  display: inline-flex !important;
  align-items: center;
  gap: 3px;
  border-color: #505070;
  color: #8888ab;
}
.due-pick-inp {
  background: transparent;
  border: none;
  color: #8888ab;
  font-family: inherit;
  font-size: 0.74rem;
  outline: none;
  cursor: pointer;
  padding: 0;
  width: 120px;
}
.due-pick-inp::-webkit-calendar-picker-indicator { filter: invert(0.6); cursor: pointer; }

@media (max-width: 600px) {
  body { padding: 0.6rem; }
  header { margin-bottom: 0.65rem; }
  h1 { font-size: 1.1rem; }
  .add-bar { margin-bottom: 0.4rem; }
  .search-bar { margin-bottom: 0.4rem; }
  .tabs { margin-bottom: 0.5rem; gap: 0.25rem; }
  .tab { padding: 3px 12px; }
  .chip-section { margin-bottom: 0.3rem; }
  .controls { margin-bottom: 0.5rem; gap: 0.3rem; flex-wrap: wrap; }
  .tasklist { gap: 0.25rem; }
  .task-row { padding: 0.4rem 0.55rem; gap: 0.4rem; }
  .kbd { display: none; }
}
