/* ═══════════════════════════════════════════════════════════════════════════
   JSKE 2026 — css/taskux.css — LINEAR-INSPIRED TASK UX POLISH (v36.93)
   ─────────────────────────────────────────────────────────────────────────
   Additive polish only. Dùng token (--bg-light/--text/--primary/--accent/
   --glass-light...) nên contrast tự đúng cả DARK lẫn LIGHT theme (không bao giờ
   chữ-trắng-nền-trắng / chữ-tối-nền-tối). Không override render/logic cũ.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Roving keyboard cursor (j/k focus ring) ─── */
.task-list-row { transition: background .12s ease; }
.task-list-row.taskux-cursor { background: var(--glass-light); }
.task-list-row.taskux-cursor > td:first-child { box-shadow: inset 3px 0 0 0 var(--primary); }
.task-list-row.taskux-cursor > td { border-top: 1px solid var(--primary); border-bottom: 1px solid var(--primary); }
.task-card.taskux-cursor,
.mtask-card.taskux-cursor { box-shadow: 0 0 0 2px var(--primary) !important; transition: box-shadow .12s ease; }

/* ─── Selection accent (works with existing .selected) ─── */
.task-list-row.selected > td:first-child { box-shadow: inset 3px 0 0 0 var(--accent); }

/* ─── Clickable priority / status pills (Linear quick-change affordance) ─── */
.task-list-row .badge[class*="priority-"],
.task-list-row .badge[class*="status-"],
.task-card .badge[class*="priority-"],
.task-card .badge[class*="status-"] {
  cursor: pointer;
  transition: filter .15s ease, box-shadow .15s ease;
}
.task-list-row .badge[class*="priority-"]:hover,
.task-list-row .badge[class*="status-"]:hover,
.task-card .badge[class*="priority-"]:hover,
.task-card .badge[class*="status-"]:hover {
  filter: brightness(1.12);
  box-shadow: 0 0 0 2px var(--glass-light);
}

/* ─── Inline rename input ─── */
.taskux-rename-input {
  font: inherit; font-weight: 600;
  background: var(--bg-lighter);
  color: var(--text);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm, 6px);
  padding: 1px 6px; min-width: 160px; max-width: 420px;
  outline: none;
}

/* ═══════════════ COMMAND PALETTE (Cmd+K) ═══════════════ */
.taskux-palette {
  position: fixed; inset: 0; z-index: 20000;
  background: rgba(8, 9, 18, 0.55);
  backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 14vh;
}
.taskux-palette-box {
  background: var(--bg-light);
  color: var(--text);
  width: min(560px, 92vw);
  max-height: 62vh;
  border-radius: 14px;
  border: 1px solid var(--glass-light);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  overflow: hidden; display: flex; flex-direction: column;
}
.taskux-palette-search {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--glass-light);
}
.taskux-palette-icon { font-size: 14px; color: var(--text-dim); }
#cmdInput {
  flex: 1; background: none; border: none; outline: none;
  font-size: 15px; color: var(--text);
}
#cmdInput::placeholder { color: var(--text-dim); }
.taskux-palette-list { overflow-y: auto; padding: 6px; flex: 1; }
.taskux-palette-sect {
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-dim); padding: 8px 12px 4px;
}
.taskux-palette-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 8px; cursor: pointer;
  transition: background .1s ease;
}
.taskux-palette-item.tux-active { background: #574fcf; color: #fff; }
.taskux-palette-item.tux-active .taskux-palette-hint,
.taskux-palette-item.tux-active .tux-hl { color: #fff; }
.taskux-palette-ic { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.taskux-palette-label { flex: 1; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tux-hl { font-weight: 700; color: var(--primary); }
.taskux-palette-hint {
  font-size: 10px; font-family: ui-monospace, monospace; /* v36.112 (J26-85): bỏ opacity .8 — chữ gợi ý chỉ ~3.6:1; nay = --text-dim đủ ≥4.5:1 ở cả 2 theme */
  background: var(--glass); color: var(--text-dim);
  padding: 1px 6px; border-radius: 4px; flex-shrink: 0;
}
.taskux-palette-empty { padding: 20px 16px; text-align: center; color: var(--text-dim); font-size: 13px; }
.taskux-palette-foot {
  padding: 8px 14px; border-top: 1px solid var(--glass-light);
  font-size: 11px; color: var(--text-dim); display: flex; gap: 12px;
}
.taskux-palette-foot kbd, .taskux-cheat-row kbd, .taskux-qa-hint kbd, .taskux-toast kbd {
  font-family: ui-monospace, monospace; font-size: 10px;
  background: var(--glass); color: var(--text);
  border: 1px solid var(--glass-light); border-radius: 4px;
  padding: 1px 5px;
}

/* ═══════════════ QUICK PICKER (status / priority) ═══════════════ */
.taskux-picker {
  position: fixed; z-index: 20050;
  background: var(--bg-light); color: var(--text);
  border: 1px solid var(--glass-light); border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  min-width: 190px; padding: 5px; outline: none;
}
.taskux-picker-head {
  font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-dim); padding: 6px 10px 4px;
}
.taskux-picker-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 13px;
  transition: background .1s ease;
}
.taskux-picker-item.tux-active { background: #574fcf; color: #fff; }
/* priority color-coding via a solid dot (no text-contrast needed) + glyph in --text (AA both themes) */
.tux-pri-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.taskux-picker-item .tux-pri-glyph { color: var(--text); }
.taskux-picker-item.tux-active .tux-pri-glyph { color: #fff; }

/* ═══════════════ QUICK ADD (create-and-continue) ═══════════════ */
.taskux-qa-overlay {
  position: fixed; inset: 0; z-index: 20040;
  background: rgba(8, 9, 18, 0.5); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center; padding-top: 16vh;
}
.taskux-qa-box {
  background: var(--bg-light); color: var(--text);
  width: min(520px, 92vw); border-radius: 14px;
  border: 1px solid var(--glass-light); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.taskux-qa-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.taskux-qa-head > span:first-child { font-weight: 700; font-size: 14px; }
.taskux-qa-hint { font-size: 11px; color: var(--text-dim); }
.taskux-qa-input {
  width: 100%; box-sizing: border-box;
  background: var(--bg-lighter); color: var(--text);
  border: 1px solid var(--glass-light); border-radius: 9px;
  padding: 11px 13px; font-size: 15px; outline: none;
}
.taskux-qa-input:focus { border-color: var(--primary); }
.taskux-qa-input::placeholder { color: var(--text-dim); }
.taskux-qa-log { max-height: 34vh; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.taskux-qa-item { font-size: 12.5px; color: var(--text-dim); padding: 2px 2px; }

/* ═══════════════ UNDO TOAST ═══════════════ */
.taskux-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 20010; display: flex; align-items: center; gap: 14px;
  background: var(--bg-light); color: var(--text);
  border: 1px solid var(--glass-light); border-radius: 10px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.35);
  padding: 10px 12px 10px 16px; font-size: 13px;
  animation: taskuxToastIn .22s ease;
}
.taskux-toast.taskux-toast-out { opacity: 0; transform: translateX(-50%) translateY(8px); transition: all .25s ease; }
.taskux-toast-msg { font-weight: 500; }
.taskux-toast-undo {
  background: #574fcf; color: #fff; border: none;
  border-radius: 7px; padding: 5px 11px; font-size: 12px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: filter .15s ease;
}
.taskux-toast-undo:hover { filter: brightness(1.1); }
.taskux-toast-undo kbd { background: rgba(255, 255, 255, 0.22); color: #fff; border-color: rgba(255, 255, 255, 0.3); }
@keyframes taskuxToastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ═══════════════ SHORTCUTS CHEAT OVERLAY ═══════════════ */
.taskux-cheat-overlay {
  position: fixed; inset: 0; z-index: 20060;
  background: rgba(8, 9, 18, 0.55); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; outline: none;
}
.taskux-cheat-box {
  background: var(--bg-light); color: var(--text);
  width: min(460px, 92vw); border-radius: 14px;
  border: 1px solid var(--glass-light); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  padding: 18px 20px;
}
.taskux-cheat-head { font-weight: 700; font-size: 15px; margin-bottom: 12px; }
.taskux-cheat-grid { display: flex; flex-direction: column; gap: 7px; }
.taskux-cheat-row { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.taskux-cheat-row kbd { min-width: 64px; text-align: center; }
.taskux-cheat-row span { color: var(--text-dim); }
.taskux-cheat-foot { margin-top: 14px; font-size: 11px; color: var(--text-dim); text-align: right; }

/* ─── Respect reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  .task-list-row, .task-card.taskux-cursor, .mtask-card.taskux-cursor,
  .taskux-toast, .taskux-palette-item, .taskux-picker-item,
  .task-list-row .badge[class*="priority-"], .task-list-row .badge[class*="status-"] {
    transition: none !important; animation: none !important;
  }
}

/* ═══════════════ v36.101: MOBILE PARITY (X2-platform-parity-04/-18, B-tasks-ui-07) ═══════════════
   Pills on .mtask-card, selection mode (long-press / "Chọn" chip), sticky bulk action bar, sort control.
   Scoped to ≤768px; tokens only so both themes stay AA. */
@media (max-width: 768px) {
  /* X2-platform-parity-18: priority/status pills on cards get the same quick-change affordance as desktop rows */
  .mtask-card .badge[class*="priority-"],
  .mtask-card .badge[class*="status-"] { cursor: pointer; }
  .mtask-card .badge.mtask-tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; letter-spacing: 0; line-height: 1.4; }
  /* long-press should not trigger the OS text-selection callout */
  .mtask-card { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }

  /* selection mode */
  .mtask-card.selected { background: rgba(108, 92, 231, 0.14); border-color: var(--primary); }
  .mtask-selbox { min-width: 44px; min-height: 44px; margin: -8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer; }
  .mtask-selbox input { width: 22px; height: 22px; margin: 0; accent-color: var(--primary); }

  /* sort control in the chips row */
  .mtask-sort-select { max-width: 160px; }
  .mtask-sort-dir { min-width: 44px; min-height: 36px; padding: 6px 10px; text-align: center; font-size: 15px; line-height: 1; }

  /* sticky bulk action bar */
  .mtask-selbar-spacer { height: 136px; }
  .mtask-selbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 9000; /* under .modal (10100) and .toast */
    background: var(--bg-light); color: var(--text);
    border-top: 1px solid var(--glass-light); box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  }
  .mtask-selbar-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
  .mtask-selbar-head span { flex: 1; }
  .mtask-selbar-btn { min-height: 36px; padding: 6px 12px; border-radius: 18px; border: 1px solid var(--glass-light); background: var(--glass); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .mtask-selbar-btn:active { background: var(--primary); color: #fff; }
  .mtask-selbar-acts { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
  .mtask-selbar-acts::-webkit-scrollbar { display: none; }
  .mtask-selbar-act {
    flex: 0 0 auto; min-width: 64px; min-height: 48px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    padding: 4px 8px; border-radius: 10px; border: 1px solid var(--glass-light);
    background: var(--glass); color: var(--text); font-size: 11px; font-weight: 600;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .mtask-selbar-act:active { background: var(--primary); color: #fff; }
  .mtask-selbar-act:disabled { opacity: 0.45; cursor: default; }
  .mtask-selbar-act.mtask-selbar-danger { color: var(--danger); border-color: rgba(231, 76, 60, 0.4); }
  .mtask-selbar-ico { font-size: 16px; line-height: 1; }
}
