/* =========================================================
   Kanban Board — Design tokens
========================================================= */
:root {
  --bg-1: #F8FAFC;
  --bg-2: #EEF2FF;

  --ink-900: #0F172A;
  --ink-700: #334155;
  --ink-500: #64748B;
  --ink-300: #CBD5E1;

  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #FFFFFF;
  --border-soft: rgba(15, 23, 42, 0.06);

  --todo: #6366F1;
  --todo-soft: #EEF2FF;
  --doing: #F59E0B;
  --doing-soft: #FFFBEB;
  --done: #10B981;
  --done-soft: #ECFDF5;

  --danger: #EF4444;

  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 10px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, 0.18);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

body {
  font-family: var(--font-display);
  color: var(--ink-900);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(99, 102, 241, 0.10), transparent),
    radial-gradient(900px 500px at 100% 0%, rgba(16, 185, 129, 0.08), transparent),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* Keyboard focus visibility */
button:focus-visible,
input:focus-visible,
.task-card:focus-visible {
  outline: 2px solid var(--todo);
  outline-offset: 2px;
}

/* =========================================================
   Header
========================================================= */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(20px, 5vw, 56px);
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(248, 250, 252, 0.7);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--border-soft);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-logo {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--surface-solid);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-soft);
}

.header-text h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.header-text p {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--ink-500);
  font-weight: 500;
}

.current-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-700);
  background: var(--surface-solid);
  border: 1px solid var(--border-soft);
  padding: 8px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

/* =========================================================
   Board layout
========================================================= */
.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(300px, 1fr));
  gap: 20px;
  padding: 28px clamp(20px, 5vw, 56px) 60px;
  align-items: start;
}

@media (max-width: 1000px) {
  .board {
    grid-template-columns: repeat(3, minmax(300px, 320px));
    overflow-x: auto;
    padding-bottom: 40px;
  }
}

@media (max-width: 620px) {
  .board {
    grid-template-columns: 1fr;
    overflow-x: visible;
  }
}

/* =========================================================
   Column
========================================================= */
.column {
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 200px;
  transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease), background 0.25s var(--ease);
}

.column.drag-over {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.column[data-status="todo"].drag-over { background: var(--todo-soft); }
.column[data-status="doing"].drag-over { background: var(--doing-soft); }
.column[data-status="done"].drag-over { background: var(--done-soft); }

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.column-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.column-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.column-header--todo .column-dot { background: var(--todo); }
.column-header--doing .column-dot { background: var(--doing); }
.column-header--done .column-dot { background: var(--done); }

.column-header h2 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.task-counter {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--ink-500);
  background: rgba(15, 23, 42, 0.05);
}

.add-task-btn {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: var(--surface-solid);
  color: var(--ink-700);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s var(--ease), background 0.15s var(--ease), color 0.15s var(--ease);
}
.add-task-btn:hover {
  transform: scale(1.08);
}
.column-header--todo .add-task-btn:hover { background: var(--todo); color: white; }
.column-header--doing .add-task-btn:hover { background: var(--doing); color: white; }
.column-header--done .add-task-btn:hover { background: var(--done); color: white; }
.add-task-btn:active { transform: scale(0.95); }

/* =========================================================
   Task list / scroll area
========================================================= */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 80px;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  padding: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-300) transparent;
}
.task-list::-webkit-scrollbar { width: 6px; }
.task-list::-webkit-scrollbar-thumb { background: var(--ink-300); border-radius: 10px; }

/* Placeholder shown while dragging to mark drop position */
.drop-placeholder {
  height: 10px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.18);
  border: 1.5px dashed rgba(99, 102, 241, 0.5);
  transition: height 0.15s var(--ease);
}

/* =========================================================
   Empty state
========================================================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 34px 10px;
  color: var(--ink-500);
  text-align: center;
}
.empty-state .emoji {
  font-size: 1.8rem;
  filter: grayscale(20%);
}
.empty-state span.label {
  font-size: 0.84rem;
  font-weight: 600;
}

/* =========================================================
   Task card
========================================================= */
.task-card {
  background: var(--surface-solid);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 14px 14px 12px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), opacity 0.18s var(--ease);
  animation: cardIn 0.28s var(--ease);
  border-left: 3px solid transparent;
}
.column[data-status="todo"] .task-card { border-left-color: var(--todo); }
.column[data-status="doing"] .task-card { border-left-color: var(--doing); }
.column[data-status="done"] .task-card { border-left-color: var(--done); }

.task-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.task-card.dragging {
  opacity: 0.55;
  transform: rotate(-2deg) scale(1.02);
  box-shadow: var(--shadow-lg);
  cursor: grabbing;
}

.task-card.removing {
  animation: cardOut 0.22s var(--ease) forwards;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes cardOut {
  from { opacity: 1; transform: scale(1); height: auto; }
  to { opacity: 0; transform: scale(0.9); }
}

.task-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.task-title {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink-900);
  word-break: break-word;
}

.task-delete-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--ink-300);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease), transform 0.15s var(--ease);
}
.task-delete-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  transform: scale(1.08);
}

.task-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-500);
}

/* =========================================================
   Buttons (shared)
========================================================= */
.btn {
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), opacity 0.15s var(--ease);
}
.btn:hover { transform: scale(1.03); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  color: white;
  background: linear-gradient(135deg, #6366F1, #4F46E5);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}
.btn-primary:hover { box-shadow: 0 8px 20px rgba(79, 70, 229, 0.4); }

.btn-danger {
  color: white;
  background: linear-gradient(135deg, #F87171, #EF4444);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3);
}

.btn-ghost {
  color: var(--ink-700);
  background: rgba(15, 23, 42, 0.05);
}
.btn-ghost:hover { background: rgba(15, 23, 42, 0.09); }

/* =========================================================
   Modal
========================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s var(--ease);
  padding: 20px;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--surface-solid);
  border-radius: var(--radius-lg);
  padding: 26px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  transform: translateY(14px) scale(0.97);
  opacity: 0;
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}
.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.modal-subtitle {
  margin: 0 0 16px;
  font-size: 0.84rem;
  color: var(--ink-500);
}

.modal input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border-soft);
  font-family: var(--font-display);
  font-size: 0.92rem;
  background: #F8FAFC;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.modal input[type="text"]:focus {
  outline: none;
  border-color: var(--todo);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}
.modal input.error {
  border-color: var(--danger);
}

.input-error {
  display: none;
  color: var(--danger);
  font-size: 0.76rem;
  margin-top: 6px;
  font-weight: 500;
}
.input-error.visible { display: block; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* =========================================================
   Toasts
========================================================= */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.toast {
  background: var(--ink-900);
  color: white;
  font-size: 0.84rem;
  font-weight: 500;
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s var(--ease);
  max-width: 300px;
}
.toast.leaving {
  animation: toastOut 0.25s var(--ease) forwards;
}
.toast .toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--todo);
  flex-shrink: 0;
}
.toast.success .toast-dot { background: var(--done); }
.toast.danger .toast-dot { background: var(--danger); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(10px); }
}

/* =========================================================
   Reduced motion
========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* Mobile refinements */
@media (max-width: 620px) {
  .app-header { padding: 18px 16px; }
  .header-text h1 { font-size: 1.15rem; }
  .current-date { display: none; }
  .task-list { max-height: none; }
}
