/* ---- Foundations ---- */
html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

* { -webkit-tap-highlight-color: transparent; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.12); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,0.28); }

/* View Transitions API */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 280ms;
  animation-timing-function: cubic-bezier(.16,1,.3,1);
}

/* ---- Card primitive ---- */
.card {
  position: relative;
  background-color: #0f2240;
  background-image: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  transition: transform 220ms cubic-bezier(.16,1,.3,1),
              box-shadow 240ms ease,
              border-color 220ms ease,
              background-color 220ms ease;
}
.card:hover {
  border-color: rgba(96,165,250,0.28);
  box-shadow: 0 12px 30px -12px rgba(0,0,0,0.6),
              0 0 0 1px rgba(96,165,250,0.18);
}

/* Cards that are clickable */
.card-press { cursor: pointer; }
.card-press:hover { transform: translateY(-1px); }
.card-press:active { transform: translateY(0) scale(0.995); transition-duration: 80ms; }

/* ---- Inputs ---- */
.field {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  color: #f1f5f9;
  padding: 9px 12px;
  font-size: 14px;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 200ms ease;
  width: 100%;
}
.field::placeholder { color: #64748b; }
.field:hover { border-color: rgba(255,255,255,0.1); }
.field:focus {
  outline: none;
  border-color: rgba(96,165,250,0.5);
  background: rgba(255,255,255,0.05);
  box-shadow: 0 0 0 4px rgba(96,165,250,0.12);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
  transition: all 180ms cubic-bezier(.16,1,.3,1);
  cursor: pointer;
}
.btn:active { transform: scale(0.97); transition-duration: 80ms; }
.btn-primary { background: #3b82f6; color: white; box-shadow: 0 4px 14px -4px rgba(59,130,246,0.5); }
.btn-primary:hover { background: #60a5fa; transform: translateY(-1px); box-shadow: 0 10px 22px -6px rgba(96,165,250,0.55); }
.btn-ghost { background: rgba(255,255,255,0.04); color: #cbd5e1; }
.btn-ghost:hover { background: rgba(255,255,255,0.08); color: white; }
.btn-danger { background: rgba(244,63,94,0.15); color: #fecaca; }
.btn-danger:hover { background: #f43f5e; color: white; transform: translateY(-1px); box-shadow: 0 10px 22px -6px rgba(244,63,94,0.5); }

/* ---- Kanban ---- */
.kanban-col {
  background: rgba(255,255,255,0.012);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 16px;
  padding: 12px;
  min-height: 55vh;
  display: flex;
  flex-direction: column;
  transition: background 220ms ease, border-color 220ms ease;
}
.kanban-col.drag-over {
  background: rgba(96,165,250,0.06);
  border-color: rgba(96,165,250,0.35);
}
.sortable-list {
  flex: 1;
  min-height: 100px;
}
.empty-col {
  pointer-events: none; /* don't block drops on sortable-list */
}

/* SortableJS visual hooks */
.sortable-ghost {
  opacity: 0.4;
  background: rgba(96,165,250,0.05);
  border-color: rgba(96,165,250,0.3) !important;
}
.sortable-ghost > * { opacity: 0.2; }
.sortable-chosen { cursor: grabbing !important; }
.sortable-drag {
  cursor: grabbing !important;
  transform: rotate(2deg) scale(1.03);
  box-shadow: 0 24px 60px -12px rgba(0,0,0,0.75),
              0 0 0 1px rgba(96,165,250,0.5) !important;
  border-color: rgba(96,165,250,0.6) !important;
  opacity: 1 !important;
}
body.dragging * { cursor: grabbing !important; user-select: none; }
body.dragging a, body.dragging .card-press { pointer-events: none; }

/* Cards that are draggable */
.task-card {
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.task-card:active { cursor: grabbing; }
.pinned-card {
  border-color: rgba(96,165,250,0.32);
  background-image: linear-gradient(180deg, rgba(96,165,250,0.05), rgba(255,255,255,0));
}

/* ---- Checkbox ---- */
.cbox {
  appearance: none;
  width: 18px; height: 18px;
  border: 1.5px solid rgba(148,163,184,0.4);
  border-radius: 6px;
  background: transparent;
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  transition: all 180ms cubic-bezier(.16,1,.3,1);
  flex-shrink: 0;
}
.cbox:hover { border-color: rgba(96,165,250,0.6); transform: scale(1.05); }
.cbox:checked {
  background: #3b82f6;
  border-color: #3b82f6;
  box-shadow: 0 0 0 4px rgba(59,130,246,0.15);
}
.cbox:checked::before {
  content: '';
  width: 10px; height: 10px;
  background: white;
  clip-path: polygon(15% 50%, 0 65%, 40% 100%, 100% 25%, 85% 10%, 40% 70%);
  animation: cbox-pop 240ms cubic-bezier(.16,1,.3,1);
}
@keyframes cbox-pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.is-done .strike { text-decoration: line-through; color: #64748b; }

/* ---- Status chip ---- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.chip::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 999px;
  background: currentColor;
}
.chip-todo        { background: rgba(148,163,184,0.12); color: #cbd5e1; }
.chip-in_progress { background: rgba(96,165,250,0.15);  color: #93c5fd; }
.chip-done        { background: rgba(74,222,128,0.12);  color: #86efac; }

/* ---- Entrance animations ---- */
.page-enter { animation: page-enter 380ms cubic-bezier(.16,1,.3,1) both; }
@keyframes page-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.stagger > * {
  opacity: 0; transform: translateY(8px);
  animation: stagger-in 420ms cubic-bezier(.16,1,.3,1) both;
}
.stagger > *:nth-child(1)  { animation-delay: 20ms; }
.stagger > *:nth-child(2)  { animation-delay: 50ms; }
.stagger > *:nth-child(3)  { animation-delay: 80ms; }
.stagger > *:nth-child(4)  { animation-delay: 110ms; }
.stagger > *:nth-child(5)  { animation-delay: 140ms; }
.stagger > *:nth-child(6)  { animation-delay: 170ms; }
.stagger > *:nth-child(7)  { animation-delay: 200ms; }
.stagger > *:nth-child(8)  { animation-delay: 230ms; }
.stagger > *:nth-child(n+9) { animation-delay: 260ms; }
@keyframes stagger-in { to { opacity: 1; transform: translateY(0); } }

/* ---- Misc ---- */
.tabular { font-variant-numeric: tabular-nums; }

/* Smoother focus rings */
:focus-visible { outline: none; }
button:focus-visible { box-shadow: 0 0 0 3px rgba(96,165,250,0.35); border-radius: 10px; }

/* Inline editor (used for new task in kanban) */
.inline-editor {
  background: #122a4f;
  border: 1px solid rgba(96,165,250,0.4);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 0 0 4px rgba(96,165,250,0.1);
  animation: inline-pop 220ms cubic-bezier(.16,1,.3,1);
}
@keyframes inline-pop {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.inline-editor textarea {
  width: 100%;
  background: transparent;
  border: 0;
  outline: none;
  color: white;
  font-size: 14px;
  font-weight: 500;
  resize: none;
  padding: 0;
}
.inline-editor textarea::placeholder { color: #64748b; }
.inline-editor-hint {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: #64748b;
}
.inline-editor kbd {
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: ui-monospace, monospace;
  font-size: 10px;
  color: #cbd5e1;
}

/* External link favicon */
.doc-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(96,165,250,0.18), rgba(59,130,246,0.05));
  display: grid; place-items: center;
  color: #93c5fd;
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

/* Tab underline */
.tab-track .tab-active {
  position: relative;
}
.tab-track .tab-active::after {
  content: '';
  position: absolute;
  left: 12px; right: 12px; bottom: -1px;
  height: 2px;
  background: #60a5fa;
  border-radius: 2px;
  animation: tab-in 280ms cubic-bezier(.16,1,.3,1) both;
}
@keyframes tab-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Subtle pulse for empty state */
.muted-pulse { color: #64748b; }

/* Hide spinner on number inputs */
input[type='number']::-webkit-outer-spin-button,
input[type='number']::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type='number'] { -moz-appearance: textfield; }

/* Date input nicer */
input[type='date']::-webkit-calendar-picker-indicator {
  filter: invert(0.55) sepia(0.4) saturate(2) hue-rotate(180deg);
  opacity: 0.6;
  cursor: pointer;
}
input[type='date']:hover::-webkit-calendar-picker-indicator { opacity: 1; }
