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

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

body {
  font-family: 'Fredoka', Arial, sans-serif;
  background-color: #ffe8d6;
  background-image: radial-gradient(#ffb5a7 1.5px, transparent 1.5px), radial-gradient(#ffb5a7 1.5px, transparent 1.5px);
  background-size: 30px 30px;
  background-position: 0 0, 15px 15px;
  display: flex;
  justify-content: center;
  padding: 40px 20px;
  min-height: 100vh;
}

.container {
  background: #fffcf9;
  max-width: 550px;
  width: 100%;
  border-radius: 30px;
  padding: 0 0 25px;
  box-shadow: 0 8px 0 #e56b6f, 0 12px 30px rgba(0,0,0,0.15);
  border: 3px solid #e56b6f;
  position: relative;
  overflow: hidden;
}

.container::before {
  content: '';
  display: block;
  height: 6px;
  background: linear-gradient(90deg, #ffd166, #6bcb77, #4d96ff, #e56b6f);
}

h1 {
  text-align: center;
  color: #fff0e6;
  margin-bottom: 0;
  font-size: 30px;
  font-weight: 700;
  padding: 18px 25px 18px;
  background: #e56b6f;
  border-bottom: 4px solid #c1121f;
  text-shadow: 3px 3px 0 #b56576;
  letter-spacing: 2px;
}

.input-area, .stats, .cat-filters, .todo-list {
  padding-left: 22px;
  padding-right: 22px;
}

.input-area {
  padding-top: 22px;
}

.todo-list {
  padding-bottom: 5px;
}

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

.input-area input {
  flex: 1;
  min-width: 180px;
  padding: 14px 18px;
  border: 3px solid #f0d5c9;
  border-radius: 16px;
  font-size: 15px;
  outline: none;
  font-family: 'Fredoka', Arial, sans-serif;
  background: #fffaf5;
  transition: all 0.2s;
}

.input-area input:focus {
  border-color: #e56b6f;
  background: white;
}

.input-area select {
  padding: 14px 16px;
  border: 3px solid #f0d5c9;
  border-radius: 16px;
  font-size: 14px;
  outline: none;
  background: #fffaf5;
  cursor: pointer;
  font-family: 'Fredoka', Arial, sans-serif;
  font-weight: 500;
  transition: all 0.2s;
  flex: 0 1 auto;
}

.input-area select:focus {
  border-color: #e56b6f;
  background: white;
}

.input-area button {
  padding: 14px 24px;
  background: #ffd166;
  color: #6d4c2a;
  border: 3px solid #e6a817;
  border-radius: 16px;
  font-size: 16px;
  cursor: pointer;
  font-weight: 700;
  font-family: 'Fredoka', Arial, sans-serif;
  transition: all 0.15s;
  box-shadow: 0 4px 0 #e6a817;
  flex: 0 0 auto;
}

.input-area button:active {
  transform: translateY(4px);
  box-shadow: 0 0px 0 #e6a817;
}

.input-area button:hover {
  background: #ffd93d;
}

.stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 15px;
  color: #b07d62;
  font-weight: 500;
  background: #fdf4ed;
  padding-top: 10px;
  padding-bottom: 10px;
  border-radius: 16px;
  margin-left: 22px;
  margin-right: 22px;
}

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

.filters button {
  padding: 6px 14px;
  border: 2px solid #f0d5c9;
  background: #fffaf5;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Fredoka', Arial, sans-serif;
  color: #b07d62;
  transition: all 0.2s;
}

.filters button:hover {
  background: #ffe8d6;
  border-color: #d4a373;
}

.filters button.active {
  background: #6bcb77;
  color: white;
  border-color: #4caf50;
  box-shadow: 0 2px 0 #4caf50;
}

.filters button.active:active {
  transform: translateY(2px);
  box-shadow: 0 0px 0 #4caf50;
}

.cat-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.cat-filters button {
  padding: 5px 14px;
  border: 2px solid #f0d5c9;
  background: #fffaf5;
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: 'Fredoka', Arial, sans-serif;
  color: #b07d62;
  transition: all 0.2s;
}

.cat-filters button:hover {
  transform: scale(1.08);
}

.cat-filters button.active {
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 0 rgba(0,0,0,0.2);
  transform: scale(1.05);
}

.cat-filters button.cat-work { color: #4d96ff; border-color: #4d96ff; }
.cat-filters button.cat-work.active { background: #4d96ff; color: white; }

.cat-filters button.cat-personal { color: #6bcb77; border-color: #6bcb77; }
.cat-filters button.cat-personal.active { background: #6bcb77; color: white; }

.cat-filters button.cat-shopping { color: #f77f00; border-color: #f77f00; }
.cat-filters button.cat-shopping.active { background: #f77f00; color: white; }

.cat-filters button.cat-health { color: #e56b6f; border-color: #e56b6f; }
.cat-filters button.cat-health.active { background: #e56b6f; color: white; }

.todo-list {
  list-style: none;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border: 3px solid #f0d5c9;
  border-radius: 18px;
  margin-bottom: 10px;
  transition: all 0.2s;
  background: #fffaf5;
  position: relative;
}

.todo-item:hover {
  border-color: #d4a373;
  background: white;
  transform: rotate(0.5deg);
}

.todo-item input[type="checkbox"] {
  width: 24px;
  height: 24px;
  cursor: pointer;
  accent-color: #6bcb77;
  flex-shrink: 0;
}

.category-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 2px solid transparent;
}

.category-badge.work {
  background: #e8f0fe;
  color: #4d96ff;
  border-color: #4d96ff;
}

.category-badge.personal {
  background: #e6fce9;
  color: #6bcb77;
  border-color: #6bcb77;
}

.category-badge.shopping {
  background: #fff3e0;
  color: #f77f00;
  border-color: #f77f00;
}

.category-badge.health {
  background: #fce4e4;
  color: #e56b6f;
  border-color: #e56b6f;
}

.todo-item .task-text {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  word-break: break-word;
  color: #5c4a3a;
}

.todo-item .edit-input {
  flex: 1;
  padding: 8px 12px;
  border: 3px solid #e56b6f;
  border-radius: 12px;
  font-size: 15px;
  outline: none;
  font-family: 'Fredoka', Arial, sans-serif;
  background: white;
}

.todo-item .task-text.completed {
  text-decoration: line-through;
  color: #d4a373;
}

.todo-item:has(.task-text.completed) {
  background: #fdf8f4;
  border-color: #e8ddd0;
}

.task-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.edit-btn, .delete-btn {
  border: 2px solid transparent;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Fredoka', Arial, sans-serif;
  transition: all 0.2s;
}

.edit-btn {
  color: #4d96ff;
  background: #e8f0fe;
  border-color: #4d96ff;
}

.edit-btn:hover {
  background: #4d96ff;
  color: white;
  transform: scale(1.08);
}

.delete-btn {
  color: #e56b6f;
  background: #fce4e4;
  border-color: #e56b6f;
}

.delete-btn:hover {
  background: #e56b6f;
  color: white;
  transform: scale(1.08);
}

.save-btn {
  padding: 8px 18px;
  background: #ffd166;
  color: #6d4c2a;
  border: 3px solid #e6a817;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Fredoka', Arial, sans-serif;
  transition: all 0.15s;
  box-shadow: 0 3px 0 #e6a817;
}

.save-btn:active {
  transform: translateY(3px);
  box-shadow: 0 0px 0 #e6a817;
}

.empty-msg {
  text-align: center;
  color: #d4a373;
  padding: 50px 0;
  font-size: 17px;
  font-weight: 500;
}

@media (max-width: 600px) {
  body {
    padding: 0;
  }

  .container {
    border-radius: 0;
    min-height: 100vh;
    border-left: none;
    border-right: none;
  }

  h1 {
    font-size: 24px;
    padding: 18px 20px 14px;
  }

  .input-area, .stats, .cat-filters, .todo-list {
    padding-left: 16px;
    padding-right: 16px;
  }

  .stats {
    margin-left: 16px;
    margin-right: 16px;
    padding-top: 8px;
    padding-bottom: 8px;
    flex-direction: column;
    gap: 6px;
  }
}

@media (max-width: 400px) {
  h1 {
    font-size: 20px;
    padding: 14px 14px 12px;
  }

  .input-area {
    flex-direction: column;
  }

  .input-area input {
    min-width: 100%;
  }

  .input-area button {
    width: 100%;
  }

  .cat-filters {
    justify-content: center;
  }

  .todo-item {
    flex-wrap: wrap;
  }

  .task-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
