@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1d2433;
  --muted: #6b7280;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --border: #e5e7eb;
  --success: #22c55e;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: linear-gradient(140deg, #f5f7fb 0%, #eef1ff 100%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.app {
  width: min(960px, 100%);
  background: var(--card);
  border-radius: 24px;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.1);
  padding: 36px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

header h1 {
  margin: 4px 0 0;
  font-size: clamp(1.8rem, 2.2vw + 1rem, 2.6rem);
}

.eyebrow {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
}

.stats {
  display: flex;
  gap: 16px;
}

.stats div {
  background: #f3f4ff;
  padding: 12px 18px;
  border-radius: 16px;
  text-align: center;
}

.stats span {
  display: block;
  font-size: 1.3rem;
  font-weight: 700;
}

#todo-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

#todo-input {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  font-size: 1rem;
  outline: none;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

#todo-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

#todo-form button {
  border: none;
  background: var(--primary);
  color: white;
  padding: 0 24px;
  border-radius: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

#todo-form button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.filters {
  display: flex;
  gap: 8px;
}

.filter {
  border: 1px solid transparent;
  background: #f8fafc;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.filter.active {
  background: var(--primary);
  color: white;
}

.ghost {
  background: transparent;
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
}

.todo-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.todo-item {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  background: #fff;
  transition: box-shadow 0.2s ease, border 0.2s ease;
}

.todo-item:hover {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 8px 16px rgba(99, 102, 241, 0.08);
}

.checkbox {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.checkbox input {
  opacity: 0;
  position: absolute;
}

.checkmark {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.checkbox input:checked + .checkmark {
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.15);
}

.checkbox input:checked + .checkmark::after {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--success);
  border-bottom: 2px solid var(--success);
  transform: rotate(-45deg);
}

.content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.title {
  margin: 0;
  font-weight: 600;
  font-size: 1rem;
  outline: none;
}

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

.meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.actions {
  display: flex;
  gap: 8px;
}

.delete {
  border: none;
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  padding: 6px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 32px;
  border: 1px dashed var(--border);
  border-radius: 18px;
}

@media (max-width: 700px) {
  .app {
    padding: 24px;
  }

  #todo-form {
    grid-template-columns: 1fr;
  }

  .todo-item {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
  }

  .actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}
