/* =========================================================
   TOKENS — colors, type, spacing
   ========================================================= */
:root {
  /* base surfaces */
  --bg-0: #0b0d16;          /* page background */
  --bg-1: #12162445;        /* unused fallback */
  --surface: #141826;        /* card background */
  --surface-raised: #1b2033; /* task rows */
  --surface-hover: #202744;  /* hover state */
  --border: #262c42;
  --border-soft: #1e2336;

  /* accents — blue → violet */
  --accent-1: #5b7cfa;   /* blue */
  --accent-2: #9b6bff;   /* violet */
  --accent-grad: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  --accent-glow: rgba(123, 108, 255, 0.35);

  /* text */
  --text-primary: #eef0fb;
  --text-secondary: #9aa1c2;
  --text-muted: #626a8c;

  /* status */
  --danger: #ff6b81;
  --success: #4ade80;

  /* type */
  --font-display: 'Sora', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* =========================================================
   RESET
   ========================================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 15% -10%, rgba(91, 124, 250, 0.16), transparent 45%),
    radial-gradient(circle at 90% 10%, rgba(155, 107, 255, 0.14), transparent 40%),
    var(--bg-0);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input {
  font-family: inherit;
  color: inherit;
}

ul {
  list-style: none;
}

/* =========================================================
   LAYOUT SHELL
   ========================================================= */
.app-shell {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 32px 28px 26px;
  box-shadow:
    0 30px 60px -25px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.02) inset;
}

/* =========================================================
   HEADER
   ========================================================= */
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.header-text h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
}

.date-line {
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.header-glyph {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--accent-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #fff;
  box-shadow: 0 10px 24px -8px var(--accent-glow);
  flex-shrink: 0;
}

/* =========================================================
   STATS
   ========================================================= */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.stat {
  background: var(--surface-raised);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 12px 8px;
  text-align: center;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}

.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* =========================================================
   ADD TASK FORM
   ========================================================= */
.task-form {
  display: flex;
  gap: 10px;
  margin-bottom: 6px;
}

.input-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

#task-input {
  width: 100%;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px 13px 38px;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}

#task-input::placeholder {
  color: var(--text-muted);
}

#task-input:focus {
  border-color: var(--accent-1);
  background: var(--surface-hover);
  box-shadow: 0 0 0 4px rgba(91, 124, 250, 0.16);
}

.add-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-grad);
  color: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0 18px;
  border-radius: 12px;
  white-space: nowrap;
  box-shadow: 0 10px 20px -10px var(--accent-glow);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), filter 0.18s var(--ease);
}

.add-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px -10px var(--accent-glow);
  filter: brightness(1.06);
}

.add-btn:active {
  transform: translateY(0);
}

.add-btn span {
  display: inline;
}

.input-error {
  min-height: 18px;
  font-size: 0.78rem;
  color: var(--danger);
  margin: 6px 2px 14px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.input-error.show {
  opacity: 1;
  transform: translateY(0);
}

/* =========================================================
   FILTERS
   ========================================================= */
.filters {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
}

.filter-btn {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: all 0.2s var(--ease);
}

.filter-btn:hover {
  color: var(--text-primary);
  background: var(--surface-raised);
}

.filter-btn.is-active {
  color: #fff;
  background: var(--accent-grad);
  box-shadow: 0 6px 16px -8px var(--accent-glow);
}

.clear-btn {
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

.clear-btn:hover {
  color: var(--danger);
  background: rgba(255, 107, 129, 0.1);
}

/* =========================================================
   TASK LIST
   ========================================================= */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-raised);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 12px 12px 12px 14px;
  animation: task-in 0.28s var(--ease);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.task-item:hover {
  background: var(--surface-hover);
  border-color: var(--border);
}

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

@keyframes task-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes task-out {
  to {
    opacity: 0;
    transform: translateX(12px) scale(0.96);
    margin-top: -46px;
    padding-top: 0;
    padding-bottom: 0;
  }
}

/* custom checkbox */
.task-check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1.5px solid var(--border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: 0.7rem;
  transition: all 0.18s var(--ease);
}

.task-check:hover {
  border-color: var(--accent-1);
}

.task-item.completed .task-check {
  background: var(--accent-grad);
  border-color: transparent;
  color: #fff;
}

.task-text {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  word-break: break-word;
  transition: color 0.2s var(--ease);
}

.task-item.completed .task-text {
  text-decoration: line-through;
  text-decoration-color: var(--text-muted);
  color: var(--text-muted);
}

.task-delete {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  opacity: 0.7;
  transition: all 0.18s var(--ease);
}

.task-delete:hover {
  color: var(--danger);
  background: rgba(255, 107, 129, 0.12);
  opacity: 1;
}

/* =========================================================
   EMPTY STATE
   ========================================================= */
.empty-state {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 36px 10px 8px;
  color: var(--text-muted);
}

.empty-state.show {
  display: flex;
}

.empty-icon {
  font-size: 1.8rem;
  margin-bottom: 10px;
  color: var(--accent-1);
  opacity: 0.7;
}

.empty-state p {
  font-size: 0.88rem;
}

/* =========================================================
   FOOTER
   ========================================================= */
.footer-note {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 420px) {
  .card {
    padding: 24px 18px 20px;
    border-radius: 18px;
  }

  .header-text h1 {
    font-size: 1.35rem;
  }

  .add-btn span {
    display: none;
  }

  .add-btn {
    padding: 0 14px;
  }
}

@media (min-width: 640px) {
  .app-shell {
    max-width: 520px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}
