* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 16px;
  background: #f2f4f7;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #1f2937;
}

.app {
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

h1 {
  margin: 0 0 20px;
  font-size: 1.5rem;
  text-align: center;
}

.task-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.task-form input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
}

.task-form button {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: #4f46e5;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}

.task-form button:hover {
  background: #4338ca;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.filter-btn {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #ffffff;
  color: #4b5563;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.filter-btn:hover {
  background: #eef2ff;
}

.filter-btn.active {
  border-color: #4f46e5;
  background: #4f46e5;
  color: #ffffff;
}

.filter-btn.active:hover {
  border-color: #4338ca;
  background: #4338ca;
}

.filter-btn:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

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

.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.task-item span {
  flex: 1;
  word-break: break-word;
}

.task-item .delete-btn {
  border: none;
  background: transparent;
  color: #ef4444;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}

.task-item .delete-btn:hover {
  color: #b91c1c;
}

.empty-state {
  text-align: center;
  color: #9ca3af;
  padding: 16px 0;
  font-size: 0.9rem;
}

/*
  TODO (Fitur #1 - Tandai Selesai):
  Tambahkan style untuk task yang sudah selesai, misalnya class ".completed"
  pada .task-item yang membuat teksnya dicoret (text-decoration: line-through)
  dan warnanya lebih pudar.
*/
.task-item.completed .task-text {
  text-decoration: line-through;
  color: #9ca3af;
}

/*
  TODO (Fitur #2 - Edit Task):
  Tambahkan style untuk mode edit, misalnya input text yang muncul
  menggantikan <span> saat task sedang diedit.
*/

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
  color: #6b7280;
  font-size: 0.9rem;
}

#clear-completed {
  margin-left: auto;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #ffffff;
  color: #4b5563;
  font: inherit;
  cursor: pointer;
}

#clear-completed:hover {
  background: #f2f4f7;
}

#clear-completed:focus-visible {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
}

.task-item .edit-input {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid #4338ca;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
}

.edit-btn {
  border: none;
  background: transparent;
  color: blue;
  font-size: 0.9rem;
  cursor: pointer;
  line-height: 1;
}

.task-item {
  border: none;
  background: transparent;
  color: black;
  font-size: 0.9rem;
  cursor: pointer;
  line-height: 1;
}

.task-item .edit-btn:hover {
  color: #e5e7eb;
}
