* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 60px 20px;
  font-family: Arial, sans-serif;
  background: #f5f5f5;
  color: #1f1f1f;
}

.todo-container {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 36px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 14px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05);
}

h1 {
  margin: 0 0 10px;
  text-align: center;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

#stateMessage {
  margin: 22px 0 0;
  text-align: center;
  color: #777;
  font-size: 14px;
}

.task-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 24px;
}

#taskremaining,
#taskcompleted {
  margin: 0;
  color: #777;
  font-size: 14px;
}

#completedCount,
#count {
  color: #222;
  font-weight: 600;
}

.filter-area {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  padding: 4px;
  background: #f5f5f5;
  border-radius: 10px;
}

.filter-area button {
  flex: 1;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #777;
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s ease;
}

.filter-area button:hover {
  color: #222;
  background: #eaeaea;
}

.filter-area button:active {
  transform: scale(0.98);
}

.filter-area button.active {
  background: #222;
  color: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
}

.clear-completed {
  margin-bottom: 18px;
  text-align: right;
}

#clearCompletedButton {
  padding: 4px 6px;
  border: 0;
  background: transparent;
  color: #999;
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s ease;
}

#clearCompletedButton:hover {
  color: #e53935;
}

.search-area {
  margin-bottom: 14px;
}

#searchInput {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  outline: none;
  background: #fafafa;
  color: #222;
  font-size: 14px;
  transition: 0.2s ease;
}

#searchInput:hover {
  border-color: #ccc;
}

#searchInput:focus {
  border-color: #222;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

#searchInput::placeholder {
  color: #aaa;
}

.input-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-input-row {
  display: flex;
  gap: 8px;
}

#taskInput {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  outline: none;
  background: #fafafa;
  color: #222;
  font-size: 15px;
  transition: 0.2s ease;
}

#taskInput:hover {
  border-color: #ccc;
}

#taskInput:focus {
  border-color: #222;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

#taskInput::placeholder {
  color: #aaa;
}

#addButton {
  min-width: 82px;
  padding: 0 20px;
  border: 0;
  border-radius: 8px;
  background: #222;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
}

#addButton:hover {
  background: #333;
}

#addButton:active {
  transform: scale(0.98);
}

.task-options {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

#prioritySelect,
#categorySelect,
#dueDateInput {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  outline: none;
  background: #fafafa;
  color: #333;
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s ease;
}

#prioritySelect:hover,
#categorySelect:hover,
#dueDateInput:hover {
  border-color: #ccc;
}

#prioritySelect:focus,
#categorySelect:focus,
#dueDateInput:focus {
  border-color: #222;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

#taskList {
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.task {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
  padding: 12px 4px;
  border-bottom: 1px solid #eee;
  animation: taskIn 0.2s ease;
}

.task:last-child {
  border-bottom: none;
}

.task-info {
  min-width: 0;
  flex: 1;
}

.task-text {
  display: block;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.task-details {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
}

.task-details span {
  padding: 3px 6px;
  border-radius: 5px;
  background: #f5f5f5;
  color: #777;
  font-size: 11px;
  cursor: pointer;
}

.task-details span:hover {
  background: #eaeaea;
  color: #222;
}

.priority-high {
  background: #ffe8e8 !important;
  color: #d32f2f !important;
}

.priority-medium {
  background: #fff4df !important;
  color: #9a6700 !important;
}

.priority-low {
  background: #edf7ed !important;
  color: #4f7d4f !important;
}

.task-details select,
.task-details input[type="date"] {
  padding: 3px 5px;
  border: 1px solid #ddd;
  border-radius: 5px;
  outline: none;
  background: #fafafa;
  color: #555;
  font-family: Arial, sans-serif;
  font-size: 11px;
  cursor: pointer;
}

.task-details select:focus,
.task-details input[type="date"]:focus {
  border-color: #222;
  background: #fff;
}

.completed {
  color: #999;
  opacity: 0.7;
  text-decoration: line-through;
  transition: 0.2s ease;
}

.task-buttons {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.edit-button,
.delete-button {
  padding: 6px 9px;
  border: 0;
  border-radius: 7px;
  background: #f5f5f5;
  color: #888;
  cursor: pointer;
  transition: 0.2s ease;
}

.edit-button:hover {
  background: #eaeaea;
  color: #222;
}

.delete-button:hover {
  background: #ffe8e8;
  color: #e53935;
}

.edit-input {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 7px;
  outline: none;
  background: #fafafa;
  color: #222;
  font-family: Arial, sans-serif;
  font-size: 14px;
}

.edit-input:focus {
  border-color: #222;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.task.removing {
  animation: taskOut 0.2s ease forwards;
}

@keyframes taskIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes taskOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(10px);
  }
}

@media (max-width: 600px) {
  body {
    padding: 30px 15px;
  }

  .todo-container {
    padding: 26px 20px;
  }

  .task-input-row {
    flex-direction: column;
  }

  #addButton {
    min-height: 42px;
  }

  .task-options {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 500px) {
  .task-stats {
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }

  .task {
    align-items: flex-start;
  }

  .task-buttons {
    flex-direction: column;
  }
}
