/* =====================================================================
   Smart Task Manager — styles
   Dark futuristic theme · glassmorphism · cyan / violet / amber accents
   No external CSS dependencies (Google Fonts loaded in HTML only).
   ===================================================================== */

/* ----------------------- Design tokens ----------------------- */
:root {
  --bg: #050810;
  --bg-soft: #0a0f1e;
  --panel: rgba(17, 24, 42, 0.55);       /* glassmorphism surface */
  --panel-solid: #0f1626;
  --panel-border: rgba(124, 197, 255, 0.14);
  --panel-border-strong: rgba(124, 197, 255, 0.32);

  --text: #e7eefc;
  --text-dim: #9fb0cc;
  --text-faint: #6b7a99;

  --cyan: #00d4ff;
  --violet: #7c3aed;
  --amber: #fbbf24;
  --green: #34d399;
  --red: #f43f5e;
  --orange: #fb923c;
  --gray: #94a3b8;

  --p-critical: #f43f5e;
  --p-high: #fb923c;
  --p-medium: #00d4ff;
  --p-low: #94a3b8;

  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.75);
  --glow-cyan: 0 0 0 1px rgba(0, 212, 255, 0.35), 0 8px 30px -8px rgba(0, 212, 255, 0.45);

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

/* ----------------------- Reset ----------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select, button { font-family: inherit; color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ----------------------- Background decor ----------------------- */
.bg-glow {
  position: fixed;
  z-index: -2;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.5;
  pointer-events: none;
}
.bg-glow-1 {
  width: 520px; height: 520px;
  top: -180px; left: -120px;
  background: radial-gradient(circle, #0a4d6e, transparent 70%);
}
.bg-glow-2 {
  width: 600px; height: 600px;
  bottom: -240px; right: -160px;
  background: radial-gradient(circle, #4c1d95, transparent 70%);
  animation: drift 18s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate(0, 0); }
  to   { transform: translate(-40px, -30px); }
}

.bg-grid {
  position: fixed; inset: 0; z-index: -1;
  background-image:
    linear-gradient(rgba(124, 197, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 197, 255, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 35%, transparent 80%);
  pointer-events: none;
}

/* ----------------------- Header ----------------------- */
.app-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 18px 28px;
  background: linear-gradient(180deg, rgba(5, 8, 16, 0.92), rgba(5, 8, 16, 0.55));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--panel-border);
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: var(--cyan);
  background: radial-gradient(circle at 30% 30%, rgba(0, 212, 255, 0.22), rgba(124, 58, 237, 0.18));
  border: 1px solid var(--panel-border-strong);
  box-shadow: var(--glow-cyan);
}
.brand-text h1 {
  font-size: 1.18rem;
  background: linear-gradient(90deg, #fff, var(--cyan) 70%, var(--violet));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-sub {
  margin: 2px 0 0; font-size: 0.74rem; color: var(--text-faint);
  font-family: var(--font-mono); letter-spacing: 0.02em;
}

.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ----------------------- Buttons ----------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px;
  font-size: 0.86rem; font-weight: 600;
  border: 1px solid transparent;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn svg { opacity: 0.9; }

.btn-primary {
  color: #04121a;
  background: linear-gradient(135deg, var(--cyan), #36e0ff);
  box-shadow: 0 8px 24px -10px rgba(0, 212, 255, 0.8);
}
.btn-primary:hover { box-shadow: 0 10px 30px -8px rgba(0, 212, 255, 0.9); transform: translateY(-1px); }

.btn-ghost {
  color: var(--text-dim);
  background: var(--panel);
  border-color: var(--panel-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.btn-ghost:hover { color: var(--text); border-color: var(--panel-border-strong); background: rgba(17, 24, 42, 0.75); }

.icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--text-dim);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { color: var(--text); background: rgba(124, 197, 255, 0.08); border-color: var(--panel-border); }

/* ----------------------- Filters bar ----------------------- */
.filters {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 16px 28px;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(8, 12, 24, 0.5);
}

.filter-search {
  flex: 1 1 260px; min-width: 220px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  height: 42px;
  border-radius: 11px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
}
.filter-search:focus-within { border-color: var(--panel-border-strong); color: var(--cyan); box-shadow: var(--glow-cyan); }
.filter-search input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 0.9rem; color: var(--text);
}
.filter-search input::placeholder { color: var(--text-faint); }

.filter-group select {
  height: 42px; padding: 0 36px 0 14px;
  border-radius: 11px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--text);
  font-size: 0.86rem;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239fb0cc' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.filter-group select:focus { outline: none; border-color: var(--panel-border-strong); box-shadow: var(--glow-cyan); }
.filter-group select option { background: var(--panel-solid); color: var(--text); }

.toggle {
  display: inline-flex; align-items: center; gap: 10px;
  user-select: none; cursor: pointer;
  font-size: 0.84rem; color: var(--text-dim);
  padding: 0 4px;
}
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track {
  width: 42px; height: 24px; border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  border: 1px solid var(--panel-border);
  position: relative; transition: background 0.2s ease, border-color 0.2s ease;
}
.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--text-dim);
  transition: transform 0.2s ease, background 0.2s ease;
}
.toggle input:checked + .toggle-track {
  background: rgba(0, 212, 255, 0.22);
  border-color: var(--cyan);
}
.toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(18px);
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}

.filter-stats {
  margin-left: auto;
  font-size: 0.78rem; color: var(--text-faint);
  font-family: var(--font-mono);
}

/* ----------------------- Board ----------------------- */
.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  gap: 18px;
  padding: 22px 28px 60px;
  align-items: start;
}

.column {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  min-height: 220px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.column.is-drag-over {
  border-color: var(--cyan);
  box-shadow: var(--glow-cyan), var(--shadow);
  background: rgba(0, 212, 255, 0.04);
}

.column-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--panel-border);
}
.column-head h2 { font-size: 0.92rem; font-weight: 700; letter-spacing: 0.01em; }
.column-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot-backlog { background: var(--gray); box-shadow: 0 0 8px var(--gray); }
.dot-progress { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.dot-review { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.dot-done { background: var(--green); box-shadow: 0 0 8px var(--green); }

.column-count {
  margin-left: auto;
  min-width: 24px; height: 22px; padding: 0 8px;
  display: inline-grid; place-items: center;
  font-size: 0.74rem; font-weight: 700; font-family: var(--font-mono);
  color: var(--text-dim);
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
}

.column-body {
  flex: 1;
  padding: 12px;
  display: flex; flex-direction: column; gap: 12px;
  min-height: 80px;
}

/* Empty column placeholder */
.column-body:empty::before,
.column-body:has(> .empty-placeholder:only-child)::before { content: none; }

.empty-placeholder {
  border: 1.5px dashed rgba(148, 163, 184, 0.28);
  border-radius: var(--radius);
  color: var(--text-faint);
  font-size: 0.8rem;
  text-align: center;
  padding: 26px 12px;
  margin: 2px;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.column.is-drag-over .empty-placeholder {
  border-color: var(--cyan); color: var(--cyan);
  background: rgba(0, 212, 255, 0.05);
}

/* ----------------------- Task card ----------------------- */
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(20, 28, 48, 0.9), rgba(14, 20, 36, 0.9));
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 13px 14px 12px 18px;
  box-shadow: 0 10px 24px -18px rgba(0, 0, 0, 0.8);
  cursor: grab;
  transition: transform 0.14s ease, box-shadow 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  animation: card-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(6px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.card:hover { transform: translateY(-2px); border-color: var(--panel-border-strong); box-shadow: 0 16px 30px -18px rgba(0, 0, 0, 0.9); }
.card:active { cursor: grabbing; }

/* Priority color stripe on the left */
.card::before {
  content: "";
  position: absolute; top: 10px; bottom: 10px; left: 6px;
  width: 4px; border-radius: 4px;
  background: var(--card-priority, var(--gray));
  box-shadow: 0 0 10px var(--card-priority, var(--gray));
}
.card[data-priority="critical"] { --card-priority: var(--p-critical); }
.card[data-priority="high"]     { --card-priority: var(--p-high); }
.card[data-priority="medium"]   { --card-priority: var(--p-medium); }
.card[data-priority="low"]      { --card-priority: var(--p-low); }

.card.is-dragging { opacity: 0.4; transform: scale(0.98) rotate(-1deg); }
.card.is-done .card-title { text-decoration: line-through; color: var(--text-faint); }

.card-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  margin-bottom: 4px;
}
.card-title {
  font-size: 0.92rem; font-weight: 600; line-height: 1.3;
  word-break: break-word;
}
.card-actions { display: flex; gap: 2px; flex-shrink: 0; }
.card-actions .icon-btn { width: 26px; height: 26px; }
.card-actions .icon-btn svg { width: 14px; height: 14px; }
.card-actions .icon-btn.done:hover { color: var(--green); }
.card-actions .icon-btn.edit:hover { color: var(--cyan); }
.card-actions .icon-btn.del:hover  { color: var(--red); }

.card-desc {
  margin: 4px 0 10px;
  font-size: 0.8rem; color: var(--text-dim); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 9px; }
.tag {
  font-size: 0.68rem; font-weight: 600; font-family: var(--font-mono);
  padding: 2px 8px; border-radius: 999px;
  color: var(--cyan);
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.2);
}
.tag:nth-child(2n) { color: var(--violet); background: rgba(124, 58, 237, 0.1); border-color: rgba(124, 58, 237, 0.25); }
.tag:nth-child(3n) { color: var(--amber); background: rgba(251, 191, 36, 0.08); border-color: rgba(251, 191, 36, 0.22); }

.card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
}
.deadline {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.72rem; font-weight: 600;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.deadline svg { width: 12px; height: 12px; }
.deadline.overdue { color: var(--red); }
.deadline.due-soon { color: var(--amber); }
.deadline.done { color: var(--green); }

.priority-badge {
  font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 2px 7px; border-radius: 6px;
  color: var(--card-priority);
  background: color-mix(in srgb, var(--card-priority) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--card-priority) 35%, transparent);
}
.card-created {
  font-size: 0.66rem; color: var(--text-faint); font-family: var(--font-mono);
}

/* ----------------------- Modal ----------------------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 20px;
  background: rgba(3, 6, 14, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in 0.2s ease;
}
.modal-overlay[hidden] { display: none; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: min(560px, 100%);
  background: var(--panel-solid);
  border: 1px solid var(--panel-border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), 0 0 60px -20px rgba(0, 212, 255, 0.4);
  overflow: hidden;
  animation: pop-in 0.24s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--panel-border);
}
.modal-head h3 { font-size: 1.05rem; }

.modal-form { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 0.78rem; font-weight: 600; color: var(--text-dim); }
.field-hint { font-weight: 400; color: var(--text-faint); }

.field input[type="text"],
.field input[type="date"],
.field textarea,
.field select {
  width: 100%;
  background: rgba(8, 12, 24, 0.8);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 0.9rem;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: var(--glow-cyan);
}
.field input[type="date"] { color-scheme: dark; }
.field textarea { resize: vertical; min-height: 64px; }
.field input::placeholder, .field textarea::placeholder { color: var(--text-faint); }
.field input:invalid:not(:placeholder-shown) { border-color: var(--red); }

.field-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
}

/* Priority picker chips */
.priority-picker { display: flex; flex-wrap: wrap; gap: 7px; }
.priority-chip {
  padding: 7px 12px;
  font-size: 0.76rem; font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(8, 12, 24, 0.6);
  color: var(--text-dim);
  transition: all 0.15s ease;
}
.priority-chip:hover { color: var(--text); }
.priority-chip.is-active { color: #fff; border-color: transparent; }
.priority-chip.chip-critical.is-active { background: var(--p-critical); box-shadow: 0 0 14px -2px var(--p-critical); }
.priority-chip.chip-high.is-active     { background: var(--p-high);     box-shadow: 0 0 14px -2px var(--p-high); }
.priority-chip.chip-medium.is-active   { background: var(--p-medium);   color: #04121a; box-shadow: 0 0 14px -2px var(--p-medium); }
.priority-chip.chip-low.is-active      { background: var(--p-low);      color: #04121a; box-shadow: 0 0 14px -2px var(--p-low); }

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

/* ----------------------- Toasts ----------------------- */
.toast-stack {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 220px; max-width: 340px;
  padding: 12px 16px;
  border-radius: 11px;
  background: var(--panel-solid);
  border: 1px solid var(--panel-border-strong);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  display: flex; align-items: center; gap: 10px;
  animation: toast-in 0.25s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
.toast.is-leaving { animation: toast-out 0.25s ease forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(20px); } }
.toast .toast-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.toast.success .toast-dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.toast.error   .toast-dot { background: var(--red);   box-shadow: 0 0 8px var(--red); }
.toast.info    .toast-dot { background: var(--cyan);  box-shadow: 0 0 8px var(--cyan); }

/* ----------------------- Drop animation (reorder) ----------------------- */
.card.drop-pulse { animation: drop-pulse 0.32s ease; }
@keyframes drop-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.5); }
  100% { box-shadow: 0 0 0 14px rgba(0, 212, 255, 0); }
}

/* ----------------------- Responsive ----------------------- */
@media (max-width: 1100px) {
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .app-header { padding: 14px 16px; }
  .brand-text h1 { font-size: 1.04rem; }
  .brand-sub { display: none; }
  .filters { padding: 12px 16px; gap: 10px; }
  .filter-stats { width: 100%; margin-left: 0; }
  .board {
    grid-template-columns: 1fr;   /* stack vertically on mobile */
    padding: 16px;
    gap: 14px;
  }
  .header-actions .btn span { display: inline; }
  .field-row { grid-template-columns: 1fr; }
  .modal-form { padding: 16px; }
}

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