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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
}

.container {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 520px;
  overflow: hidden;
}

header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 32px 28px 24px;
  color: white;
}

header h1 { font-size: 2rem; font-weight: 700; }
header .subtitle { opacity: 0.85; margin-top: 4px; font-size: 0.95rem; }

.input-area {
  display: flex;
  gap: 10px;
  padding: 20px 24px;
  border-bottom: 1px solid #eee;
}

.input-area input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-area input:focus { border-color: #667eea; }

.input-area button {
  padding: 12px 20px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.input-area button:hover { opacity: 0.9; }
.input-area button:active { transform: scale(0.97); }

.filters {
  display: flex;
  gap: 6px;
  padding: 12px 24px;
  border-bottom: 1px solid #eee;
  background: #fafafa;
}

.filter-btn {
  padding: 6px 16px;
  border: 2px solid transparent;
  border-radius: 20px;
  background: transparent;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: #666;
  transition: all 0.2s;
}

.filter-btn:hover { color: #667eea; }
.filter-btn.active { border-color: #667eea; color: #667eea; background: #f0f0ff; }

#todoList {
  list-style: none;
  padding: 8px 0;
  min-height: 60px;
  max-height: 420px;
  overflow-y: auto;
}

#todoList:empty::after {
  content: 'No tasks here!';
  display: block;
  text-align: center;
  color: #bbb;
  padding: 32px;
  font-size: 0.95rem;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.todo-item:last-child { border-bottom: none; }
.todo-item:hover { background: #fafafa; }

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

.todo-item .todo-text {
  flex: 1;
  font-size: 1rem;
  color: #333;
  word-break: break-word;
  outline: none;
  background: transparent;
  border: none;
  border-bottom: 2px dashed transparent;
  transition: border-color 0.2s;
  padding: 2px 4px;
  border-radius: 4px;
}

.todo-item .todo-text:focus { border-bottom-color: #667eea; background: #f8f8ff; }

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

.delete-btn {
  background: none;
  border: none;
  color: #ccc;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}

.delete-btn:hover { color: #e74c3c; background: #fff0f0; }

footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: #fafafa;
  border-top: 1px solid #eee;
  font-size: 0.875rem;
  color: #888;
}

footer.hidden { display: none; }

#clearCompleted {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 0.875rem;
  transition: color 0.2s;
}

#clearCompleted:hover { color: #e74c3c; }
